Miscellaneous
radioButton()
Signature
Section titled “Signature”radioButton() — returns any
Description
Section titled “Description”Builds and returns a string containing a radio button form control based on the supplied objectName and property. Note: Pass any additional arguments like class, rel, and id, and the generated tag will also include those values as HTML attributes.
Parameters
Section titled “Parameters”| Name | Type | Required | Default | Description |
|---|---|---|---|---|
objectName | any | yes | — | See documentation for textField. |
property | string | yes | — | See documentation for textField. |
association | string | yes | — | See documentation for textfield. |
position | string | yes | — | See documentation for textfield. |
tagValue | string | yes | — | The value of the radio button when selected. |
label | string | yes | useDefaultLabel | See documentation for textField. |
labelPlacement | string | yes | around | See documentation for textField. |
prepend | string | yes | — | See documentation for textField. |
append | string | yes | — | See documentation for textField. |
prependToLabel | string | yes | — | See documentation for textField. |
appendToLabel | string | yes | — | See documentation for textField. |
errorElement | string | yes | span | See documentation for textField. |
errorClass | string | yes | fieldWithErrors | See documentation for textField. |
Examples
Section titled “Examples”<!--- Basic example view code --->
<cfoutput>
<fieldset>
<legend>Gender</legend>
#radioButton(objectName="user", property="gender", tagValue="m", label="Male")#<br />
#radioButton(objectName="user", property="gender", tagValue="f", label="Female")#
</fieldset>
</cfoutput>
<!--- Shows radio buttons for selecting the genders for all committee members provided by the `members` association and nested properties --->
<cfoutput>
<cfloop from="1" to="#ArrayLen(committee.members)#" index="i">
<div>
<h3>#committee.members[i].fullName#:</h3>
<div>
#radioButton(objectName="committee", association="members", position=i, property="gender", tagValue="m", label="Male")#<br />
#radioButton(objectName="committee", association="members", position=i, property="gender", tagValue="f", label="Female")#
</div>
</div>
</cfloop>
</cfoutput>