cfwheels

Adding Custom HTML Attribute To CF Wheels Forms


I'm trying to add a VueJS HTML Attribute

v-show = "someName"

inside a generated textField form input in CFWheels. By default, CfWheels doesn't allow hyphens.

For HTML5 attribute that starts with "data", this is possible

#linkTo(text="Home", route="root", dataDomCache=true)#
-> <a href="/" data-dom-cache>Home</a>

However, I would like to get the same functionality using v-show instead of data-com-cache.

Anyone knows a workaround for this?


Solution

  • You would likely need to use the argumentCollection:

    <cfset vueArgs = { "v-model"="foo" }>
    #linkTo(text="Home", route="root", dataDomCache=true, argumentCollection=vueArgs)#
    

    You could try something like this also, but I'm not sure if it'll work:

    #linkTo(text="Home", route="root", dataDomCache=true, "v-model"="foo")#