Re: Freezing submit button in HTML_QuickForm onSubmit
| From: | Jeroen Houben | Date: | Mon, 17 Nov 2003 15:35:58 +0000 |
| Subject: | Re: Freezing submit button in HTML_QuickForm onSubmit | ||
| References: | 1 | Groups: | php.pear.general |
| Request: | Send a blank email to pear-general+get-8997@lists.php.net to get a copy of this message | ||
Bertrand Mansion wrote:
<jeroen@terena.nl> wrote :In the submit button declaration: $form->addElement('submit', 'submit', 'submit', array('onclick' => 'this.disable=true;return true;')); Sorry. Still, I haven't tested yet. Let me know how it goes. As for 3.2, it isn't changed compared to 3.1. BertrandBertrand Mansion wrote:<bs@hi.is> wrote :I meant :Thanks for a quick reply Betrand. I played around with this thing and took out client-side validation. After that I can set the onSubmit attribute for the form. Client-side javascript rule validation is set as onSubmit for the form if the elements are set to be validated client-side and therefore it seems to me that I can't set any other onSubmit functionality when I have client-side rule validation. I haven't updated to the latest version of HTML_QuickForm yet but is this working as expected or are there ways to do this ? Regards, Birgironsubmit='this.disable=true;return true;' ?
Snipper from my code: inside my php file: $form->addElement('submit', 'submitter', 'Save', array("onClick"=>"button_click(this, 'Processing ...')","class"=>"button")); inside my javascript file: function button_click(control, msg) { control.value = msg; control.disabled = true; } works for me. HTH, Nice. Will this allow the client-side validation as well (onsubmit form event) ? If not, it could probably be added in the button_click function. No because the button will be disabled so the user won't be able to press it again after a Javascript validation error. If you want JS validation too you should be using onSubmit. But it's not impossible to execute 2 or more function in one JS event. Just try this code in your browser, it should work: <form onsubmit="alert('these');alert('those');"> <input type="Button" name="x" value="clickme" onclick="alert('this');alert('that');"> <input type="submit" name="y" value="submitme"> </form> only problem could be that generating this code through QF could *overwrite* the onsubmit value, where it should be *adding* to it.But I don't know for sure how this is handled inside QF. HTH jeroen