Re: Re: user DOUBLE-CLICK'in in submit form button !
| From: | Bertrand Mansion | Date: | Mon, 12 Jul 2004 12:03:49 +0000 |
| Subject: | Re: Re: user DOUBLE-CLICK'in in submit form button ! | ||
| References: | 1 | Groups: | php.pear.general |
| Request: | Send a blank email to pear-general+get-13653@lists.php.net to get a copy of this message | ||
Thorsten Suckow-Homberg wrote:
>> Is there any way to prevent that? I read that it can
>> be prevented with javascript but I don't found any
>> examples
>
>Usually u catch the onsubmit- or onmousedown-event and add an attribute
>named "disabled" to the button :
>
>function disableButton()
>{
>document.getElementById("butt").disabled = true;
>}
>
><form ...onsubmit="disableButton()">
>
><input id="butt" type="submit" value="Send data">
></form>
>
>
>
>> and I dont know even how to integrate that
>> into QuickForm.
>
>Well I guess for this u have to wait for the QF-experts.
Well, this can be done with:
$button = &HTML_QuickForm::createElement('submit', 'submit',
'submit',
array('onclick'=>"this.disabled = true;this.value = 'Wait...'"));
But if you use javascript validation (on client), your button will be disabled,
so the user won't be able to repost the form. And at the moment, it is not
possible to add custom js to the form onSubmit event, but this might change in
the future...
Bertrand Mansion
Mamasam