Using hyphens in argument names

I work with CFWheels and jquery mobile, and I am trying to pass some jquerymobile settings to linkto call (mainly the data-icon attribute. I have never started this before, but ColdFusion seems to not hyphenate argument names. My call looks like this way:

<cfset contentFor(actioncontent=linkTo(text='Login', route='login', data-icon='check')) /> 

CFBuilder and Railo throw a hyphen error. Railo Error:

wrong left side assignment (railo.transformer.bytecode.op.OpDouble)

So my questions are: am I saying correctly that hyphens are not allowed in argument names? Also, if they are not allowed, is there a way to get a hyphen through or do I just need to create an anchor tag?

+4
source share
3 answers

try using quotation marks 'data-icon' or doublequotes "data-icon"

This is interpreted as a minus, not a dash

+6
source

You can get this to work on Railo and Adobe CF by first creating the structure and sending it to the collection of arguments. Otherwise, it will only work on Railo.

Example:

 <cfscript> args = {controller="form", 'data-role'="button", 'data-theme'="c", text="I Accept"}; </cfscript> #linkTo(argumentCollection=args)# 
+2
source

My quick hack:

 #replace(linkTo(text="I accept", route="dashboard"),"<a ","<a data-role='button' ","ALL")# 

(emphasis on hacking is not ideal, but much simpler than going to the Collection argument).

0
source

Source: https://habr.com/ru/post/1340674/


All Articles