I agree, Zend_Filter_Validate usually handles an array input
correctly by applying filters and validators to each element in turn.
However I think that there is definitely the use case where an array
of input needs to be validated as a whole. This can be done in a
variety of 'hacky' ways like the one below, or by using static
variables for instance.
What's the process for proposing small updates like this to the
Framework?
On 31/10/2007, at 7:53 AM, Václav Vaník wrote:
Well, I found solution
$validators = array(
'se' => array($vNotEmpty, 'fields' => array('se', 'se'))
);
$filterInput = new Zend_Filter_Input($filters, $validators);
$filterInput->setData($this->_request->getPost());
where $vNotEmpty is instance of my own validator (inherited
zend_validate_abstract)
isValid() method is:
public function isValid($value)
{
foreach (array_shift($value) as $v)
{
if (!empty($v))
{
return true;
}
}
$this->_error();
return false;
}
but I think the use of fields meta commands is very UNCOMFORTABLE
--
View this message in context: http://www.nabble.com/How-to-validate-
array-of-checkboxes--tf4712737s16154.html#a13495194
Sent from the Zend Framework mailing list archive at Nabble.com.