Ask a Question related to Coldfusion - Advanced Techniques, Design and Development.
- jpesolutions #1
Problem with this query string conversion script I read the article titled A Cure for Arachnophobia by Ben Forta in the CFDJ
([url]http://coldfusion.sys-con.com/read/41702_p.htm[/url]). In it was this script to
convert url parameters which were sent sperated only by forward slashes into
something than can be used as a URL parameter. However, when I copied the
script and tried to get it to work I have been getting this same error. I am
not stupid enought to even think about questioning the ColdFusion Guru himself
but what am I doing wrong? Did anyone else read this article and get this to
work?
This is the calling page:
<html>
<head>
<title>test</title>
</head>
<body>
<a href="parseURL.cfm?age=30">My age is 30</a>
</body>
</html>
Here is the parseURL.cfm page:
<!--- Extract "query_string" from full path --->
<CFSET query_string_length=Len(CGI.PATH_INFO)-Len(CGI.SCRIPT_NAME)>
<CFSET query_string=Right(CGI.PATH_INFO, query_string_length)>
<!--- How many items in "query_string? --->
<CFSET items=ListLen(query_string, "/")>
<!--- Loop through list, pair of items at a time --->
<CFLOOP FROM="1" TO="#items#" STEP="2" INDEX="i">
<!--- Save this URL parameter --->
<CFPARAM NAME="URL.#ListGetAt(query_string, i, "/")#"
DEFAULT="#ListGetAt(query_string, i+1, "/")#">
</CFLOOP>
<html>
<head>
<title>test</title>
</head>
<body>
The query string value is: <cfoutput>#url.age#</cfoutput>
</body>
</html>
Here is the message that I have been getting:
Parameter 2 of function Right which is now -25 must be a positive integer
Thanks for the help!
Jason
jpesolutions Guest
-
#39126 [NEW]: String->float->String conversion behavior
From: bobson at rpg dot pl Operating system: Linux PHP version: 5CVS-2006-10-11 (snap) PHP Bug Type: Unknown/Other Function... -
Problem with pound signs in a query string
I have a form with an address field in which the user may enter a pound sign for an address number. That form is submitted and the page that... -
Query string and Parameter Passing Problem
Hi In the context of a Master/Detail scenario, I am having trouble figuring out the correct syntax for passing a parameter in a query string in a... -
Maintain query string and somehow auto refresh a pagewith that string intact
I have a drill down where on page one the user selects criteria to narrow down the search for a speicific group of employees(like all hired between... -
Problem with string and base64binary conversion
Hi! I have a string I want to save to database via a webmethod. The webmethod takes a dataset where my string is declared as base64binary. I... - jpesolutions #2
Re: Problem with this query string conversion script ***SORRY***
The actual query string that is being sent is:
<a href="parseURL.cfm/age/30">My age is 30</a>
And the Error message is:
Parameter 2 of function Right which is now -18 must be a positive integer
jpesolutions Guest
- eastinq #3
Re: Problem with this query string conversion script On my system, #CGI.PATH_INFO# equals "/age/30" and not "parseURL.cfm/age/30",
which results in the negative number error we're getting.
I wonder what CF version and OS Ben was using for his example? I'm on CF7 and
Windows XP, IIS.
A simple fix would be to change this line of code:
<CFSET items=ListLen(query_string, "/")>
to this:
<CFSET items=ListLen(CGI.PATH_INFO, "/")>
eastinq Guest
- jpesolutions #4
Re: Problem with this query string conversion script I discovered that the variable are in the wrong order in the first line of the
code.
Change:
<CFSET query_string_length=Len(CGI.PATH_INFO)-Len(CGI.SCRIPT_NAME)>
To:
<CFSET query_string_length=Len(CGI.SCRIPT_NAME)-Len(CGI.PATH_INFO)>
After doing this the script worked great.
jpesolutions Guest




