public function __construct() { parent::__construct(); $this->setAttribute('method', 'POST'); $Controller = new Text('Controller'); $Controller->setLabel("Controller: "); $Controller->setAttributes(array("class" => 'form-control')); $this->add($Controller); $nome = new Text('nome'); $nome->setLabel("Nome: "); $nome->setAttributes(array("class" => 'form-control')); $this->add($nome); $label = new Text('label'); $label->setLabel("Label: "); $label->setAttributes(array("class" => 'form-control')); $this->add($label); $route = new Text('route'); $route->setLabel("Route: "); $route->setAttributes(array("class" => 'form-control')); $this->add($route); $select = new \Zend\Form\Element\Select('parentView'); $select->setLabel('Parente View'); $select->setAttributes(array("class" => 'form-control')); $select->setValueOptions(array('0' => 'French', '1' => 'English', '2' => 'Japanese', '3' => 'Chinese')); $this->add($select); $status = new \Zend\Form\Element\Select('Status'); $status->setLabel('Status'); $status->setAttributes(array("class" => 'form-control')); $status->setValueOptions(array('0' => '', '1' => 'Ativo', '2' => 'Inativo')); $this->add($status); $submit = new \Zend\Form\Element\Submit('Salvar'); $submit->setValue('Salvar')->setAttributes(array("class" => 'btn btn-primary btn-lg btn-block')); $this->add($submit); }
public function __construct($name = null, $options = array()) { parent::__construct($name, $options); $this->setAttribute('method', 'post'); $email = new \Zend\Form\Element\Text("email"); $email->setLabel("Email: ")->setAttribute('placeholder', 'Email')->setAttribute('class', 'form-control'); $this->add($email); $password = new \Zend\Form\Element\Password("password"); $password->setLabel("Password: "******"submit"); $submit->setAttribute('value', 'Entrar')->setAttribute('class', 'btn btn-primary btn-block btn-flat'); $this->add($submit); }
/** * @param \Secretary\Entity\User $user * @param string $action */ public function __construct(\Secretary\Entity\User $user, $action = '#') { parent::__construct('userForm'); $this->setAttribute('method', 'post')->setAttribute('action', $action)->setAttribute('class', 'form-horizontal'); $displayName = new \Zend\Form\Element\Text('display_name'); $displayName->setAttribute('required', 'required')->setAttribute('label', 'Display Name')->setValue($user->getDisplayName()); $this->add($displayName); $select = new \Zend\Form\Element\Select('language'); $select->setAttribute('required', 'required')->setAttribute('label', 'Select Language')->setValueOptions(array('de_DE' => 'german', 'en_US' => 'english'))->setValue($user->getLanguage()); $this->add($select); $notifications = new \Zend\Form\Element\Select('notifications'); $notifications->setAttribute('required', 'required')->setAttribute('label', 'Enable notifications')->setValueOptions(array('0' => 'no', '1' => 'yes'))->setValue($user->getNotifications()); $this->add($notifications); $submit = new \Zend\Form\Element\Submit('submit'); $submit->setAttribute('class', 'btn btn-primary')->setAttribute('value', 'save'); $this->add($submit); }
protected function buildForm() { $form = new Form(); $parameters = $this->getUserParameters(); // add the elements to the form foreach ($parameters as $parameter) { $element = $this->buildElement($parameter); $form->add($element); } // modify the input filter foreach ($parameters as $parameter) { $filter = $form->getInputFilter()->get($parameter->name); $filter->setAllowEmpty($parameter->isAllowBlank()); } $submit = new \Zend\Form\Element\Submit('ViewReportControl'); $submit->setValue('View Report'); $form->add($submit); $this->form = $form; return $this; }
public function __construct(EntityManager $em) { parent::__construct('contact'); $this->setAttribute('novalidate', 'novalidate'); $element = new \Zend\Form\Element\Text('prenom'); $element->setLabel('Prénom'); $this->add($element); $element = new \Zend\Form\Element\Text('nom'); $element->setLabel('Nom'); $this->add($element); $element = new \Zend\Form\Element\Email('email'); $element->setLabel('Email'); $this->add($element); $element = new \Zend\Form\Element\Text('telephone'); $element->setLabel('Téléphone'); $this->add($element); $this->add(array('type' => 'DoctrineModule\\Form\\Element\\ObjectSelect', 'name' => 'societe', 'options' => array('label' => 'Société', 'object_manager' => $em, 'target_class' => 'AddressBook\\Entity\\Societe', 'property' => 'nom', 'display_empty_item' => true, 'empty_item_label' => '-- Pas de société --'))); $element = new \Zend\Form\Element\Submit('submit'); $element->setValue('Valider'); $this->add($element); }