RE: [PEAR] Freezing submit button in HTML_QuickForm onSubmit
| From: | Birgir Stefansson | Date: | Mon, 17 Nov 2003 14:26:06 +0000 |
| Subject: | RE: [PEAR] Freezing submit button in HTML_QuickForm onSubmit | ||
| References: | 1 | Groups: | php.pear.general |
| Request: | Send a blank email to pear-general+get-8992@lists.php.net to get a copy of this message | ||
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,
Birgir
> -----Original Message-----
> From: Bertrand Mansion [mailto:bmansion@mamasam.com]
> Sent: 17. nóvember 2003 14:17
> To: Birgir Stefansson
> Cc: pear-general@lists.php.net
> Subject: Re: [PEAR] Freezing submit button in HTML_QuickForm onSubmit
>
>
> <bs@hi.is> wrote :
>
> > I am trying to freeze the submit button after a form has been
> > submitted.
> >
> > $form = new HTML_QuickForm('testform', 'POST',
> $_SERVER['PHP_SELF'],
> > '_self',
> 'onSubmit="document.getElementById(\'SubmitBtn\').disabled =
> > true;"'); $form->addElement('text', 'data', 'Input
> > string:');
> > $this->addRule('data', 'Input string must be filled out',
> 'required',
> > null, 'client');
> > $form->addElement('submit','SubmitBtn','Submit form');
> >
> > Maybe I should have the extra attributes for the constructor as
> > array('onSubmit' =>
> > "document.getElementById('SubmitBtn').disabled =
> > true;") ?
> >
> > This however does not work since onSubmit is set for the
> form for the
> > client-side rule validation ( onsubmit="return
> validate_testform();"
> > ).
> >
> > Am I dont this all wrong or is there any other way to do this ?
>
> I don't really know, maybe you can try:
> onsubmit='this.disable=true;return true;' ?
>
> Bertrand Mansion
> Mamasam
>
>