Re: QuickForm validation
| From: | Sagi Bashari | Date: | Tue, 13 Apr 2004 11:15:45 +0000 |
| Subject: | Re: QuickForm validation | ||
| References: | 1 | Groups: | php.pear.general |
| Request: | Send a blank email to pear-general+get-11817@lists.php.net to get a copy of this message | ||
On 13/04/2004 13:58, Mike Carter wrote:
Yeah. I already wrote a basic validator for that myself: $form->registerRule('isSet', 'callback', 'array_key_exists'); $form->addElement('select', 'manufacturer', 'Manufacturer', $manufacturers); $form->addRule('manufacturer', 'Invalid Manufacturer', 'isSet', &$manufacturers); But I wonder why such functionality is not provided by QF itself. Moreover the manual states otherwise in few places: http://pear.php.net/manual/en/package.html.html-quickform.html-quickform.exportvalues.php): "Unlike *getSubmitValues()* <http://pear.php.net/manual/en/package.html.html-quickform.html-quickform.getsubmitvalues.php>, this will return only the values corresponding to the elements added to the form <http://pear.php.net/manual/en/package.html.html-quickform.html-quickform.addelement.php> and only the values that could actually be submitted: if we have 'Yes'/'No' radiobuttons 'Maybe' will not be considered a valid submit value. You also cannot get values for file elements via" Which is wrong.1. Is it possible to make the select element automatically validate that a value is part of $options?Would the select element only list things in the $options array provided to it anyway?
Obviously its not a reason for not to including such a common validator in the base package. Sagi2. How can I validate if a value is in a specific numrange? I've seen such class in the rules-custom.php example but shouldn't such a basic validation be part of the normal package?I asked the very same question a while back. The reason it is in the custom rules example code is because the developers could not think of another example rule to develop and provide as an example.