Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    text
    copied!<p>You're correct that ZF 1.8 doesn't support grouping of options in this way. You could easily look at the code inside <code>Zend_View_Helper_FormRadio</code> and create your own view helper that supports a multi-dimensional array (ie the select groupings). I had to do this already for a project, check out the example at <a href="http://pastebin.com/f1dd448e3" rel="noreferrer">pastebin.com</a></p> <p>PHP:</p> <pre><code>$form-&gt;addElement('radio', 'test', array( 'helper'=&gt;'formMultiRadio', 'label'=&gt;'Test Thing', 'multiOptions'=&gt;array( 'Test'=&gt;array('1'=&gt;'1', '2'=&gt;'2'), 'Test 2'=&gt;array('3'=&gt;'3', '4'=&gt;'4'), 'Test 3'=&gt;array('5'=&gt;'5', '6'=&gt;'6'), ), )); </code></pre> <p>Resulting HTML:</p> <pre><code>&lt;dt id="test-label"&gt;&lt;label for="test" class="optional"&gt;Test Thing&lt;/label&gt;&lt;/dt&gt; &lt;dd id="test-element"&gt; Test&lt;br /&gt; &lt;label for="test-1"&gt;&lt;input type="radio" name="test" id="test-1" value="1" /&gt;1&lt;/label&gt;&lt;br /&gt; &lt;label for="test-2"&gt;&lt;input type="radio" name="test" id="test-2" value="2" /&gt;2&lt;/label&gt;&lt;br /&gt; Test 2&lt;br /&gt; &lt;label for="test-3"&gt;&lt;input type="radio" name="test" id="test-3" value="3" /&gt;3&lt;/label&gt;&lt;br /&gt; &lt;label for="test-4"&gt;&lt;input type="radio" name="test" id="test-4" value="4" /&gt;4&lt;/label&gt;&lt;br /&gt; Test 3&lt;br /&gt; &lt;label for="test-5"&gt;&lt;input type="radio" name="test" id="test-5" value="5" /&gt;5&lt;/label&gt;&lt;br /&gt; &lt;label for="test-6"&gt;&lt;input type="radio" name="test" id="test-6" value="6" /&gt;6&lt;/label&gt; &lt;/dd&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