Ask a Question related to Coldfusion - Advanced Techniques, Design and Development.
-
Wile E #1
CFSCRIPT Special Characters
An external application posts a $ (%24) at the beginning of each querysting. I
am able to reference the querystring through normal cf tags, but not within
cfscript. Is there an escape character needed?
<cfparam name="$selected_rows.node" default="">
<cfparam name="$selected_rows.NodeAlias" default="">
<cfparam name="$selected_rows.IFDescr" default="">
<cfparam name="$selected_rows.DSN" default="">
<cfparam name="$selected_rows.FirstOccurrence" default="">
<cfoutput>#$selected_rows.node#</cfoutput>
<cfscript>
if (variables.Description eq "")
{
if ($selected_rows.node neq "")
variables.Description = variables.Description & chr(10) & "Node: " &
$selected_rows.node;
if ($selected_rows.NodeAlias neq "")
variables.Description = variables.Description & chr(10) & "IP: " &
$selected_rows.NodeAlias;
if ($selected_rows.IFDescr neq "")
variables.Description = variables.Description & chr(10) & "Interface: " &
$selected_rows.IFDescr;
if ($selected_rows.DSN neq "")
variables.Description = variables.Description & chr(10) & "Message: " &
$selected_rows.DSN;
}
</cfscript>
Wile E Guest
-
xml and special characters
Hi I'm using a xml file to upload info to a flash app. For the xml I used utf-8 encoding but I'm having a problem the "&" symbol isn't displaying... -
<cfscript> autocaps problem </cfscript> - betcha can't fix this!
First, I'll tell you up front that I am clueless when it comes to cfscript. So I apologize if this question is off topic. I have a nice little... -
More special characters in FH
Hello, Just one question: what do you do to insert ligatures and some "advanced" characters (glyphs) into the text created in FH? Thanks,... -
Special Characters - Mac vs. PC - Help
Hi, im developing an hybrid application in director. The application is running very well in PC and MAC, but there is a problem annoying me. I... -
Special characters #,$ etc
Does anyone know if these characters are supposed to be allowed under SQL92 naming conventions for table and colnames? Just wondering since it... -
MikerRoo #2
Re: CFSCRIPT Special Characters
Actually, $ works just fine in cfscript. Are you using CF7?
The code you posted works except that a variable "variables.Description" is
referenced that doesn't exist.
Add <cfparam name="variables.Description" default=""> to your code.
If there is still a problem, please post the exact error massage.
Regards,
-- MikeR
MikerRoo Guest
-
Wile E #3
Re: CFSCRIPT Special Characters
I did have a cfparam for description (just didn't have it in my snippit). The
error is "Element NODE is undefined in $SELECTED_ROWS. " The error only occurs
when I actually try to pass something throught hte URL like this ---
test.cfm?$selected_rows.node="abc12345" As I test, I created another page with
the following code. It appears that CFPARAM is killing the variable?
<cfoutput>Before:#$selected_rows.node#</cfoutput>
<cfparam name="Description" default="">
<cfparam name="ActProbDate" default="">
<cfparam name="ActProbTime" default="">
<cfparam name="serial" default="">
<cfparam name="$selected_rows.node" default="">
<cfparam name="$selected_rows.NodeAlias" default="">
<cfparam name="$selected_rows.IFDescr" default="">
<cfparam name="$selected_rows.DSN" default="">
<cfparam name="$selected_rows.FirstOccurrence" default="">
<cfoutput>After:#$selected_rows.node#</cfoutput>
Wile E Guest
-
MikerRoo #4
Re: CFSCRIPT Special Characters
The error is that you cannot pass complex variables through the URL like that.
(It's not part of the W3C spec).
When the URL contains test.cfm?$selected_rows.node="abc12345", it doesn't
create a structure named URL.$selected_rows.
It creates a simple variable named URL.$selected_rows.node with the 2nd period
treated as a text part of the name.
If you want to be able to pass struct values through the URL, you will have to
convert each one. Add code like this above your CFParams:
<CFSCRIPT>
if (IsDefined ("URL.$selected_rows.node"))
{
$selected_rows.node = URL.$selected_rows.node;
}
</CFSCRIPT>
Regards,
-- MikeR
MikerRoo Guest
-
Wile E #5
Re: CFSCRIPT Special Characters
That works to use isdefined instead of CFPARAM. Thanks!!!! Like I said before, the other app is passing the URL that looks like that. I thought it was kind of strange.
Wile E Guest



Reply With Quote

