ZF-2718: Zend_Form_Element_Hidden should render outside other form elements

Issue Type: Improvement Created: 2008-02-24T07:09:12.000+0000 Last Updated: 2012-08-31T09:14:34.000+0000 Status: Postponed Fix version(s): Reporter: Nick Lo (nicklo) Assignee: Matthew Weier O'Phinney (matthew) Tags: - Zend_Form

Related issues: - ZF-7791



Zend_Form_Element_Hidden elements should render outside of general form elements; either directly after the form opening tag, or before the form closing tag:


form action="make-coffee" ... >



<label ...etc It should also not have decorators like labels or errors.


Posted by Jordan Ryan Moore (jordanryanmoore) on 2008-02-24T11:18:32.000+0000

There would need to be some parent element, such as a


div>, around the hidden . XHTML requires


form> children to be block elements, which is not.

Posted by Nick Lo (nicklo) on 2008-02-24T15:26:13.000+0000

Small further to Jordan's comment: the parent block element should be able to wrap multiple hidden input fields to avoid extraneous markup like:

Posted by Wil Sinclair (wil) on 2008-02-25T13:45:04.000+0000

Unsetting 'fix version' and 'fix version priority' until this issue is reviewed.

Posted by Matthew Weier O'Phinney (matthew) on 2008-03-05T10:12:58.000+0000

Scheduling for 1.5.0 GA release; demoted to minor improvement.

Posted by Matthew Weier O'Phinney (matthew) on 2008-03-07T21:11:11.000+0000

I think this is a good idea, but the logistics to get it working are pretty hairy currently. I've added a test in r8689 to cover the desired functionality, but marked it as incomplete; I'll revisit after the 1.5.0 release.

In the meantime, you can group hidden elements inside a display group or even a sub form pretty easily, and provide decorators that will hide the entire group; I suggest doing this until I can work on the functionality.

Posted by Matthew Weier O'Phinney (matthew) on 2008-03-07T21:11:40.000+0000

Rescheduling for mini release following 1.5.0 GA.

Posted by Wil Sinclair (wil) on 2008-03-21T17:05:31.000+0000

This issue should have been fixed for the 1.5 release.

Posted by Wil Sinclair (wil) on 2008-04-18T13:11:57.000+0000

This doesn't appear to have been fixed in 1.5.0. Please update if this is not correct.

Posted by Matthew Weier O'Phinney (matthew) on 2008-04-22T12:05:02.000+0000

Scheduling for next minor release.

Posted by Bruno Friedmann (brunofriedmann) on 2008-08-15T12:21:36.000+0000

I've tested with 1.6.0 RC2 it's not fixed

define in .ini ; partnerid user.elements.partnerid.type = "hidden" user.elements.partnerid.options.label = "label_user_partnerid" user.elements.partnerid.options.required = true user.elements.partnerid.options.validators.num.validator = "num"


Id partenaire in the middle of the form.

Posted by Matthew Weier O'Phinney (matthew) on 2008-08-15T12:51:04.000+0000

Bruno -- I'm aware it's not fixed; that's why the bug is not marked as resolved. I will try to get to it for the next release following 1.6.0.

Posted by Christopher Manning (manningc) on 2009-02-13T09:00:16.000+0000

Is there a follow up to this issue why this is still in progress?

Posted by Matthew Weier O'Phinney (matthew) on 2009-02-13T10:16:09.000+0000

It's not listed as in progress, but I will mark it as postponed.

If forms could not be hierarchical, this would be trivial to resolve; however, because forms can contain sub forms, to an arbitrary depth, and no elements are aware of their parents, fetching all hidden elements and aggregating them in a single place is difficult.

Posted by Markus (rockaut) on 2009-05-12T07:28:56.000+0000

Why not create an fieldset-hidden by default and add all hidden field to this?

Posted by Hugo (huhu) on 2009-08-28T06:26:19.000+0000

Note that it is not adviceable to simply put all hidden input fields either at the beginning or end of a form. To track file upload progress using APC, it is needed to have a hidden input field containing the APC_UPLOAD_PROGRESS identifier right before the file input field(s). If all hidden fields would be aggregated and placed together at one specific location, tracking of the upload progress can or will fail.

Posted by Christian Albrecht (alab) on 2010-06-02T17:21:12.000+0000

Look ma:

<pre class="highlight">
$sub = new Zend_Form_SubForm(array('elementDecorators' => array('ViewHelper'),
                                   'isArray' => false,
                                   'decorators' => array('FormElements',
                                                         array('HtmlTag', array('tag' => 'dd')))));

$sub->addElement('hidden', 'first', array('value' => '1'));
$sub->addElement('hidden', 'second', array('value' => '2'));
$sub->addElement('hidden', 'third', array('value' => '3'));

$form->addSubForm($sub, 'sub')

// renders

Have you found an issue?

See the Overview section for more details.


© 2006-2016 by Zend, a Rogue Wave Company. Made with by awesome contributors.

This website is built using zend-expressive and it runs on PHP 7.