Re: QuickForm this.form.submit(), errors don't show up
| From: | Alexey Borzov | Date: | Tue, 20 Jun 2006 21:44:34 +0000 |
| Subject: | Re: QuickForm this.form.submit(), errors don't show up | ||
| References: | 1 | Groups: | php.pear.general |
| Request: | Send a blank email to pear-general+get-24444@lists.php.net to get a copy of this message | ||
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(); }