QuickForm select & rule
| From: | Julien Huang | Date: | Wed, 04 Aug 2004 13:51:27 +0000 |
| Subject: | QuickForm select & rule | ||
| Groups: | php.pear.general | ||
| Request: | Send a blank email to pear-general+get-13959@lists.php.net to get a copy of this message | ||
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) ?
--
Julien Huang