RE: [PEAR] QuickForm this.form.submit(), errors don't show up
| From: | Mark Steudel | Date: | Wed, 21 Jun 2006 00:12:11 +0000 |
| Subject: | RE: [PEAR] QuickForm this.form.submit(), errors don't show up | ||
| References: | 1 | Groups: | php.pear.general |
| Request: | Send a blank email to pear-general+get-24445@lists.php.net to get a copy of this message | ||
Aha! That was it, I was on 3.2.4pl1 and I upgraded to 3.2.5 and now I get
the right behavior, sorry about that and thanks much!
-----Original Message-----
From: Alexey Borzov [mailto:borz_off@cs.msu.su]
Sent: Tuesday, June 20, 2006 2:45 PM
To: Mark Steudel
Cc: pear-general@lists.php.net
Subject: Re: [PEAR] QuickForm this.form.submit(), errors don't show up
Hi,
Mark Steudel wrote:
> I thought I did, here's the code, am I setting it right?
Your code works as expected here:
1) Button is disabled on submit
2) Error is displayed if no checkbox selected / one checkbox selected.
What version of QuickForm are you using?
>
> ==============================================
>
> $form =& new HTML_QuickForm('testform', 'post', null, null, null,
> true);
>
> // also tried setting the page specifically
> // $form =& new HTML_QuickForm('testform', 'post',
> 'checkbox.php', null,
> null, true);
>
> // Creates a checkboxes group using an array of separators
> $checkbox[] = &HTML_QuickForm::createElement('checkbox', 'A', null,
> 'A');
> $checkbox[] = &HTML_QuickForm::createElement('checkbox', 'B', null,
> 'B');
> $checkbox[] = &HTML_QuickForm::createElement('checkbox', 'C', null,
> 'C');
> $checkbox[] = &HTML_QuickForm::createElement('checkbox', 'D', null,
> 'D');
> $form->addGroup($checkbox, 'ichkABC', 'ABCD:',
> array(' ', '<br />'));
>
> // At least one element is required
> $form->addGroupRule('ichkABC', 'Please check at least two boxes',
> 'required', null, 2);
>
> $form->addElement( 'submit', 'submitForm', 'Submit Form',
> array(
"onclick"=>
> "this.value='Submitting form please
> wait...';this.disabled=true;this.form.submit();return true;") );
>
> if( $form->validate() )
> {
>
> }
> else
> {
> $form->display();
> }