Note that there are some explanatory texts on larger screens.

plurals
  1. PODisplaying checkboxes in li tag - CakePHP
    text
    copied!<p>How can generate from From->imput, for multiple checkboxes this kind of "code":</p> <pre><code>&lt;ul class="inputs-list"&gt; &lt;li&gt; &lt;label&gt; &lt;input type="checkbox" value="option1" name="optionsCheckboxes"&gt; &lt;span&gt;Option one is this and that&amp;mdash;be sure to include why it’s great&lt;/span&gt; &lt;/label&gt; &lt;/li&gt; &lt;li&gt; &lt;label&gt; &lt;input type="checkbox" value="option2" name="optionsCheckboxes"&gt; &lt;span&gt;Option two can also be checked and included in form results&lt;/span&gt; &lt;/label&gt; &lt;/li&gt; &lt;/ul&gt; </code></pre> <p>Now I have this code:</p> <pre><code>echo $this-&gt;Form-&gt;input('User', array( 'label' =&gt; FALSE, 'type' =&gt; 'select', 'multiple' =&gt; 'checkbox', 'options' =&gt; $users, 'selected' =&gt; $html-&gt;value('User.User'), 'between' =&gt; '&lt;ul class="inline"&gt;&lt;li&gt;', 'after' =&gt; '&lt;/li&gt;&lt;/ul&gt;', 'separator' =&gt; '&lt;/li&gt;&lt;li&gt;' )); </code></pre> <p>But instead of li tag I get all wrapped in div tag:</p> <pre><code>&lt;ul class="inline"&gt; &lt;li&gt; &lt;input id="UserUser" type="hidden" value="" name="data[User][User]"&gt; &lt;div class="xlarge"&gt; &lt;input id="UserUser4" type="checkbox" value="4" checked="checked" name="data[User][User][]"&gt; &lt;label class="selected" for="UserUser4"&gt;Andraž&lt;/label&gt; &lt;/div&gt; &lt;div class="xlarge"&gt; &lt;input id="UserUser5" type="checkbox" value="5" checked="checked" name="data[User][User][]"&gt; &lt;label class="selected" for="UserUser5"&gt;Pinko&lt;/label&gt; &lt;/div&gt; &lt;/li&gt; &lt;/ul&gt; </code></pre>
 

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