Hello and welcome to our community! Is this your first visit?
Register
Enjoy an ad free experience by logging in. Not a member yet? Register.
Results 1 to 3 of 3
  1. #1
    New to the CF scene
    Join Date
    Sep 2011
    Posts
    3
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Redirect on select with javascript for paypal form

    Hi all, I'm new here and need some help. I don't know Javascript at all.

    I have a paypal form that looks like this:

    Code:
    <FORM action="https://www.paypal.com/cgi-bin/webscr" method="post">
    <INPUT type="hidden" name="cmd" value="_s-xclick">
    <INPUT type="hidden" name="hosted_button_id" value="VMMCF6CUGBPAN">
    <INPUT type="hidden" name="on0" value="DATA">DATA<BR>
    <SELECT name="os0">
    <OPTION value="250" selected="selected">DATA</OPTION>
    <OPTION value="400">DATA</OPTION>
    <OPTION value="1000">DATA</OPTION>
    </SELECT>
    
    <INPUT type="hidden" name="currency_code" value="USD">
    <BR>
    <INPUT type="image" src="https://www.paypalobjects.com/en_US/i/btn/btn_buynowCC_LG.gif" border="0" name="submit" alt="PayPal - The safer, easier way to pay online!"><IMG alt="" border="0" src="https://www.paypalobjects.com/en_US/i/scr/pixel.gif" width="1" height="1">
    </FORM>
    This form works perfectly with my system now. I'm trying to add one fourth option that will redirect to another page, but I'm not sure if changing the name of the select will break the paypal transaction. So I tried this solution:

    Code:
    <FORM action="https://www.paypal.com/cgi-bin/webscr" method="post">
    <INPUT type="hidden" name="cmd" value="_s-xclick">
    <INPUT type="hidden" name="hosted_button_id" value="VMMCF6CUGBPAN">
    <INPUT type="hidden" name="URL" value="DATA">DATA<BR>
    <SELECT name="URL" onchange="window.location.href= this.form.URL.options[this.form.URL.selectedIndex].value">
    <OPTION value="250" selected="selected">DATA</OPTION>
    <OPTION value="500">500 Words</OPTION>
    <OPTION value="1000">1000 Words</OPTION>
    <OPTION value="project.html">1000+ Words</OPTION>
    </SELECT>
    <INPUT type="hidden" name="currency_code" value="USD">
    <BR>
    <br>
    <INPUT type="image" src="https://www.paypalobjects.com/en_US/i/btn/btn_buynowCC_LG.gif" border="0" name="submit" alt="PayPal - The safer, easier way to pay online!"><IMG alt="" border="0" src="https://www.paypalobjects.com/en_US/i/scr/pixel.gif" width="1" height="1">
    </FORM>
    It works great if I select the fourth option with a internal url in it. But if I choose one of the other options it tries to dynamically change to a page "250", "500", or "1000" and they don't exist.

    Also, I'm not sure if changing the select name or the option value will break the transaction with paypal.

    What I'd like the form to do is nothing on all options except the fourth; which is a redirect. The first, second, and third option require the used to click a paypal buy now button.

    Can't I just take this...

    Code:
    onchange="window.location.href= this.form.URL.options[this.form.URL.selectedIndex].value"
    ...put it in the option tag and change it to onSelect or something?

    This is as far as I can go. I copied the code and altered it. Can anyone here help please?

  • #2
    New to the CF scene
    Join Date
    Sep 2011
    Posts
    3
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Point in the right direction

    Can any of the many coders here help out? Perhaps point me in the right direction?

    Your help appreciated...

  • #3
    New to the CF scene
    Join Date
    Sep 2011
    Posts
    3
    Thanks
    0
    Thanked 0 Times in 0 Posts
    It looks like there's no life here.


  •  

    Tags for this Thread

    Posting Permissions

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