Hi there I have just gone through a code and saw a line of Zend validation. I am unable to understand what it means.
$affiliateModel = new AffiliateUser();
$metaData = $affiliateModel->info('metadata');
And here is my form element
$first_name = new Zend_Form_Element_Text('first_name');
$first_name->setRequired(true)
->addFilter('StringTrim')
->addValidator('StringLength', false, array(2, $metaData['first_name']['LENGTH']))
->setDecorators(array('ViewHelper', 'errors'));
I know what every line do but what this line will do
->addValidator('StringLength', false, array(2, $metaData['first_name']['LENGTH']))
Does any body will explain what this validator will do?
->addValidator('StringLength', false, array(2, $metaData['first_name']['LENGTH']));Will add a validator that will only consider a string valid if it’s length falls in [2, x] where x is the
$metaData[...][...]value. (Internally, the form will create and configure aZend_Validate_StringLengthinstance.)