ZF-2718: Zend_Form_Element_Hidden should render outside other form elements

Description

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" ... >

<

ul>

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

Comments

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.

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

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

Scheduling for 1.5.0 GA release; demoted to minor improvement.

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.

Rescheduling for mini release following 1.5.0 GA.

This issue should have been fixed for the 1.5 release.

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

Scheduling for next minor release.

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"

result

Id partenaire

in the middle of the form.

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.

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

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.

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

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.

Look ma:


$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