I can't seem to use a named field in a URL's querystring when it contains a
hyphen. Here's my code:
<body>
item1 = <cfoutput>#url.item1#</cfoutput>
orderID = <cfoutput>#url.orderID#</cfoutput>
card_type = <cfoutput>#url.card-type#</cfoutput>
</body>
I have no problem with item1 or orderID but card-type returns the error
message:
" Element CARD is undefined in URL."
This URL is coming from a third party so I can't change it.
Ian Skinner - 31 May 2007 20:33 GMT
> I can't seem to use a named field in a URL's querystring when it contains a
> hyphen. Here's my code:
[quoted text clipped - 11 lines]
>
> This URL is coming from a third party so I can't change it.
This seems to be the week of the "array notation".
You can not use an invalid variable name string in a dot notation
expression. What ColdFusion is trying to do is evaluate 'url.card'
minus 'type' and can not find an 'url.card'.
To use invalid variable string names one need to use array notation.
url["card-type"] should get you what you want.
koencidence - 31 May 2007 21:01 GMT
Have you tried dumping the URL scope to see if it's in there any other way?
You could also use the cgi.query_string variable to parse it out if for some reason ColdFusion doesn't like it.
Koen