Link to home
Create AccountLog in
Avatar of earwig75
earwig75

asked on

Need to use URL Encode in CFDiv Tag ColdFusion, receiving error

In the below tag, if the variable in the "bind" has a percent sign/url/special characters in it, it fails. I believe I need to encode/decode the variable thisVarBreaks, can someone assist?

on main page I have:
<cfdiv id="myDiv" bind="url:/site/name/myPage.cfm?myVariable=#thisVarBreaks#"/>

Open in new window


On the myPage.cfm I have:
<cfif someThing neq #URL.thisVarBreaks#>Hello</cfif>

Open in new window

ASKER CERTIFIED SOLUTION
Avatar of _agx_
_agx_
Flag of United States of America image

Link to home
membership
Create an account to see this answer
Signing up is free. No credit card required.
Create Account
Not sure how an extra quote sneaked into the above example, but ... for the archives, the correct code is:

<cfdiv id="myDiv" 
      bind="url:/myPage.cfm?myVariable=#URLEncodedFormat(thisVarBreaks)#"/>

Open in new window