Re: HTML_QuickForm 2.4 to 2.5 functionality diff
| From: | Bertrand Mansion | Date: | Fri, 13 Dec 2002 18:29:54 +0000 |
| Subject: | Re: HTML_QuickForm 2.4 to 2.5 functionality diff | ||
| References: | 1 | Groups: | php.pear.dev |
| Request: | Send a blank email to pear-dev+get-11620@lists.php.net to get a copy of this message | ||
<culley@ml1.net> wrote :
> Enter a value in the first name field of the form generated from this
> code and submit the form with the last name field left blank. The value
> entered is *not* displayed in addition to the message for the required
> rule on last name.
>
>
> //=================================================
> $form =& new HTML_QuickForm('form1');
> $element = &HTML_QuickForm::createElement('text', 'first_name',
> 'First
> Name:');
> $element->setSize(50);
> $form->addElement($element);
> $element2 = &HTML_QuickForm::createElement('text', 'last_name',
> 'Last
> Name:');
> $element2->setSize(50);
> $form->addElement($element2);
>
> $form->addElement('submit', 'save_button', 'Save');
> $form->addRule('first_name', 'First name is a required field.',
> 'required');
> $form->addRule('last_name', 'Last name is a required field.',
> 'required');
> $form->validate();
> $form->display();
> //=================================================
>
>
> This one is causing me enough greif that I would like to go back to 2.4
> but the 2.4 package on pear.php.net appears to only contain the
> package.xml file.
Up to you but I will try to fix that this weekend.
In the meanwhile you can do:
$form->addElement('text', 'last_name', 'LastName:',
'size=50');
instead of:
> $element2 = &HTML_QuickForm::createElement('text', 'last_name',
> 'Last
> Name:');
> $element2->setSize(50);
> $form->addElement($element2);
Bertrand Mansion
Mamasam