Note that there are some explanatory texts on larger screens.

plurals
  1. POHow would I format Zend_Form_Element_Radio so the label follows the input?
    primarykey
    data
    text
    <p>The default decorator for the Zend_Form_Element_Radio is </p> <pre><code>&lt;label for="type_id-1"&gt;&lt;input type="radio" name="type_id" id="type_id-1" value="1"&gt;Pack&lt;/label&gt; </code></pre> <p>The <code>label</code> tag wraps the <code>input</code> tag. Instead I would like to to look like</p> <pre><code>&lt;input type="radio" name="type_id" id="type_id-1" value="1"&gt;&lt;label for="type_id-1"&gt;Pack&lt;/label&gt; </code></pre> <p>I thought it might have to do with the "Label" of the element, but that is different. Even with the following code, I still get the label wrapping the radio. When I use this form code.</p> <pre><code>public function init() { parent::init(); $this-&gt;setName('createdomain'); $type_id = new Zend_Form_Element_Radio('type_id'); $type_id-&gt;setLabel('Please Choose') -&gt;setRequired() -&gt;setMultiOptions(array('m' =&gt; "male", 'f' =&gt; 'female')); $this-&gt;addElement($type_id); $this-&gt;setElementDecorators(array( 'ViewHelper', array('Label',array('placement' =&gt; 'APPEND')), )); } </code></pre> <p>I get this HTML as a result</p> <pre><code>&lt;form id="createdomain" enctype="application/x-www-form-urlencoded" action="" method="post"&gt;&lt;dl class="zend_form"&gt; &lt;label for="type_id-m"&gt;&lt;input type="radio" name="type_id" id="type_id-m" value="m"&gt;male&lt;/label&gt;&lt;br /&gt; &lt;label for="type_id-f"&gt;&lt;input type="radio" name="type_id" id="type_id-f" value="f"&gt;female&lt;/label&gt; &lt;label for="type_id" class="required"&gt;Please Choose&lt;/label&gt;&lt;/dl&gt; &lt;/form&gt; </code></pre> <p>Notice how there is a <code>label</code> tag wrapping the <code>input</code> tag?</p>
    singulars
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload