Alan Tingey Alan Tingey -4 years ago 115
HTML Question

Paypal Button with £0 Option

I have a PayPal form which has an three options £5, £3 & £0.

The button works if I choose either £5 or £3 but does not work with £0. Is there a way to capture when the "Pay" button is clicked and the option of £0 selected to redirect the user to a pre determined URL such as ""?

Any help on this would be appreciated.

Below is the form:

<form action="" method="post" target="_top">
<input type="hidden" name="cmd" value="_s-xclick">
<input type="hidden" name="hosted_button_id" value="CUP9TLQ96MR28">
<td><input type="hidden" name="on0" value="str8RED"></td>
<select name="os0">
<option value="Premium ->">Premium -> £5.00 GBP</option>
<option value="Standard ->">Standard -> £3.00 GBP</option>
<option value="Basic ----->">Basic -----> £0.00 GBP</option>
<input type="hidden" name="currency_code" value="GBP">
<input type="image" src="" border="0" name="submit" alt="PayPal – The safer, easier way to pay online!">
<img alt="" border="0" src="" width="1" height="1">

Answer Source

This should work. (JSFiddle)

function myFunction() {
  var sel= document.getElementById("os0");
  if (sel.options[sel.selectedIndex].value == 'Basic ----->') {
    return false;
  } else {

<form id="myForm" onsubmit="event.preventDefault(); myFunction();">
  <select name="os0" id="os0">
Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download