Return to v1.4.5 docs

radioButton()



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.

Name Type Required Default Description
objectName any Yes See documentation for textField.
property string Yes See documentation for textField.
association string No See documentation for textfield.
position string No See documentation for textfield.
tagValue string Yes The value of the radio button when selected.
label string No useDefaultLabel See documentation for textField.
labelPlacement string No around See documentation for textField.
prepend string No See documentation for textField.
append string No See documentation for textField.
prependToLabel string No See documentation for textField.
appendToLabel string No See documentation for textField.
errorElement string No span See documentation for textField.
errorClass string No fieldWithErrors See documentation for textField.
<!--- 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>