I am in the beginning of learning Zend Framework.
I need to check if a string has exceed the maximum, say, 200, and minimum length is 0.
Here is the validatorRules I created:
$validators = array('descr' => array(array('stringLength', array('max'=>200))));
But this validator return false if the stringLength is 0.
What I want is a validator that make sure my string is below 200. (length of 0 is acceptable)
edit: I am not using form, instead, is a REST web service, that accept input from query string, so 'setRequired' is not working in my case.
Any solution?
Thanks.
Best Answer
ok make sure you don't have
setRequired(true);
(or set it to false if you like) and then useaddValidator('stringLength', false, array(0, 200))