Skip to content

Miscellaneous

hasManyRadioButton()

hasManyRadioButton() — returns any

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.

NameTypeRequiredDefaultDescription
objectNamestringyes—Name of the variable containing the parent object to represent with this form field.
associationstringyes—Name of the association set in the parent object to represent with this form field.
propertystringyes—Name of the property in the child object to represent with this form field.
keysstringyes—Primary keys associated with this form field. Note that these keys should be listed in the order that they appear in the database table.
tagValuestringyes—The value of the radio button when selected.
checkIfBlankbooleanyesfalseWhether or not to check this form field as a default if there is a blank value set for the property.
labelstringyes—The label text to use in the form control.
hasManyRadioButton(objectName, association, property, keys, tagValue [, checkIfBlank, label ]) <!--- 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>