Extjs Form Validation before Submit
18,008
Solution 1
Try this:
onFormSubmit: function(btn, event) {
var me = this,
form = btn.up('form').getForm();
if(form.isValid()) {
//submit form
}
else alert('Invalid form');
}
Solution 2
buttons: [{
text: "Continue",
margin: "0 5 10 0",
handler: function () {
var getForm = this.up("form").getForm();
if (getForm.isValid()) {
code her if form is valid
} else {
Ext.MessageBox.show({
title: "ERROR-A1001",
msg: "Please fill the required fields correctly.",
buttons: Ext.MessageBox.OK,
icon: Ext.MessageBox.WARNING
});
}
}
}]
Related videos on Youtube
Author by
Noon
Updated on May 25, 2022Comments
-
Noon almost 2 years
I have an Extjs form which it needs some validations like when I enter letters instead of numbers, it should alert me before I submit. direct before I enter one number in the field. How can I build that ?
-
MasterAM almost 11 yearsSomething like this?
-