Created
September 11, 2013 07:22
-
-
Save Goram/6520307 to your computer and use it in GitHub Desktop.
This file contains hidden or 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 Form(); | |
$form->setAttribute('method', 'post'); | |
$fieldset1 = new Fieldset('user'); | |
$fieldset1->setOptions(array( | |
'use_as_base_fieldset' => true | |
)); | |
$fieldset1->add(array( | |
'name' => 'username', | |
'type' => 'Text', | |
'options' => array( | |
'label' => 'Username1:' | |
) | |
)); | |
$fieldset2 = new Fieldset('book'); | |
$fieldset2->setObject(new Book()); | |
$fieldset2->add(array( | |
'name' => 'name', | |
'type' => 'Zend\Form\Element\Text', | |
'options' => array( | |
'label' => 'Buch:' | |
) | |
)); | |
$fieldset1->add($fieldset2); | |
$form->add($fieldset1); | |
$form->add(array( | |
'name' => 'submit', | |
'type' => 'Zend\Form\Element\Submit', | |
'attributes' => array( | |
'value' => 'Speichern' | |
) | |
)); | |
$inputFilter = new InputFilter(); | |
$inputFilter->add( | |
array( | |
'type' => 'InputFilter', | |
array( | |
'name' => 'username', | |
'validators' => array( | |
array( | |
'name' => 'StringLength', | |
'options' => array( | |
'min' => 5, | |
'max' => 255, | |
'message' => 'Mindestens 5 und maximal 255 Zeichen lang' | |
) | |
) | |
) | |
), | |
), | |
'user' | |
); | |
$form->setInputFilter($inputFilter); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment