PDA

View Full Version : Client Validation Help


RichGags
10-12-2009, 07:38 PM
I have a form that Im validating with the Client Validation Wizard. It works perfectly when I use <input type="submit" /> as the submit. However, I would like to disable the submit button on press.

I tried some code I found

<input type="button" value="Submit" onclick="this.form.submit();this.disabled=true; this.value='Processing'" />
but it skips the validation.

I also tried <input type=submit name='sub' value='Submit'> and put document.form1.sub.disabled=true after the return document.MM_returnValue but that didnt work either. If I put document.form1.sub.disabled=true before the document.MM_returnValue the submit gets disabled, but if the validation fails, the button stays disabled.

Any help would be greatly appreciated. Thanks,
Rich

Ray Borduin
10-13-2009, 10:07 AM
Just move all of the code in the onSubmit event of the form to the onclick event of the button.

Then instead of:

return document.MM_returnValue

use:
if (document.MM_returnValue==true) { this.form.submit();this.disabled=true; }

RichGags
10-14-2009, 03:45 AM
Perfect. Thanks.