Pages

Monday, January 25, 2010

ExtJS -=- Disabling FormPanel submit if validation fails

To disable the FormPanel’s submit button if the validation fails (example like allowBlank:false). You will need to set the FormPanel’s monitorValid to true and the submit button’s formBind to true.


var form=new Ext.form.FormPanel{
monitorValid:true,
items:[{
name:"testing",
xtype:'textfield',
fieldLabel:'Test',
allowBlank:false,   //Must be filled in
value:''            //Set the value so that the validation will trigger
}],
buttons:[{
text:'Submit',
formBind:true   //If validation fails disable the button
}
]
}

No comments:

Post a Comment