PDA

View Full Version : Problem in Ext.MessageBox.alert



livinglegends
17 May 2010, 12:24 AM
Hi,

In my application, I want to show two message one by one when I click on a button.
I have written following code on button click event.

Ext.MessageBox.alert('Error', ''Message One will be displayed here');
Ext.MessageBox.alert('Error', 'Message Two will be displayed here');

Ideally, it should show me first message and when I click on Ok button then it should show me second message.
But the problem is I am directly getting second alert box and couldn't view first one.

Please look into it and tell me the solution about it.

Thanks
LivingLegends

jay@moduscreate.com
17 May 2010, 11:07 AM
My first reaction to that is: "That's poor UI design. If you have two messages, tell the user at one time, if possible".

My second reaction is to use a callback to display the second alert. Look at the MessageBox api for details.

evant
17 May 2010, 4:07 PM
From the docs:



Note that the MessageBox is asynchronous. Unlike a regular JavaScript alert (which will halt browser execution), showing a MessageBox will not cause the code to stop. For this reason, if you have code that should only run after some user feedback from the MessageBox, you must use a callback function (see the function parameter for show for more details).