QuickForm - disable submit snippet
| From: | Graham Clarke | Date: | Fri, 15 Sep 2006 10:45:47 +0000 |
| Subject: | QuickForm - disable submit snippet | ||
| Groups: | php.pear.general | ||
| Request: | Send a blank email to pear-general+get-25137@lists.php.net to get a copy of this message | ||
Some of you may be interested in this - how to disable the submit button when the user submits the form. Putting the javascript in the form attributes seems to resolves cross-browser issues we experienced with onclick=this.disabled=true in the submit attributes.
I'd be interested to hear if there's a better way.
Cheers,
Graham
// instantiate form
$form = new HTML_QuickForm('myform', 'POST', $_SERVER['REQUEST_URI'], _self', array('onSubmit'=>'this.submit.disabled=true'), true);
// the rest of the form
// submit button
$form->addElement('submit', 'submit', "Submit Payment");
--
Graham Clarke
grahamc@53tech.com
www.53tech.com
603.643.9955