Note that there are some explanatory texts on larger screens.

plurals
  1. POzend form for multicheckbox remove input from labels
    text
    copied!<p>I am using zend_form (part of Zend Framwork) to create a form and found when I add a set of checkboxes using Zend_Form's multicheckbox element (Zend_Form_Element_MultiCheckbox) the code that is outputted like so:</p> <pre><code>&lt;label for="subjects-maths"&gt; &lt;input type="checkbox" value="maths" id="subjects-maths" name="subjects[]"&gt; Maths &lt;/label&gt; &lt;label for="subjects-english"&gt; &lt;input type="checkbox" value="maths" id="subjects-english" name="subjects[]"&gt; English &lt;/label&gt; </code></pre> <p>I.e. the input is inside the label. Whereas the code is technically ok it is against good practice as far as the W3c see it and is also not the way I want it as it makes styling harder. What I want is the following:</p> <pre><code>&lt;div&gt; &lt;label for="subjects-maths"&gt; Maths &lt;/label&gt; &lt;input type="checkbox" value="maths" id="subjects-maths" name="subjects[]"&gt; &lt;/div&gt; &lt;div&gt; &lt;label for="subjects-english"&gt; English &lt;/label&gt; &lt;input type="checkbox" value="maths" id="subjects-english" name="subjects[]"&gt; &lt;/div&gt; </code></pre> <p>Therefore how do I move the checkbox input out of the label and how do I surround each option in divs. I have looked at many pages on the internet of so called solutions but none work on multicheckboxes as it only targets surrounding labels (i.e the one that would say subjects in this example) not the actual options labels and inputs.</p> <p>Please help.</p> <p>Thanks Paul</p>
 

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