Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <?php
- namespace User\Form;
- use Zend\Form\Form;
- use Zend\Form\Element;
- class UserSaveForm extends Form
- {
- /**
- * Create the form
- *
- * @param string $name Optional name for the form
- */
- public function __construct($name = null)
- {
- // call constructor
- parent::__construct($name);
- // set attributes
- $this->setAttribute('method', 'post');
- // add id
- $this->add(array(
- 'name' => 'id',
- 'type' => 'Zend\Form\Element\Hidden',
- ));
- // add nickname
- $this->add(array(
- 'name' => 'nickname',
- 'type' => 'Zend\Form\Element\Text',
- 'attributes' => array('maxlength' => '32', 'size' => '32'),
- 'options' => array('label' => 'label_user_nickname'),
- ));
- // add password
- $this->add(array(
- 'name' => 'password',
- 'type' => 'Zend\Form\Element\Password',
- 'attributes' => array('maxlength' => '128', 'size' => '32'),
- 'options' => array('label' => 'label_user_password'),
- ));
- // add email
- $this->add(array(
- 'name' => 'email',
- 'type' => 'Zend\Form\Element\Email',
- 'attributes' => array('maxlength' => '128', 'size' => '32'),
- 'options' => array('label' => 'label_user_email', 'appendText' => '@'),
- ));
- // add status
- $this->add(array(
- 'name' => 'status',
- 'type' => 'Zend\Form\Element\Select',
- 'attributes' => array('options' => array()),
- 'options' => array('label' => 'label_user_status'),
- ));
- // add group
- $this->add(array(
- 'name' => 'group',
- 'type' => 'Zend\Form\Element\Select',
- 'attributes' => array('options' => array()),
- 'options' => array('label' => 'label_user_group'),
- ));
- // add firstname
- $this->add(array(
- 'name' => 'firstname',
- 'type' => 'Zend\Form\Element\Text',
- 'attributes' => array('maxlength' => '64', 'size' => '32'),
- 'options' => array('label' => 'label_user_firstname'),
- ));
- // add lastname
- $this->add(array(
- 'name' => 'lastname',
- 'type' => 'Zend\Form\Element\Text',
- 'attributes' => array('maxlength' => '64', 'size' => '32'),
- 'options' => array('label' => 'label_user_lastname'),
- ));
- // Submit button
- $this->add(array(
- 'name' => 'submit_user_save',
- 'type' => 'Zend\Form\Element\Submit',
- 'attributes' => array('value' => 'submit_user_save'),
- 'options' => array(),
- ));
- // Submit button
- $this->add(array(
- 'name' => 'submit_user_list',
- 'type' => 'Zend\Form\Element\Submit',
- 'attributes' => array('value' => 'submit_user_cancel'),
- 'options' => array(),
- ));
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement