On Tue, Aug 6, 2013 at 1:12 PM, SiCo <[email protected]> wrote:
> Hi, I'm just playing with Zend InputFilter and am wondering whether it can
> filter arrays (i.e. filter each element of the passed array as an int)? My
> experiments so far don't bode well so I imagine it hasn't made it in. I
> thought the old filter_input did it?
>
> i.e. array(0 => '1', 1 => '2', 2 => '3'); etc.
>
> Hopefully I'm just missing a flag or doing it wrong!
>
> How does a form handle validation of multi checkboxes, is that handled in
> the form or InputFilter?

Filtering !== validation...

For multi checkboxes, radios, and multi-selects, we have an "Explode"
validator, that is used to validate each element of an array against
another validator chain. However, we do not pre-filter the values _in_
the array. The reason is that with the above form types, if the value
is not valid, somebody is most likely tampering with the input values
before submitting them.

Currently, if you want to filter all values of a submitted array,
you'll need to write a pre-processor of some sort to do that.

-- 
Matthew Weier O'Phinney
Project Lead            | [email protected]
Zend Framework          | http://framework.zend.com/
PGP key: http://framework.zend.com/zf-matthew-pgp-key.asc

-- 
List: [email protected]
Info: http://framework.zend.com/archives
Unsubscribe: [email protected]


Reply via email to