ZF2-498: Allow FormLabel position to be defined in a configuration array

Issue Type: Improvement Created: 2012-08-23T20:16:50.000+0000 Last Updated: 2012-10-08T20:14:48.000+0000 Status: Closed Fix version(s): Reporter: George Cooksey (bokgc) Assignee: Matthew Weier O'Phinney (matthew) Tags: - Zend\Form

  • FormElement
  • FormLabel
  • form
  • formCheckbox
  • formCollection
  • formRow

Related issues: Attachments:


Currently, there is no way to define the position of FormLabels when elements are rendered in a collection or row. This is particularly relevant to checkbox, multiCheckbox and radio fields. By default, checkbox, multiCheckbox, and radio elements should append their label. Regardless, a 'label_position' configuration option should be available and recognized by the FormCollection and FormRow helpers.

<pre class="highlight">
// inside Controller ...
   "name" => "remember",
   "type" => "Zend\Form\Element\Checkbox",
   "options" => array(
      "label" => "Remember Me",
      "label_position" => "append",


Posted by Michael Gallego (bakura) on 2012-09-05T21:51:13.000+0000

This is a good idea. I'll make a fix tomorrow for that.

EDIT : the only problem I can see is that this thing is relative to FormRow helper, so this means we are going to introduce something into the base Element that is used only by the FormRow helper. I'll talk to Matthew and cgmartin about that :).

Posted by Chris Martin (cgmartin) on 2012-09-05T22:03:17.000+0000

We already have the label attributes attached to the base Element, so makes sense to me to be able to set label options on it as well.

Would it also be helpful to attach the FormElementError attributes (and options?) to the base Element? We run into the same kinds of limitations with rendering the errors as we do with the labels, in the context of FormRow.

Posted by George Cooksey (bokgc) on 2012-09-06T03:40:34.000+0000

My main goals for this in every context are: 1. Default (appended) rendering with no configuration for radio/checkbox elements 2. Custom rendering via configuration

I also agree with Chris' suggestion regarding errors.

The bottom line is that these elements should not be handled like other inputs when rendered.

Posted by Ralph Schindler (ralph) on 2012-10-08T20:14:48.000+0000

This issue has been closed on Jira and moved to GitHub for issue tracking. To continue following the resolution of this issues, please visit:

Have you found an issue?

See the Overview section for more details.


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

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