PDA

View Full Version : Leave multi-line message box opened after clicking OK



Royan
26 Nov 2007, 7:47 AM
Is it possible to implement some validation to the multi-line message box from this example: http://extjs.com/deploy/dev/examples/message-box/msg-box.html

For instance if user has not entered any text into the textbox I want to display some warning and leave my multi-line message box opened. While i don't have problems with adding warning I still have problems with the multi-line message box as it disappears immediately after I click "OK" button. Is there any way I can leave it intact?

efege
26 Nov 2007, 8:02 AM
Since a message box is an Ext.Window, you may try using the beforehide or beforeclose events.

para
26 Nov 2007, 9:10 AM
I overwrote the Ext 2.0 message box with a couple of updates, including validation.
The validator config is the same validator as a standard Ext2 textfield validator.
It also allows for up to 2 combo boxes to be displayed.



Ext.MessageBox.show({
title: 'Name',
msg: 'Name Of New ' + nodeConfig.name + ':',
buttons: Ext.MessageBox.OKCANCEL,
prompt:true,
validator: validators.childName,
fn: function (btn, text, cBoxes){
}
});


This may not be exactly what you need, but it should be close or give you a good starting point.