How getting an asynchronous MsgBox synchronous?

Hi everybody

my problem is the following:
I have a popup with a grid, a textfield and some buttons (save, load, delete,...) on it. If the user clicks on the save-button and the value of the textfield is the same like a value of the grid, he gets a confirm-msgBox, if he really wants to save the value.
Because msgBox is asynchronous, the script runs through, without waiting for user interaction (choosing yes or no at the confirm-msgBox). How can I prevent this?
My code looks like the following:
[code]
// Many many code after the save-button is pressed..
var lenge = querystore.data.length; // the length of my store
for (var z = 0; z < lenge; z++) {
if (queryname == querystore.data.items[z].data.query) { // queryname is the value of the textfield // if the value of the textfield == one of the items of the store...
Ext.Msg.show({
title: 'Abfrage vorhanden',
msg: 'Die Abfrage ist bereits vorhaden, soll diese

Hi Animal,
thanks for your help, but could you please post me an example, because I'm not sure, if I got you right...
But I think, I have a workaround for the problem:
I create a boolean before the for-loop and set it to true. If the textfield == a value of the store, I set it to false. After the for-loop, I check the boolean, if it is false or true and run (if it is true) the run_the_request()-function.
To handle the user input with the yes and no-button, I create an on.click() with window.getElementById() and check what button was pressed.
Do you think, this might work?

As mentioned, you just really need to learn a different way of thinking about the problems when it comes to event based programming. There are always ways of chaining events if you think about it the right way.

devnull, I do not disagree with you about the event based programming - I'm just saying that would be really nice one function/method/class to da that. I resolved my problem just using the jscript function 'confirm' but you already know that this function does not have the Ext look and feel.

same requirement for me.
a callback doesn't help. i need a confirm message on a beforeSelect of a combobox, which stops the selection if not confirmed. but with a callback, the selecting will take place, as soon as the callback is called.
i use a normal js comfirm as well (which realy hurts me), cause it actually lets me return a false for the beforeSelect