This content has been marked as final.
Show 2 replies
-
1. Re: Hyphens and Cookies
craigkaminsky Jun 18, 2009 4:03 PM (in response to kodemonki)You should be able to use StructKeyExists (the Cookie scope being a structure and all!) to get around this:
<cfif StructKeyExists( cookie, "abcd-name" )> ... etc ... </cfif>
ColdFusion will treat the hyphen as it is in IsDefined() as an arithmetic operator and try to subtract name from abcd whereas the above will evaluate properly.
If you need to reference the cookie value, use the following notation:
<cfset my_cookie = cookie["abcd-name"] />
You'll run into the same issue you had with IsDefined() if you try cookie.abcd-name.
Hope that helps!
-
2. Re: Hyphens and Cookies
kodemonki Jun 19, 2009 5:35 AM (in response to craigkaminsky)Excellent! Thank you so much!

