Domanda

The cfwheels documentation says that for using hasManyRadioButton() the property field is required. But in their example they haven't used property.

Following is the example provided by cfwheels documentation.

<!--- 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>

Is the property attribute required or not? What is the right convention to use this function?

È stato utile?

Soluzione

I believe that the property argument would be required. The example appears to be incomplete.

The docs should probably look something like this:

<!--- Show radio buttons for associating a default address with the current author --->
<cfloop query="addresses">
    #hasManyRadioButton(
        label=addresses.title,
        objectName="author",
        association="authorAddresses",
        keys="#author.key()#,#addresses.id#",
        property="isDefault",
        tagValue=true
    )#
</cfloop>

Note that I changed the association argument to show that it probably intended to be a join table linking author with address. I also added property and tagValue arguments as well.

In this case, the radio button is setting some value on the child object (in this example, the authorAddress model).

Autorizzato sotto: CC-BY-SA insieme a attribuzione
Non affiliato a StackOverflow
scroll top