Is there any way to make the input mandatory on a prompt messagebox in extjs 4, like add an allowBlank config to the textarea...
Ext.MessageBox unfortunately does not support controlling the close-behavior based on the return value of the login handler (at least in Ext 4.0.2a the return value is not evaluated at all).
As a workaround you can just re-open another MessageBox in your callback handler with the same (or updated) config.
Ext.Msg.prompt('Name', 'Please enter your name:', function(btn, text, cfg) {
if(btn == 'ok' && Ext.isEmpty(text)) {
var newMsg = '<span style="color:red">Please enter your name:</span>';
Ext.Msg.show(Ext.apply({}, { msg: newMsg }, cfg));
}
});
In some cases the user could experience a slight flickering. In my tests, however, it was not noticeable at all. If the user has dragged the MessageBox to a different position it will recenter again.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With