radioGroup
目的 Purpose
Generates radio button groups使用例 Examples
<g:radioGroup name="myGroup" values="[1,2,3]" value="1" > <p><g:message code="${it.label}" />: ${it.radio}</p> </g:radioGroup>
<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!']" values="[1,2,3]"> <p>${it.label} ${it.radio}</p> </g:radioGroup>
<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>
詳細 Description
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 valueit.radio
- the radio button <input> tag for the current value
Attributes
name
(required) - The name of the groupvalues
(required) - The list of values for the radio buttonsvalue
(optional) - The selected valuelabels
(optional) - Labels for each value contained in thevalues
list. If this is ommitted the label property on the iterator variable (see below) will default to 'Radio ' + value.