PDA

View Full Version : Form submission, monitorValid / formBind...



javabee
10 Sep 2010, 1:19 AM
Hi all, I have a form with various client side validation elements and i use monitorValid combined with formBind to prevent submission until validated. This works fine at the moment as the submission button is a direct child of the 'form' panel. Can i bind a random button (in some other panel) with formBind?


function buildMainForm()
{
return {
xtype: 'form',
url : 'submissionUrl.do',
border: false,
monitorValid: true,
id : 'testForm',
buttons:[{
text:'Submit',
formBind:true // prevents submission until client validation is 'ok'.
}],
items:
[
buildCustomerDetailsColumn(), // its in THIS panel that i want to put the submit button with formBind: true
]
}
}



can you use formBind on a button that is defined outside the formPanel :-/

Thanks in advance

Condor
10 Sep 2010, 1:29 AM
You'll need to use:

form.on('clientvalidation', function(f, valid){
button.setDisabled(!valid);
});

javabee
10 Sep 2010, 1:39 AM
ahh who needs formBind anyway eh? :) Nice one, thanks for such a quick response!

BlueZealot
29 Jul 2011, 7:06 AM
Just what I needed, Thank you, Condor. <3