Removing a decorator from Zend Form

Zend will ship its elements with tags of dd dt
But if you want to get only the element with out decorator being around it.
you can do:

        $this->addElement('text', 'you_element', array(
                ....
                'decorators' => array('viewHelper'),
                ....
        ));

But if you want to display errors along with the HTML format,
add errors in the decorators array

This should give you only the element that you can implement your own decorator around it

handling array inputs in zend. Passing inputs that are generated from javascript to zend controller

Hello There,
Was working on a project that is on zend framework. The task involves having having javascript generated input boxes and passing those to the controller.
I have done that before using some other mechanism but they were not somehow natural ways to do it.
It can be done in a much easier way -NATURALLY- though :)
lets assume your form has javascript powered email address adding inputboxes. There would be some link you would hit as add emails and it will create input boxes for you..

1. have the input box in your zend form as

		$this->addElement('text', 'emails', array(
			'label'        => 'Emails',
			'isArray'      => TRUE,
			'name'         => 'emails[]'
		));

Or however you are creating the inputbox – or anyother input
2. Then in the javascript where you are creating the input, use the same name as the element’s name

	    var new_email = document.createElement('input');
	    new_email.name = 'emails[]';
	    new_email.type = 'text';
	    new_email.setAttribute('size', 30);

3. yes, you are done!. When the form is submitted, the element with name emails[] would be passed along with the other form elements.
In your controller you would have an array of emails[] and the rest is …

Happy zenjsing

was not found in the haystack error for select element in zend

You might get this error while working on zend form which has select element on it.

And most probably you are messing with this element on your controller or from your front end friend javascript [ that was in my case ]

Just put the following in the controller and you should be fine


$form->getElement('selectElementNameHere')->setRegisterInArrayValidator(FALSE);

This is a behavior of zend adding a default validator of inarray.
You would find more detailed explanation on zend website.

Learn node js angular and mongodb with simple step by step tutorials here