FAQ Database Discussion Community


Zend Form Validation set error messages

zend-framework2,zend-form,zend-validate
I have setup a form along with filters and validators which seem to work correctly. However, I can not seem to get custom error messages to work. So far I have tried. $inputFilter->add(array( 'name' => 'message', 'required' => TRUE, 'filters' => array( array('name' => 'StripTags'), array('name' => 'StringTrim'), ), 'validators'...

ZEND_Auth, deactivate navigation area

zend-framework2,zend-form,zend-layout
I´ve built a Login Page using Zend_Auth. Now my question ist how can I deactivate areas which are loaded with my layout.phtml? Here the part of my code of my layout.phtml which I don´t want to see in my login and logout forms: <div id="navigation"> <ul> <li><a href="<?php echo $this->url(array('controller'=>'arbeitskalender',...

My form is not getting validated in Zend Famework. Why?

php,zend-framework2,zend-form,zend-rest
I am creating a rest Module for album module of zf2 My Code Snippet for create method : public function create($data) { $form=new AlbumForm(); $album = new Album(); $form->setInputFilter($album->getInputFilter()); $form->setData($data); if ($form->isValid()) { $album->exchangeArray($form->getData()); $id = $this->getAlbumTable()->saveAlbum($album); return new JsonModel(array( 'data' => $this->get($id), )); } All the functionalities like update,select...

How to make MultiCheckBox Label bold or strong?

zend-framework2,zend-form,zend-form-element,zend-form2
I have the following multicheckbox: $this->add(array( 'type' => 'DoctrineModule\Form\Element\ObjectMultiCheckbox', 'name' => 'directPractice', 'options' => array( 'label' => 'A. Check all direct practice field education assignments', **EDIT 1:** 'label_attributes' => array( 'class' => 'label-multicheckbox-group' ), 'object_manager' => $this->getObjectManager(), 'target_class' => 'OnlineFieldEvaluation\Entity\FieldEducationAssignments', //'YOUR ENTITY NAMESPACE' 'property' => 'directPractice', //'your db...

Default timeout of CSRF in ZF2

zend-framework2,zend-form,csrf,zend-form-element,csrf-protection
Is it possible to specify a global default timeout for CSRF form elements in Zend 2? Otherwise I have to specify a timeout option for each CSRF element. P.S.: What's the value of the current default timeout?...

Validation for Add screen not working but it working in edit screen with same code

php,validation,zend-framework,zend-form
I am learning Zend framework and currently I have created add, update , delete functionality for country name and continent name and it is working perfectly. I have set validation by $name->setRequired('true'); and $continent->setRequired('true'); in my form.php. Validation is working in edit form but it return error 'An error occurred'...

How to send field name for required true validation in zend

php,zend-framework,zend-form,zend-validate
Here is what my form field, $this->addElement( 'text', 'title', array( 'placeholder' => 'Title', 'class' => 'form-control', 'required' => true, 'filters' => array( 'StringTrim' ), 'autocomplete' => 'off', ) ); I Simply need the error string like: Title is required and can't be empty....

How to add special span to addDisplayGroup fieldset

php,html,zend-framework,zend-form
What should I modify in this piece of code. $this->addDisplayGroup($groupInputs, 'group_'.$i, array('attribs'=>array('class'=>'fieldset_group'))); to add in fieldset new html tag like: <span class="delete_fieldset" onclick="foo()">[X]</span> Or if its possible: <span class="delete_fieldset_$i" onclick="foo($i)">[X]</span> ...

Zend Framework 2 Form Errors Not Showing

zend-framework2,zend-form
I am trying to figure out why Zend Form is not returning errors to my form. When I take a look inside the: Zdendframework/library/form/form.php file I can see the errors are being generated: public function isValid() { if ($this->hasValidated) { return $this->isValid; } ... if (!$result) { $this->setMessages($filter->getMessages()); } return...

Create dynamic input name with Zend Form

php,forms,zend-framework,zend-form
I would like to make my Zend_Form_Element_Text dynamic, i.e it will accept different input name. I have this: $email = new Zend_Form_Element_Text('email'); It create an input with 'email' as the name: <input name="email" id="email" size="20" maxlength="100" placeholder="Email" class="input" type="text"> But sometimes I receive some external POST request and their input...

Zend Form - Add a
around the input element

twitter-bootstrap-3,zend-framework2,zend-form
I'm using Zend Framework 2 Form to render my forms, and Bootstrap 3 to style them. I want to use the Horizontal Form Layout as explained here: Bootstrap 3 Forms tutorial To do so, I need to add a div with appropriate classes around the input element; is there any...

Zend File Create folder while uploading

zend-framework,zend-form
With this form element I'm uploading a file: $element = new Zend_Form_Element_File('foo'); $element->setLabel('Upload Image1:') ->setDestination('/var/www/upload'); $element->addValidator('Count', false, 1); $element->addValidator('Size', false, 102400); $element->addValidator('Extension', false, 'jpg,png,gif'); $form->addElement($element, 'foo'); This requires that the folder is already existing. How can I add an option, that the folder is beeing created, but only if a...

using decorators with file element

php,zend-framework,zend-form
I have trouble using decorators in combination with $logo=$this->createElement('file', 'logo') I have a form in table style, everything worked quite fine until I wanted to add a file element. Here is the related part of my code (form class): $logo=$this->createElement('file', 'logo') ->setLabel('logo:') ->setDestination(APPLICATION_PATH . "/../public/images/logos") ->addValidator('Count', false, 1) ->addValidator('Size', false,...