Ok,
Here's the scoop. This was working before, even when a variable passed in
the URL had spaces, but it chokes when the "&" is included in a variable
name. I did some more testing, however, and I think it's being caused by
Javascript.
For example, I have a company name variable returned from a query which gets
set thusly:
<cfset CompName = GetStoreInfo.CompName>
Assume that #compname# evaluates to "V_&_S_Enterprises". This then gets
stuffed into another variable:
<cfset auditpath =
"companies/#compname#/audits/#attributes.StoreNumber#_compliance_audit_">
After doing some more stuff, auditpath gets concatenated with another
variable:
<cfset curraudit = "#auditpath#" & "#CurrYr#.pdf">
All fine so far. Now, if the file exists, I want a link to it:
<cfif FileExists(Expandpath(curraudit))><a
href="javascript:openAnyWindow('index.cfm?Fuseaction=check4file&filename=#UR
LEncodedFormat(curraudit)#', 'remote1', 640, 480, 'resizable', 'scrollbars',
'status');">Current Year</a><cfelse>No Current Year Report Available</cfif>
This bombs with the #attribute.filename# on the next page being evaluated as
"companies/V_". However, if I remove the javascript and change the link to:
<cfif FileExists(Expandpath(curraudit))><a
href="index.cfm?Fuseaction=check4file&filename=#URLEncodedFormat(URLEncodedF
ormat(curraudit))#">Current Year</a><cfelse>No Current Year Report
Available</cfif>
it works. So, I guess the "&" is causing problems in the Javascript.
I'm not a Javascript junkie, so any help on making this work would be much
appreciated.
Thanks.
P.S. Doubling up the URLEncodedFormat and using URLDecode on the receiving
page didn't work.
Chris Montgomery [EMAIL PROTECTED]
Web Development & Consulting http://www.astutia.com
Allaire Consulting Partner
210-490-3249/888-745-7603 Fax 210-490-4692
AIM: astutiaweb; ICQ: 7381282
> -----Original Message-----
> From: Jeff Peters [mailto:[EMAIL PROTECTED]]
> Sent: Wednesday, March 21, 2001 8:57 PM
> To: Fusebox
> Subject: Re: & in URL Variable
>
>
> The problem isn't Fusebox-specific, it's just that & is a URL special
> character. Here's a way to work around it:
>
> When you send the variable through a URL, run it through
> URLEncodedFormat()
> TWICE:
>
> <cflocation
> url="index.cfm?fuseaction="#FA1#&foo=#URLEncodedFormat(URLEncodedF
> ormat(foo))#">
>
> Then in your process, use URLDecode() to get it back into proper form:
>
> <cfoutput>
> #URLDecode(url.foo)#
> </cfoutput>
>
> It's a bit of a bear, but it works. On the other hand, if you
> avoid using URL
> variables you don't have to worry about it. You could shove the
> value into a
> hidden field on a form that calls your action URL and auto-submit
> the form with
> JavaScript. Nothing gets exposed in the browser address window,
> and you don't
> have to deal the vagaries of URL formats.
>
> - Jeff
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Structure your ColdFusion code with Fusebox. Get the official book at
http://www.fusionauthority.com/bkinfo.cfm
Archives: http://www.mail-archive.com/[email protected]/
Unsubscribe: http://www.houseoffusion.com/index.cfm?sidebar=lists