QuickForm validation suggestion
| From: | Bryn Forbes | Date: | Thu, 17 Apr 2003 18:42:32 +0000 |
| Subject: | QuickForm validation suggestion | ||
| Groups: | php.pear.general | ||
| Request: | Send a blank email to pear-general+get-4932@lists.php.net to get a copy of this message | ||
I've been spending a good amount of time looking at the different form
validation scripts out there and contemplating porting the one I wrote
to PHP. QuickForm seems to a nice combination of features and low code
volume requirements.
One thing that I think is missing is some validation options, some of
which I've written some rules to do, but others might make more sense to
be more integrated. If I have missed something please correct me or clue
me in.
I'd like the validation to be able to check to make sure that not only
are response valid, but they are one of the options presented to the
user.
For example, with a select box, the submitted value, should be one of
the items in the select list, like wise radio buttons should only be
allowed to be one of the radio values.
For the select box, this can easily be accomplished it seems with the
following rule:
function validateSelect($element, $submittedvalue)
{
$possiblevalues = $element->getValue()
return in_array($value, $possiblevalues)
}
I'd suggest that something like this be included as one of the rules
shipped with QuickForm.
But there's doesn't seem to be an easy way to make sure for a group that
it's selected value is one of the values of the elements in the group.
Can somebody suggest a way to write a rule to do this?
Also, if there was a web page detailing what the available rules are,
that would super handy.
Anyway, I know everyone's busy, but in case people hadn't thought of
this stuff, I figured I'd post. As I write rules, I'll try and
contribute them and pitch in, in other ways.
Thanks,
Bryn