Re: QuickForm select & rule
| From: | Bertrand Mansion | Date: | Wed, 04 Aug 2004 14:10:19 +0000 |
| Subject: | Re: QuickForm select & rule | ||
| References: | 1 | Groups: | php.pear.general |
| Request: | Send a blank email to pear-general+get-13960@lists.php.net to get a copy of this message | ||
Julien Huang wrote:
>Hello,
>
>I want to add a rule on a select element:
>
><select name="company_id[]">
> <option value="0">-- Choose a company --</option>
> <option value="1">A</option>
> <option value="2">B</option>
></select>
>
>If I add a rule like this:
>$form->addRule('company_id', 'Please, select a company',
>'required');
>
>It won't work if the user let the selected element to option 0. How can
>I add a rule which will warn the user about that (without using a
>callback :-p) ?
Can you try with option value="" instead of option value="0" ?
Bertrand Mansion
Mamasam