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

ColdFusion Language

Avatar of undefined
Last Comment
_agx_

8/22/2022 - Mon
ASKER CERTIFIED SOLUTION
_agx_

THIS SOLUTION ONLY AVAILABLE TO MEMBERS.
View this solution by signing up for a free trial.
Members can start a 7-Day free trial and enjoy unlimited access to the platform.
See Pricing Options
Start Free Trial
GET A PERSONALIZED SOLUTION
Ask your own question & get feedback from real experts
Find out why thousands trust the EE community with their toughest problems.
_agx_

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

All of life is about relationships, and EE has made a viirtual community a real community. It lifts everyone's boat
William Peck