Created
March 14, 2014 19:50
-
-
Save nclundsten/9555417 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
$form = new \Zend\Form\Form; | |
$form->setInputFilter($formFilter = new \Zend\InputFilter\InputFilter()); | |
$fieldSet = new \Zend\Form\FieldSet; | |
$fieldSet->setName('subforms'); | |
$subForm = new \Zend\Form\Form; | |
$subForm->setName(0); | |
$subForm->add(array( | |
'name' => 'text', | |
'attributes' => array( | |
'type' => 'text' | |
), | |
)); | |
$subForm->setInputFilter($subFormFilter = new \Zend\InputFilter\InputFilter()); | |
$subFormFilter->add(array( | |
'name' => 'text', | |
'required' => true, | |
'allow_empty' => false, | |
)); | |
$fieldSet->add($subForm); | |
$form->add($fieldSet); | |
$data = array( | |
//note that subforms[0][text] is required and im not passing it | |
); | |
$form->setData($data)); | |
echo $form->isValid(); //true, should be false | |
?> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment