public function testIgnoreLabelForHidden() { $element = new Element\Hidden('foo'); $element->setLabel('My label'); $markup = $this->helper->render($element); $this->assertEquals('<input type="hidden" name="foo" value=""/>', $markup); }
/** * @param $which * @return $this */ public function setWhich($which) { $hidden = new Form\Element\Hidden('which'); $hidden->setLabel(' '); $hidden->setValue($which); $this->add($hidden); return $this; }
public function __construct($serviceLocator, $options = null) { parent::__construct('AccountIndex'); $this->setServiceLocator($serviceLocator); $this->setAttribute('method', 'post'); $filter = $this->getInputFilter(); $group = new DisplayGroup('Subject'); $group->setLabel('Thêm mentor'); $this->add($group); // name $userName = new Text('userName'); $userName->setLabel('Người dùng: '); $userName->setAttributes(['maxlength' => 255]); if ($options == 'edit') { $userName->setAttribute('disabled', 'disabled'); } $this->add($userName); $group->addElement($userName); $filter->add(array('name' => 'userName', 'required' => $options == 'edit' ? false : true, 'filters' => array(array('name' => 'StringTrim')), 'validators' => array(array('name' => 'NotEmpty', 'break_chain_on_failure' => true, 'options' => array('messages' => array('isEmpty' => 'Bạn chưa nhập người dùng')))))); $userId = new Hidden('userId'); $this->add($userId); $group->addElement($userId); $filter->add(array('name' => 'userId', 'required' => $options == 'edit' ? false : true, 'filters' => array(array('name' => 'StringTrim')), 'validators' => array(array('name' => 'NotEmpty', 'break_chain_on_failure' => true, 'options' => array('messages' => array('isEmpty' => 'Bạn chưa nhập người dùng')))))); // code $description = new Textarea('description'); $description->setLabel('Mô tả mentor:'); $description->setAttributes(['class' => 'form-control basicEditor ', 'style' => 'min-height: 300px;']); $this->add($description); $group->addElement($description); $filter->add(array('name' => 'description', 'required' => false, 'filters' => array(array('name' => 'StringTrim')), 'validators' => array(array('name' => 'NotEmpty', 'break_chain_on_failure' => true, 'options' => array('messages' => array('isEmpty' => 'Bạn chưa nhập mô tả môn học')))))); $subject = new Text('subject'); $subject->setLabel('Tên môn:'); $subject->setAttributes(['maxlength' => 255, 'style' => 'width:100% !important', 'placeholder' => 'Tên môn học']); $subject->setOptions(array('tagsinput' => true, 'description' => 'Tên môn học')); $this->add($subject); $group->addElement($subject); $filter->add(array('name' => 'subject', 'required' => false, 'filters' => array(array('name' => 'StringTrim')), 'validators' => array(array('name' => 'NotEmpty', 'break_chain_on_failure' => true, 'options' => array('messages' => array('isEmpty' => 'Bạn chưa nhập tên môn')))))); $subjectId = new Hidden('subjectId'); $subjectId->setLabel('Tên môn:'); $this->add($subjectId); $group->addElement($subjectId); $filter->add(array('name' => 'subjectId', 'required' => false, 'filters' => array(array('name' => 'StringTrim')), 'validators' => array(array('name' => 'NotEmpty', 'break_chain_on_failure' => true, 'options' => array('messages' => array('isEmpty' => 'Bạn chưa nhập tên môn')))))); $this->add(array('name' => 'afterSubmit', 'type' => 'radio', 'attributes' => array('value' => '/admin/expert/add'), 'options' => array('layout' => 'fluid', 'clearBefore' => true, 'label' => 'Sau khi lưu dữ liệu:', 'value_options' => array('/admin/expert/add' => 'Tiếp tục nhập', '/admin/expert/index' => 'Hiện danh sách vừa nhập')))); $this->add(array('name' => 'submit', 'options' => array('clearBefore' => true), 'attributes' => array('type' => 'submit', 'value' => 'Lưu', 'id' => 'btnSave', 'class' => 'btn btn-primary'))); }
public function __construct(EntityManager $em, $name = null, $options = array()) { $this->em = $em; // we want to ignore the name passed parent::__construct('vehiclemodelversion'); $this->setAttribute('method', 'post'); $this->add(array('name' => 'vehicleModelVersionId', 'attributes' => array('type' => 'hidden'))); /* $this->add(array( 'name' => 'vehicleModelId', 'type' => 'Zend\Form\Element\Select', 'options' => array( 'label' => 'Vehicle Model', 'empty_option' => 'Select', ), 'attributes' => array( 'id' => 'vehicleModel', ), )); */ $vehicleModel = new Element\Select('vehicleModelId'); $vehicleModel->setEmptyOption("Models"); $vehicleModel->setAttributes(array('id' => 'vehicleModel', 'class' => 'dropDnInput')); $vehicleModel->setDisableInArrayValidator(TRUE); $this->add($vehicleModel); $vehicleBrand = new Element\Select('vehicleBrandId'); $vehicleBrand->setEmptyOption("Select Brand"); $vehicleBrand->setAttributes(array('id' => 'vehicleBrand', 'class' => 'dropDnInput')); $vehicleBrand->setValueOptions($this->getOptionsForSelectBrands()); $vehicleBrand->setDisableInArrayValidator(TRUE); $this->add($vehicleBrand); $this->add(array('name' => 'vehicleModelVersionName', 'attributes' => array('type' => 'text', 'class' => 'commonDropDnInput', 'placeholder' => 'Vehicle Model Version Name'))); $vehicleModeltemp = new Element\Hidden('vehicleModelIdTemp'); $vehicleModeltemp->setLabel('Vehicle ModelId'); $vehicleModeltemp->setAttributes(array('id' => 'vehicleModelIdTemp')); $this->add($vehicleModeltemp); $this->add(array('name' => 'status', 'type' => 'Select', 'attributes' => array('class' => 'dropDnInput'), 'options' => array('empty_option' => 'Select Status', 'value_options' => array('0' => 'InActive', '1' => 'Active')))); $this->add(array('name' => 'submit', 'attributes' => array('type' => 'submit', 'value' => 'vehiclemodelversionadd', 'id' => 'submitbutton', 'class' => "btn-blue"))); }
public function __construct($serviceLocator, $options = null) { parent::__construct('AccountIndex'); $this->setServiceLocator($serviceLocator); $this->setAttribute('method', 'post'); $filter = $this->getInputFilter(); $group = new DisplayGroup('Subject'); $group->setLabel('Thêm mentor'); $this->add($group); $subject = new Text('subject'); $subject->setLabel('Tên môn:'); $subject->setAttributes(['maxlength' => 255, 'style' => 'width:100% !important', 'placeholder' => 'Tên môn học']); $subject->setOptions(array('tagsinput' => true, 'description' => 'Tên môn học')); $this->add($subject); $group->addElement($subject); $filter->add(array('name' => 'subject', 'required' => false, 'filters' => array(array('name' => 'StringTrim')), 'validators' => array(array('name' => 'NotEmpty', 'break_chain_on_failure' => true, 'options' => array('messages' => array('isEmpty' => 'Bạn chưa nhập tên môn')))))); $subjectId = new Hidden('subjectId'); $subjectId->setLabel('Tên môn:'); $this->add($subjectId); $group->addElement($subjectId); $filter->add(array('name' => 'subjectId', 'required' => false, 'filters' => array(array('name' => 'StringTrim')), 'validators' => array(array('name' => 'NotEmpty', 'break_chain_on_failure' => true, 'options' => array('messages' => array('isEmpty' => 'Bạn chưa nhập tên môn')))))); $this->add(array('name' => 'submit', 'options' => array('clearBefore' => true), 'attributes' => array('type' => 'submit', 'value' => 'Lưu', 'id' => 'btnSave', 'class' => 'btn btn-primary'))); }