RE: [PEAR] QuickForm this.form.submit(), errors don't show up
| From: | Mark Steudel | Date: | Tue, 20 Jun 2006 21:32:53 +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-24443@lists.php.net to get a copy of this message | ||
I thought I did, here's the code, am I setting it right?
==============================================
$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();
}
-----Original Message-----
From: Justin Patrin [mailto:papercrane@gmail.com]
Sent: Monday, June 19, 2006 6:05 PM
To: Mark Steudel
Cc: Alexey Borzov; pear-general@lists.php.net
Subject: Re: [PEAR] QuickForm this.form.submit(), errors don't show up
On 6/19/06, Mark Steudel <mark@netriver.net> wrote:
> Thank you for your ideas Alexy, I wasn't able to get it to work. Oh well,
it
> was more just eye candy anyway.
Did you try setting trackSubmit to true? It should work if you do.
>
> Mark
>
> -----Original Message-----
> From: Alexey Borzov [mailto:borz_off@cs.msu.su]
> Sent: Monday, June 19, 2006 1:53 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:
> > 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.htm
> l-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(' ', '<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();") );
>
> --
> PEAR General Mailing List (http://pear.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php
>
> --
> PEAR General Mailing List (http://pear.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php
>
>
--
Justin Patrin