Home » HTML » HTML_QuickForm » Bug #1223
select element validation
Details
| Submitted | 2004-04-16 16:51 UTC |
|---|---|
| From | sagi at boom dot org dot il |
| Status | Wont fix |
| Package | HTML_QuickForm |
| PHP Version | Irrelevant |
| OS | -- |
| Roadmaps | (Not assigned) |
Comments
[2004-04-16 16:51 UTC] sagi at boom dot org dot il
Description:
------------
The select element value is not validated against its $options. There should atleast be an option to force QF to check if the value is one of the given options.
The manual is misleading in few places, saying exportValues() only returns "safe" values for example.
Here's a workaround:
$form->registerRule('isSet', 'callback', 'array_key_exists');
$form->addElement('select', 'manufacturer', 'Manufacturer', $manufacturers);
$form->addRule('manufacturer', 'Invalid Manufacturer', 'isSet', &$manufacturers);
But this functionality should really be part of the base package.
[2004-04-19 12:06 UTC] sagi at boom dot org dot il
Sorry, you are right - exportValues() works well now.
However, it is still not possible to display an error back to the user if the option does not exists without registering a custom rule.
I believe such rule shuld atleast be part of the base package, and maybe even be turned on by default.