Return to v2.0 docs

hasManyRadioButton()


View Helpers Form Association Functions string controller


Used as a shortcut to output the proper form elements for an association. 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 string Yes Name of the variable containing the parent object to represent with this form field.
association string Yes Name of the association set in the parent object to represent with this form field.
property string Yes Name of the property in the child object to represent with this form field.
keys string Yes Primary keys associated with this form field. Note that these keys should be listed in the order that they appear in the database table.
tagValue string Yes The value of the radio button when selected.
checkIfBlank boolean No false Whether or not to check this form field as a default if there is a blank value set for the property.
label string No The label text to use in the form control.
encode any No true When set to true, encodes tag content, attribute values, and URLs so that Cross Site Scripting (XSS) attacks can be prevented. Set to attributes to only encode attribute values and not tag content.
<!--- Show radio buttons for associating a default address with the current author --->
<cfloop query="addresses">
#hasManyRadioButton(
label=addresses.title,
objectName="author",
association="authorsDefaultAddresses",
keys="#author.key()#,#addresses.id#"
)#
</cfloop>

Related Functions

Form Association Functions