Re: QuickForm this.form.submit(), errors don't show up

From: Date: Mon, 19 Jun 2006 20:53:25 +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-24437@lists.php.net to get a copy of this message
Hi, Mark Steudel wrote:
Actually I meant the server side message, not the javascript error message.
Use the $trackSubmit parameter of QuickForm's constructor: http://pear.php.net/manual/en/package.html.html-quickform.html-quickform.html-quickform.php Clarification: if you submit your form currently the $_POST array may be completely empty and form will be considered not submitted. Non-selected checkboxes do not appear in $_POST and since you are using form.submit() the name=value of your submit button isn't sent, either. The other possible approach is changing your javascript to this.value='Submitting form please wait...';this.disabled=true;return true;
Example form $form =& new HTML_QuickForm('testform'); // 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('&nbsp;', '<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();") );


« previous php.pear.general (#24437) next »