php - How to validate a form Collection -


i'm not being able validate form collection element, here how fieldset looks like:

class productfieldset extends fieldset implements inputfilterproviderinterface {     public function init()     {         $this->setname('product');          $this->add(array(             'name' => 'features',             'type' => 'collection',             'options' => array(                 'label'          => 'características produto',                 'count'          => 0,                 'should_create_template' => true,                 'allow_add'      => true,                 'target_element' => array(                     'type'    => 'text',                 ),             ),         ));     }      public function getinputfilterspecification()     {         return array(             'features' => array(                 'required' => false,                 'filters' => array(                     array('name' => 'stringtrim'),                 ),                 'validators' => array(                     array(                         'name' => 'stringlength',                         'options' => array(                             'min'      => 10,                         ),                     ),                 ),             ),         );     } } 

if add element , leave empty validation passes, should not, since stringlength requires @ least 10 characters. must missing something, if can show me i'm doing wrong thankful.


Comments