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); }
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); }