PEAR is archived and read-only

This mirror preserves historical PEAR package releases and metadata so existing references remain available.

Home » HTML » HTML_QuickForm » Bug #1223

select element validation

Details

Submitted2004-04-16 16:51 UTC
Fromsagi at boom dot org dot il
StatusWont fix
PackageHTML_QuickForm
PHP VersionIrrelevant
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.