Passing Dynamic Variable In A Hidden Form

Ask a Question related to Macromedia ColdFusion, Design and Development.

  1. #1

    Default Passing Dynamic Variable In A Hidden Form

    Hello:

    I am trying to pass a hidden variable from a form on my web application to the
    PayPal site for payment processing. I can get my code to work on my development
    machine (CF MX 7); however, I am getting the following error message when I try
    to run it on the hosting server (CF MX 6).

    I have tried to use an html form with <input> tags instead of the <cfinput>
    tags; however, I run into a problem when I try to pass a string that has been
    dynamically generated (#custom#) in the code example below. Instead of passing
    my string, it is literally passing the value of #custom# as the variable.

    Here is the code below with non problematic parts removed in the interest of
    space:

    <!--- Generate A Custom Variable To PASS To PayPal --->
    <cfset custom = #CreateUUID()#>

    <!--- Create the hidden form to pass PayPal button information --->
    <cfform action="https://www.sandbox.paypal.com/cgi-bin/webscr" method="post">
    <cfinput type="hidden" name="cmd" value="_xclick">
    <cfinput type="hidden" name="business" value="businessname@mycompany.com">
    <cfinput type="hidden" name="item_name" value="Thing For Sale">
    <cfinput type="hidden" name="item_number" value="1">
    <cfinput type="hidden" name="amount" value="10.00">
    <cfinput type="hidden" name="no_shipping" value="2">
    <cfinput type="hidden" name="no_note" value="1">
    <cfinput type="hidden" name="currency_code" value="CAD">
    <cfinput type="hidden" name="lc" value="CA">
    <cfinput type="hidden" name="custom" value="#custom#">
    <cfinput type="image"
    src="https://www.paypal.com/en_US/i/btn/x-click-butcc.gif" border="0"
    name="submit_single" alt="Click here to process your credit card payment via a
    secure web site.">
    <cfinput type="submit" name="Submit" value="Process My Credit Card Payment">
    </cfform>

    Thank you for any advice that you can offer me with this problem. Moving the
    site to a CF7 server at this time is not an option for me.


    Regards,

    Paul Chisholm
    Cornwall, Ontario, Canada

    Chizzy66 Guest

  2. Similar Questions and Discussions

    1. Problem passing hidden fields using Flash form
      I'm working with Flash forms for the first time, and am having problems passing information in hidden fields. The information was passed from prior...
    2. form variable passing
      I am struggling with this what i want to do is submit the form in a center pop up window. The submit button is a hyperlink not a button. here is...
    3. Passing A Form Variable
      :confused; Hello all, I'm trying tu modify information that is changed by the client. I'm using the master id number in the WHERE clause of the...
    4. Passing form entry to URL variable
      Hi, I'm on to my user administration section, and I want there to be a page where administrator enters a 'buildnumber' into a form, clicks search...
    5. Passing form variable
      Hello, I've got a hidden field that is passed using the GET method to the next page. The field has a string value (assigned by a variable) with...
  3. #2

    Default Re: Passing Dynamic Variable In A Hidden Form

    Hi Paul,

    In CF6, CFINPUT only support the following types:
    RADIO,CHECKBOX,PASSWORD,TEXT. Use HTML INPUT tag. You may leave the CFFORM.

    Laksma


    <!--- Generate A Custom Variable To PASS To PayPal --->
    <cfset custom = #CreateUUID()#>

    <!--- Create the hidden form to pass PayPal button information --->
    <cfform action="https://www.sandbox.paypal.com/cgi-bin/webscr" method="post">
    <input type="hidden" name="cmd" value="_xclick">
    <input type="hidden" name="business" value="businessname@mycompany.com">
    <input type="hidden" name="item_name" value="Thing For Sale">
    <input type="hidden" name="item_number" value="1">
    <input type="hidden" name="amount" value="10.00">
    <input type="hidden" name="no_shipping" value="2">
    <input type="hidden" name="no_note" value="1">
    <input type="hidden" name="currency_code" value="CAD">
    <input type="hidden" name="lc" value="CA">
    <input type="hidden" name="custom" value="#custom#">
    <input type="image" src="https://www.paypal.com/en_US/i/btn/x-click-butcc.gif"
    border="0" name="submit_single" alt="Click here to process your credit card
    payment via a secure web site.">
    <input type="submit" name="Submit" value="Process My Credit Card Payment">
    </cfform>

    Laksma Guest

  4. #3

    Default Re: Passing Dynamic Variable In A Hidden Form

    Hello Laksma:

    Thank you for the fast response. I have tried using the HTML <input> tag as
    follows:

    <input type="hidden" name="custom" value="#custom#">

    <cfinput type="hidden" name="custom" value="<cfoutput>#custom#</cfoutput>">

    However, both of those statements pass the string as #custom# instead of the
    string that I assigned to the variable called custom using the following
    statement:

    <cfset custom = #CreateUUID()#>

    The statement above creates a string in the form of:
    976B81AD-B0D0-6834-297A02473995683F
    That I need to pass to PayPal. Thanks again for any advice or assistance that
    you can provide.


    Paul


    Chizzy66 Guest

  5. #4

    Default Re: Passing Dynamic Variable In A Hidden Form

    Try
    <cfoutput>
    <input type="hidden" name="custom" value="#custom#">
    </cfoutput>

    Ken
    The ScareCrow Guest

  6. #5

    Default Re: Passing Dynamic Variable In A Hidden Form

    I tried the code using CFMX6.1 and it works fine. Also try what Ken suggested. Put CFOUTPUT.

    Laksma
    Laksma Guest

  7. #6

    Default Re: Passing Dynamic Variable In A Hidden Form

    Hello Ken:

    Thank you very much, your suggestion worked perfectly! Have a wonderful day.

    Paul
    Chizzy66 Guest

  8. #7

    Default Re: Passing Dynamic Variable In A Hidden Form

    Thanks to all. I encountered this problem and found this solution through google.
    alvin 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