cfwheels文档说明使用hasManyRadioButton()时需要属性字段。但是在他们的例子中,他们没有使用property。
下面是cfwheels文档提供的示例。
<!--- 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>
是否需要property属性?使用这个函数的正确约定是什么?
我认为property
参数是必需的。这个例子似乎不完整。
文档应该看起来像这样:
<!--- 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>
注意,我改变了association
参数,以表明它可能打算成为连接author
和address
的连接表。我还添加了property
和tagValue
参数。
在本例中,单选按钮在子对象(在本例中为authorAddress
模型)上设置了一些值。