Go Back   CodingForums.com > :: Client side development > JavaScript programming

Before you post, read our: Rules & Posting Guidelines

Reply
 
Thread Tools Rate Thread
Enjoy an ad free experience by logging in. Not a member yet? Register.
Old 09-03-2011, 01:40 PM   PM User | #1
solarwinds
New to the CF scene

 
Join Date: Sep 2011
Posts: 3
Thanks: 0
Thanked 0 Times in 0 Posts
solarwinds is an unknown quantity at this point
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?
solarwinds is offline   Reply With Quote
Old 09-03-2011, 07:31 PM   PM User | #2
solarwinds
New to the CF scene

 
Join Date: Sep 2011
Posts: 3
Thanks: 0
Thanked 0 Times in 0 Posts
solarwinds is an unknown quantity at this point
Point in the right direction

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

Your help appreciated...
solarwinds is offline   Reply With Quote
Old 09-03-2011, 10:03 PM   PM User | #3
solarwinds
New to the CF scene

 
Join Date: Sep 2011
Posts: 3
Thanks: 0
Thanked 0 Times in 0 Posts
solarwinds is an unknown quantity at this point
It looks like there's no life here.
solarwinds is offline   Reply With Quote
Reply

Bookmarks

Tags
html form, javascript, paypal, redirect on select

Jump To Top of Thread


Thread Tools
Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT +1. The time now is 08:43 AM.


Advertisement
Log in to turn off these ads.