Skip to main content
Mar 23, 2017 1:38 PM UTC
Question

Using dot(.) in custom tag variable

Hi,

I want to implement a custom tag for <cfset. I am able to implement but facing issue that i cannot use dot(.) operator in variable name

For e.g.

<cf_set url.value="123"> is not allowed and it gives following error:

coldfusion.compiler.TokenMgrError: Invalid token . found on line 8 at column 27. 
at coldfusion.compiler.cfml40TokenManager.getNextToken(cfml40TokenManager.java:6658)
at coldfusion.compiler.cfml40.jj_ntk(cfml40.java:13711)
at coldfusion.compiler.cfml40.TagAttribute(cfml40.java:5488)
at coldfusion.compiler.cfml40.attribute_list_aux(cfml40.java:5356)
at coldfusion.compiler.cfml40.attribute_list(cfml40.java:5334)
at coldfusion.compiler.cfml40.cftag(cfml40.java:224)

but "." operator is allowed with <cfset url.value and it works fine.

Please provide thoughts to resolve it for use of "." with custom tag variable name

This topic is closed to new replies. Start a new post to keep the conversation going.

2 replies

WolfShade
Legend
Mar 23, 2017 2:16 PM UTC

Can't say, for sure, without seeing the code for your custom tag "set".

Variables cannot be named using punctuation (except maybe underscore), which your tag thinks "url.value" is the name of the variable, not a variable within the URL scope.

HTH,

^_^

Translate
Inspiring
Mar 23, 2017 3:36 PM UTC

If you are trying to rewrite the url scope with a custom tag, this wont be possible.

What you want to do is pass the scope into the custom tag and return the sanitise version.

<cf_set value="#url.value#" returnvar="someValue" >

<cfdump var="#someValue#">

Something like this - coldfusion custom tag return variable - Stack Overflow

Translate