Hi!
I have an form, where the user can "check"/click some checkboxes. The checkboxes belong to one group.
That means, if the user submits the form, $_POST includes the values of the checkboxes as an array.
Example: an form offers dozen of colors as an checkbox-group
[ ]red [x]green [x]blue [ ]yellow
If the form is submitted to the server, $_POST["COLOR"] includes the array of checked boxes
array{0=>‘green’,1=>‘blue’}
To avoid X-side-scripting, hacking-attacks or something else, i like to validate the submitted results.
For validation it’s not relevant which box is checked. But it’s important, that only the allowed checkbox-values are been progressed by the action.
So the model includes an array with valide values. ($_validColors=array(‘red’=>‘red’,‘blue’=>‘blue’,…) )
For Validation i tried the following rule:
array('COLOR','range','in','range'=>array_keys($this->$_validColors)),
(is this the right way to use that kind of validation?)
But it seems not to be working - no error validation occours. It lookes like the submitted values will be ignored?!
Maybe anyone has an idea?
Thank you!