The Shed is going Social! Join us on FaceBook and Twitter and chime in on the conversation.
|
 |
|
Dev Shed Forums
> Programming Languages - More
> ColdFusion Development
|
URL encodedFormat
Discuss URL encodedFormat in the ColdFusion Development forum on Dev Shed. URL encodedFormat ColdFusion Development forum discussing CFML coding practices, tips on CFML, and other CFML related topics. Find out why ColdFusion is the tool of choice for many e-commerce developers.
|
|
 |
|
|
|
|

Dev Shed Forums Sponsor:
|
|
|

January 10th, 2012, 05:24 PM
|
|
Contributing User
|
|
Join Date: Jun 2011
Posts: 60
Time spent in forums: 13 h 22 m 2 sec
Reputation Power: 2
|
|
|
URL encodedFormat
Hi Peers,
i'am trying to pass a URL "encodedFormat" string to another page.
I'am having trouble to pass symbols like # otherwise everything else seem to work.
source page
Code:
<cfset var1="abc$d">
<cflocation url="URLDECODE.cfm?var11=#urlEncodedFormat(var1)#">
destination page
Code:
<cfoutput>
The url variable passed is : #URL.var11# </cfoutput>
if i put var1="abc12#", this will gimme an error ...
problem happens only with # symbol
Thoughts
Last edited by korssane : January 10th, 2012 at 05:47 PM.
|

January 10th, 2012, 08:56 PM
|
|
Moderator
|
|
Join Date: Jun 2002
Location: Raleigh, NC
|
|
|
<cfset var1="abc$d">
<cfset encodedVar1 = URLEncodedFormat( var1 ) />
<cflocation url="URLDECODE.cfm var11=#encodedVar1#">
|

January 11th, 2012, 12:07 PM
|
|
Contributing User
|
|
Join Date: Jun 2011
Posts: 60
Time spent in forums: 13 h 22 m 2 sec
Reputation Power: 2
|
|
Quote: | Originally Posted by kiteless <cfset var1="abc$d">
<cfset encodedVar1 = URLEncodedFormat( var1 ) />
<cflocation url="URLDECODE.cfm var11=#encodedVar1#"> |
Hi Kiteless,
this does not work for me. iam trying to pass "abc$d#" ..it seems not accepting the # sign..
error :
Invalid CFML construct found on line 20 at column 18.
ColdFusion was looking at the following text:
URLDECODE.cfm
The CFML compiler was processing:
An expression that began on line 18, column 19.
The expression might be missing an ending #, for example, #expr instead of #expr#.
An expression beginning with \", on line 18, column 13.This message is usually caused by a problem in the expressions structure.
A cfset tag beginning on line 18, column 2.
The error occurred in C:\ColdFusion9\wwwroot\URLENCODE.cfm: line 20
18 : <cfset var1="abc$d#">
19 : <cfset encodedVar1 = URLEncodedFormat( var1 ) />
20 : <cflocation url="URLDECODE.cfm var11=#encodedVar1#">
21 :
22 :
|

January 11th, 2012, 04:38 PM
|
|
Moderator
|
|
Join Date: Jun 2002
Location: Raleigh, NC
|
|
|
Try escaping the pound sign:
<cfset var1="abc$d##">
|

January 12th, 2012, 10:23 AM
|
|
Contributing User
|
|
Join Date: Jun 2011
Posts: 60
Time spent in forums: 13 h 22 m 2 sec
Reputation Power: 2
|
|
Quote: | Originally Posted by kiteless Try escaping the pound sign:
<cfset var1="abc$d##"> |
Hi Kiteless, i got that but how if i have a text field value that contains # pound sign and want to pass in URL ?
thanks
|

January 12th, 2012, 06:53 PM
|
|
Moderator
|
|
Join Date: Jun 2002
Location: Raleigh, NC
|
|
|
It should work fine, I'm pretty sure you only have to escape pound signs you declare in CF code.
|

January 13th, 2012, 07:21 AM
|
|
Contributing User
|
|
Join Date: Jun 2011
Posts: 60
Time spent in forums: 13 h 22 m 2 sec
Reputation Power: 2
|
|
Quote: | Originally Posted by kiteless It should work fine, I'm pretty sure you only have to escape pound signs you declare in CF code. |
hi kiteless,
it is not clear. i'am assuming that the user might enter a pound sign in a text field and then i try to pass it ..
thanks
|

January 13th, 2012, 08:22 AM
|
|
Moderator
|
|
Join Date: Jun 2002
Location: Raleigh, NC
|
|
|
If you declare a pound sign in CFML code, you must escape it because the pound sign has special meaning in CFML code. If the value is passed in from outside the code, you don't have to escape it.
Just build a simple form, open it in your browser, and test it.
|
Developer Shed Advertisers and Affiliates
| Thread Tools |
Search this Thread |
|
|
|
| Display Modes |
Rate This Thread |
Linear Mode
|
|
Posting Rules
|
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts
HTML code is Off
|
|
|
|
|