如何在cfwheels中使用hasManyRadioButton()



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参数,以表明它可能打算成为连接authoraddress的连接表。我还添加了propertytagValue参数。

在本例中,单选按钮在子对象(在本例中为authorAddress模型)上设置了一些值。

相关内容

  • 没有找到相关文章

最新更新