CFSCRIPT Special Characters

Ask a Question related to Coldfusion - Advanced Techniques, Design and Development.

  1. #1

    Default 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

  2. Similar Questions and Discussions

    1. 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...
    2. <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...
    3. 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,...
    4. 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...
    5. 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...
  3. #2

    Default 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

  4. #3

    Default 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

  5. #4

    Default 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

  6. #5

    Default 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

Posting Permissions

  • You may not post new threads
  • You may post replies
  • You may not post attachments
  • You may not edit your posts

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139