在参数名称中使用连字符
我正在使用 CFWheels 和 jquery mobile,并尝试将一些 jquerymobile 设置传递到链接调用中(主要是 data-icon 属性。我以前从未新过这个,但似乎 ColdFusion 不允许在参数名称中使用连字符。我的调用如下:
<cfset contentFor(actioncontent=linkTo(text='Login', route='login', data-icon='check')) />
CFBuilder 和 Railo 在连字符上抛出错误 Railo 错误是:
左侧赋值无效 (railo.transformer.bytecode.op.OpDouble)
所以我的问题是:我说参数名称中不允许使用连字符是否正确?另外,如果不允许它们,有没有办法让连字符通过,或者我只需要创建锚标记?
I am working with CFWheels and jquery mobile and am trying to pass some jquerymobile settings into a linkto call (mainly the data-icon attribute. I never new this before, but it appears to be that ColdFusion doesn't allow hyphens in argument names. My call is as follows:
<cfset contentFor(actioncontent=linkTo(text='Login', route='login', data-icon='check')) />
CFBuilder and Railo throw an error on the hyphen. The Railo error is:
invalid assignment left-hand side (railo.transformer.bytecode.op.OpDouble)
So my questions is: am I correct in saying that hyphens are not allowed in argument names? Also if they are not allowed, is there a way to get the hyphen through or do I just have to create the anchor tag?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(3)
我的快速破解是这样的:(
强调工作破解 - 不理想,但比传递 argumentCollection 容易得多)。
My quick hack is this:
(emphasis on the work hack - not ideal, but much easier than passing in the argumentCollection).
尝试使用引号
'data-icon'
或双引号"data-icon"
它被解释为减号而不是破折号
try using quotes
'data-icon'
or doublequotes"data-icon"
It's being interpreted as a minus not a dash
您可以通过首先创建一个结构并将其发送到参数集合中来使其在 Railo 和 Adobe CF 上工作。否则,它只能在 Railo 上运行。
例子:
You can get this to work on Railo and Adobe's CF by creating a struct first and sending it in the argument collection. Otherwise, it will only work on Railo.
Example: