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 ?
Try this:
onFormSubmit: function(btn, event) {
var me = this,
form = btn.up('form').getForm();
if(form.isValid()) {
//submit form
}
else alert('Invalid form');
}
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
});
}
}
}]
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