"Fossies" - the Fresh Open Source Software Archive

Member "grails-core-5.2.4/grails-docs/src/test/resources/docs/ref/Tags/radioGroup.html" (14 Sep 2022, 65688 Bytes) of package /linux/www/grails-core-5.2.4.tar.gz:

Caution: In this restricted "Fossies" environment the current HTML page may not be correctly presentated and may have some non-functional links. You can here alternatively try to browse the pure source code or just view or download the uninterpreted raw source code. If the rendering is insufficient you may try to find and view the page on the grails-core-5.2.4.tar.gz project site itself.

(Quick Reference)



Generates radio button groups


<g:radioGroup name="myGroup" values="[1,2,3]" value="1" >
<p><g:message code="${it.label}" />: ${it.radio}</p>

results in:

<p>Radio 1: <input type="radio" name="myGroup" value="1" checked="checked" /></p>
<p>Radio 2: <input type="radio" name="myGroup" value="2" /></p>
<p>Radio 3: <input type="radio" name="myGroup" value="3" /></p>
<g:radioGroup name="lovesGrails"
              labels="['Yes!','Of course!','Always!']"
<p>${it.label} ${it.radio}</p>

results in:

<p>Yes! <input type="radio" name="lovesGrails" value="1" /></p>
<p>Of course! <input type="radio" name="lovesGrails" value="2" /></p>
<p>Always! <input type="radio" name="lovesGrails" value="3" /></p>


The body of the tag contains the GSP to render for each value. Two variables are provided for use:

  • it.label - the label for the current value

  • it.radio - the radio button <input> tag for the current value


  • name (required) - The name of the group

  • values (required) - The list of values for the radio buttons

  • value (optional) - The selected value

  • labels (optional) - Labels for each value contained in the values list. If this is omitted the label property on the iterator variable (see below) will default to 'Radio ' + value.