Creating Compulsory Fields in PayPal Buttons

RegalCinema
Contributor
Contributor

Hi,

 

Here is our website, our PayPal Buttons are on the Memberships and Gift Voucher pages. www.regalcinemamelton.com 

 

We have created a few buttons for our website but we need to add compulsory fields to some. 

The first is our membership forms require a compulsory 'Contact Number' field. 

How would we add this? 

 

Secondly, we have people who want to buy memberships to our cinema as gifts. We are able to send the membership pack out to the giver-of-the-gift as a delivery address is required. We still require the gift recipients Name, Contact Number and Address, however, as they need to be added to our system so that we can send them our monthly brochures in the post. 

 

If anyone can help out that would be great.

 

Thanks,

 

Jake

Login to Me Too
3 REPLIES 3

Quandary
Advisor
Advisor

What you're referring to is "required fields".   This is something that cannot be done using the online button creator.  Although the online button creator is a great tool, when you have a special need - then the item button code must be manually created.  Note, the code is not stored on the PayPal servers, it all runs on your web page.    Setting up required fields is not too hard (if you're familar with writing scripts) but, you will need a script to manage the input and pass that data to the PayPal Checkout Screens.

 

Here's a basic Buy Now example you're welcome to tinker with.   Just enter your PayPal account email address as the "value" for the "business" variable.

 

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>

<head>
  <title>Required Fields Example</title>
  <meta http-equiv="content-type" content="text/html;charset=UTF-8">

<!-- Start of Script -->
<script type="text/javascript">
<!--
function CheckForm(obj1) { 

 if (obj1.os2.value == ""){
  alert ("You must fill in a value for Option 1!");
  return false;
 }
 else if (obj1.os3.value == ""){
  alert ("You must fill in a value for Option 2!");
  return false;
 }
 else if (obj1.os4.value == ""){
  alert ("You must fill in a value for Option 3!");
  return false;
 }
 else if (obj1.os5.value == ""){
  alert ("You must fill in a value for Option 4!");
  return false;
 }
 return true;
}
//-->
</script>
<!-- End of Script -->


</head>


<body>

<!-- Start of Buy Now Button Form -->
Widget 
<form name="paypal" target="_self" action="https://www.paypal.com/cgi-bin/webscr" method="post" onsubmit="return CheckForm(this);">
<input type="hidden" name="cmd" value="_xclick">
<input type="hidden" name="business" value="your email address">
<input type="hidden" name="item_name" value="Widget">
<input type="hidden" name="item_number" value="W-10001">
<input type="hidden" name="return" value="http://www.yourwebsite.com/thankyou.html">
<input type="hidden" name="cancel_return" value="http://www.yourwebsite.com/cancel.html">
<input type="hidden" name="currency_code" value="USD">
<input type="hidden" name="lc" value="US">
<input type="hidden" name="bn" value="PP-BuyNowBF:btn_buynow_LG.gif.gif:NonHosted">
            
Select Color:&#160;&#160;
<input type="hidden" name="on0" value="Color">
<select name="os0">
<option value="Gold" selected>Gold</option>
<option value="Silver">Silver</option>
<option value="Bronze">Bronze</option>
</select>

<br><br>
Select Size:&#160;&#160;
<input type="hidden" name="on1" value="Size">
<select name="os1">
<option value="1x1" selected>1&#34; x 1&#34; - $1.00</option>
<option value="2x2">2&#34; x 2&#34; - $2.00</option>
<option value="3x3">3&#34; x 3&#34; - $3.00</option>
<option value="4x4">4&#34; x 4&#34; - $4.00</option>
<option value="5x5">5&#34; x 5&#34; - $5.00</option>
<option value="6x6">6&#34; x 6&#34; - $6.00</option>
<option value="7x7">7&#34; x 7&#34; - $7.00</option>
<option value="8x8">8&#34; x 8&#34; - $8.00</option>
<option value="9x9">9&#34; x 9&#34; - $9.00</option>
</select>


<!-- option_index value=0 is associated with variable on0 -->
<!-- option_index value=1 is associated with variable on1 -->
<input type="hidden" name="option_index" value="1">
<input type="hidden" name="option_select0" value="1x1">
<input type="hidden" name="option_amount0" value="1.00">
<input type="hidden" name="option_select1" value="2x2">
<input type="hidden" name="option_amount1" value="2.00">
<input type="hidden" name="option_select2" value="3x3">
<input type="hidden" name="option_amount2" value="3.00">
<input type="hidden" name="option_select3" value="4x4">
<input type="hidden" name="option_amount3" value="4.00">
<input type="hidden" name="option_select4" value="5x5">
<input type="hidden" name="option_amount4" value="5.00">
<input type="hidden" name="option_select5" value="6x6">
<input type="hidden" name="option_amount5" value="6.00">
<input type="hidden" name="option_select6" value="7x7">
<input type="hidden" name="option_amount6" value="7.00">
<input type="hidden" name="option_select7" value="8x8">
<input type="hidden" name="option_amount7" value="8.00">
<input type="hidden" name="option_select8" value="9x9">
<input type="hidden" name="option_amount8" value="9.00">

<br><br>
<input type="hidden" name="on2" value="Option1">
Text Option 1:&#160;&#160; <input type="text" name="os2" value="">
&#160;(required)

<br><br>
<input type="hidden" name="on3" value="Option2">
Text Option 2:&#160;&#160; <input type="text" name="os3" value="">
&#160;(required)

<br><br>
<input type="hidden" name="on4" value="Option3">
Text Option 3:&#160;&#160; <input type="text" name="os4" value="">
&#160;(required)

<br><br>
<input type="hidden" name="on5" value="Option4">
Text Option 4:&#160;&#160; <input type="text" name="os5" value="">
&#160;(required)

<br><br>
<input type="image" src="https://www.paypal.com/en_US/i/btn/btn_buynow_LG.gif" border="0" name="submit" alt="Make payments with PayPal - it's fast, free and secure!">
<img alt="" border="0" src="https://www.paypal.com/en_US/i/scr/pixel.gif" width="1" height="1">
</form>
<!-- End of Buy Now Button Form -->

</body>
</html>

   

Login to Me Too

RegalCinema
Contributor
Contributor

That's excellent thank you. 

 

I have no experience coding so I will play around this weekend and hopefully solve the problem.

 

Login to Me Too

RegalCinema
Contributor
Contributor

This has worked perfectly apart from 2 minor things... 

 

 

The form itself works great! Can add all the things I need but once the form has been sent and you get put through to the paypal payment section, the description isn't set, its a type field for the customer to type in - which wouldn't be a problem if it said something like 'Note to Seller' not 'Description' but I can't work out how to set it as the item they're buying or Note to Seller. 
The only other thing is when we get our email through with confirmation of payment and the details from our form we ask for, so Buyers Name (B.Name) and Buyers Phone Number (B.Telephone) dont come through, which are coded as:
<input type="hidden" name="on2" value="B.Name"> <label>*Buyers Full Name</label> <input type="" name="Buyers Full Name" value="" required=""><br>
which isn't a huge problem if they are the same as their paypal account, but we dont get the last two sections of the form so Address Line 4 (R.Address 4) and Post Code (R.Address 5) which is more crucial to sending out things to them as you can imagine. :
<input type="hidden" name="on10" value="R.Address 4"> Post Code: <input type="text" name="os10" value="" required=""><br>


Are these fixable at all? 
Thankyou!

 

Login to Me Too

Haven't Found your Answer?

It happens. Hit the "Login to Ask the community" button to create a question for the PayPal community.