A Flash Developer Resource Site

Results 1 to 7 of 7

Thread: [CS3] Problem sending hidden form fields -- help!

  1. #1
    Member
    Join Date
    Dec 2007
    Posts
    37

    Question [CS3] Problem sending hidden form fields -- help!

    Hey all!

    I'm having trouble sending a hidden form field for an authorize.net buy button, and wondered if anyone has run into this. All code is real except the LinkId value.

    Here's what authorize.net sent me:

    Code:
    <form name="PrePage" method = "post" action = "https://Simplecheckout.authorize.net/payment/CatalogPayment.aspx"> 
    <input type = "hidden" name = "LinkId" value ="00000000-0000-0000-0000-000000000000" /> 
    <input type = "image" src ="//content.authorize.net/images/buy-now-gold.gif" /> 
    </form>
    In HTML, this form works fine. And it sends me to this URL:

    https://simplecheckout.authorize.net/payment/CatalogPayment.aspx

    With the proper information.

    In Flash, however, I can't seem to get the hidden value to send in a way that authorize.net can understand. I create the following button:

    Code:
    on (release) {
    	LinkId = "00000000-0000-0000-0000-000000000000";
    	getURL ("https://Simplecheckout.authorize.net/payment/CatalogPayment.aspx", "", "POST");
    }
    And it sends me to this URL:

    https://simplecheckout.authorize.net/payment/CatalogPayment.aspx
    ?LinkId=00000000%2D0000%2D0000%2D0000%2D0000000000 00

    But this can't be processed. I'm not sure if it's because it's not really sending it "hidden" (since it's viewable in the browser bar), or because the hyphens are becoming %2Ds, or what.

    I've read every flashkit forum post I could find on hidden form fields, and nothing I've tried seems to work. I even tried a few times using loadvars, but it still produced the %2D-filled nonworking URL.

    Help is greatly appreciated!

  2. #2
    Flactionscrish Baby Minion's Avatar
    Join Date
    Nov 2005
    Location
    Planet Earth
    Posts
    312
    I only have one suggestion, and unfortunatley its a bunch of work if you have never dealt with the externalInterface before, or done any javascript...

    but you can keep that form in the html, but keep it completely hidden. When you click on the button to send the form, you call javascript (via ExternalInterface) and dynamically fill out and submit the form. IF you do it that way you probably won't get have any problems.

    If you need some more guidance just ask.
    ktu[k-two]
    he who hesitates is lost; so i guess i'll wander intently

    Are you sure this is real?
    Life is Love, Love is Blind, Blind we go through Life.
    Life isn't hard, dealing with your self is.

    The concept of life in a human brain is weakening day after day. Live every day like its your last. Take the chances, and opportunities, and never let authority push you around for fun.


  3. #3
    Member
    Join Date
    Dec 2007
    Posts
    37
    Hmm. I'm intrigued.

    So you're suggesting that, in the html that calls the flash file, I could put the html version of the buy now button, but make the button invisible, and then just have the flash file trigger the hidden html button to fire? Is that it?

  4. #4
    Flactionscrish Baby Minion's Avatar
    Join Date
    Nov 2005
    Location
    Planet Earth
    Posts
    312
    Exactly!
    If you are concerned about the LinkID being private, you don't have to put it in the html, but when you click on the flash, to submit, send the linkID to the JS, and have the JS fill out the linkID, and then submit it.


    I had a hell of a time trying to figure that out (plus a few smaller things) for a SalesForce.com form.

    Good luck
    ktu[k-two]
    he who hesitates is lost; so i guess i'll wander intently

    Are you sure this is real?
    Life is Love, Love is Blind, Blind we go through Life.
    Life isn't hard, dealing with your self is.

    The concept of life in a human brain is weakening day after day. Live every day like its your last. Take the chances, and opportunities, and never let authority push you around for fun.


  5. #5
    Member
    Join Date
    Dec 2007
    Posts
    37
    ...and, if that's what you're suggesting, how on earth would one do that?

  6. #6
    Member
    Join Date
    Dec 2007
    Posts
    37
    Actually, the LinkId doesn't have to be private -- the number by itself would just allow you to BUY products, which is fine by us. I just noticed that when sending via the HTML form, you don't see the LinkId in the URL, but sending via Flash, you do (and, it doesn't work.)

    Anyhoo, lets say I have three hidden forms on the HTML side, with three different invisible buy now buttons. I'll call them FORM1, FORM2, and FORM3. I create three buttons in Flash. So somehow, my Flash button has to know to submit a specific form.

    Hmm.

  7. #7
    Member
    Join Date
    Dec 2007
    Posts
    37
    AH HA!

    It worked. And it wasn't even that tricky. Thank you SO much.

    Here's what I did.

    1) I made three HTML forms, but invisible (I just didn't include the "input" tag -- just the form tag) I named them form1, form2, and form3 for the three different products.

    2) I made three Flash buttons (button1, button2, and button3)

    3) For button1, I added this code:

    Code:
    on (release) {
    	getURL("javascript:document.getElementById('form1').submit()")
    }
    For button2, form2, for button3, form3.

    And that's it! Works great.

    Thanks for your help!

Posting Permissions

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




Click Here to Expand Forum to Full Width

HTML5 Development Center