Required and Custom Fields

1stMoon
Contributor
Contributor

We need to collect a mandatory phone number and time to call.

 

I used the text field you can put above an "add to cart" button, but only 1/2 the people are filling it out.

 

So I would like to have a required field for this inside the paypal cart itself. Is this possible?

 

Also, I would also like to add a non-required custom field inside the shopping cart as well. Is this possible?

 

Thanks for your help!!!

Login to Me Too
1 ACCEPTED SOLUTION

Accepted Solutions
Solved

1stMoon
Contributor
Contributor

Thanks Snowshoe - you 'da man (or lady)!

View solution in original post

Login to Me Too
10 REPLIES 10

snowshoe
Frequent Advisor
Frequent Advisor

What you have in mind is not possible using the online button creator, you're item button code needs to be manually created as you will need a script to manage the required fields.  All the info has be collected on your web page and then passed to PayPal using the options variables.  With Payments Standard, it not possible to add any additional fields to the PayPal screens.  Note, through your account profile settings you can require a customer's phone number however, there are no profile settings to collect additional data except for the Note to Seller field which is not mandatory to use.

 

Below is a Buy Now item button with a script for required fields, you can easliy make this an Add to Cart also.  It simply shows what a little scripting can do.  To make it work, copy the example to a blank html page, replace the business variable value with your PayPal email address, save with an .html or .htm extension and open with your web browser.

 

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>

<title>Button Example Code</title>

<!-- START META TAG SECTION -->
<meta charset="utf-8">
<meta http-equiv="Content-Type" content="text/html;charset=utf-8">
<meta http-equiv="Content-Language" content="en">
<!-- END META TAG SECTION -->


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

 if (!obj1.accept.checked){
  alert ("You must accept our Terms and Conditions!");
  return false;
 }
 else if (obj1.os0.value == ""){
  alert ("You must fill in a value for Option 1!");
  return false;
 }
 else if (obj1.os1.value == ""){
  alert ("You must fill in a value for Option 2!");
  return false;
 }
 return true;
}
//-->
</script>



</head>

<body>

<!-- START SAMPLE CODE SECTION -->


<!-- PARAGRAPH 1 -->
Required Fields Script Examples

<br><br>

A Basic Example for Required Fields.

<br><br>

Widget Concert Tickets - $25 each

<br><br>

<!-- Start of Form -->
<form name="paypal" target="paypal" action="https://www.paypal.com/cgi-bin/webscr" method="post" onsubmit="return CheckForm(this);">
<!-- If using a Business or Company Logo Graphic, include the "cpp_header_image" variable in your View Cart code. -->
<input type="hidden" name="cpp_header_image" value="https://yourwebsite.com/header.jpg">
<input type="hidden" name="cmd" value="_xclick">
<!-- Replace "business" value with your PayPal Email Address or Account ID -->
<input type="hidden" name="business" value="your email address.com">
<input type="hidden" name="item_name" value="Widget Concert Ticket">
<input type="hidden" name="item_number" value="WCT-0001">
<input type="hidden" name="amount" value="25.00">
<!-- Replace value with the web page you want the customer to return to after a successful transaction -->
<input type="hidden" name="return" value="http://yourwebsite.com/ThankYou.html">
<!-- Replace value with the web page you want the customer to return to after item cancellation -->
<input type="hidden" name="cancel_return" value="http://yourwebsite.com/Cancel.html">
<input type="hidden" name="lc" value="US">
<input type="hidden" name="button_subtype" value="products">
<input type="hidden" name="no_note" value="0">
<input type="hidden" name="cn" value="Add special instructions to the seller:">
<input type="hidden" name="bn" value="PP-BuyNowBF:btn_buynow_LG.gif:NonHosted">
            
Yes, I Accept the Terms and Conditions:&#160;&#160;<input name="accept" type="checkbox" value="0">
<br>
<br>
<input type="hidden" name="on0" value="Option1">
Option 1:&#160;&#160; <input type="text" name="os0" value="">
<br>
<br>
<input type="hidden" name="on1" value="Option2">
Option 2:&#160;&#160; <input type="text" name="os1" value="">
<br><br>
<input type="reset" name="reset" value="Reset">
<br><br>
<input type="image" src="https://www.paypalobjects.com/en_US/i/btn/btn_buynow_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>
<!-- End of Form -->



<!-- END BUTTON EXAMPLES -->



<!-- END SAMPLE CODE SECTION -->

<br><br>


</body>
</html>

 

Login to Me Too
Solved

1stMoon
Contributor
Contributor

Thanks Snowshoe - you 'da man (or lady)!

Login to Me Too

1stMoon
Contributor
Contributor

One more quick question:

 

Where in the Profile settings can I require that the customer provides a phone number upon checkout?

 

Thanks again!

Login to Me Too

snowshoe
Frequent Advisor
Frequent Advisor

Login to your Account.

Click on Profile.

Click on My Selling Tools.

Under Selling Online

Look for Website Preferences

Click on Update.

Scroll - look for Contact Telephone

Check desired choice - default is Off

Save

Login to Me Too

1stMoon
Contributor
Contributor

Thank you once again. I guess it said "Website Payment Preferneces" so I must have skipped over it.

Login to Me Too

snowshoe
Frequent Advisor
Frequent Advisor

Easy to do, the profile setup logic always confuses me too.

 

Smiley Happy

Login to Me Too

emailmarketing
Contributor
Contributor

How do I require the field lenth? I want at least 4 charactors

Login to Me Too

snowshoe
Frequent Advisor
Frequent Advisor

One option would be to enhance the required field script with some additional scripting  Below is an example of a script the allows X number of characters in a field.  You could take that script and combine it with the other script example I previously posted.  It may take a little tinkering to combine the functions but, should provide a good learning experience. 

 

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>

<title>Button Example Code</title>

<!-- START META TAG SECTION -->
<meta charset="utf-8">
<meta http-equiv="Content-Type" content="text/html;charset=utf-8">
<meta http-equiv="Content-Language" content="en">
<!-- END META TAG SECTION -->


<!-- Start of Script -->
<script type="text/javascript">
function ismaxlength(obj){
var mlength=obj.getAttribute? parseInt(obj.getAttribute("maxlength")) : ""
if (obj.getAttribute && obj.value.length>mlength)
obj.value=obj.value.substring(0,mlength)
}
</script>
<!-- End of Script -->


</head>

<body>

<!-- START SAMPLE CODE SECTION -->


<!-- PARAGRAPH 1 -->
Script Examples

<br><br><br>

Controlled Text Input Box.

<br><br>

Widget - $10.00

<!-- START CONTENTS -->

<!-- START BUTTON EXAMPLES -->

<br><br>

<!-- Start of Add to Cart Form -->
<!-- Note: target="_self" was replaced with the variable target="_self" -->
<!-- Note: shopping_url also added to code -->
<!-- These two changes allow better functionality with IE and Firefox --> 
<form target="_self" action="https://www.paypal.com/cgi-bin/webscr" method="post">
<!-- If using a Business or Company Logo Graphic, include the "cpp_header_image" variable in your View Cart code. -->
<input type="hidden" name="cpp_header_image" value="https://www.yourwebsite.com/logo.jpg"> 

Type Your Customized Nickname (25 character limit):
<br>
<input type="text" name="on0" maxlength="25" onkeyup="return ismaxlength(this)">

<br><br>

Font Color:&nbsp;&nbsp;
<select name="os0">
<option value="Font Color - Black" selected>Black</option>
<option value="Font Color - Kelly Green">Kelly Green</option>
<option value="Font Color - Lavendar">Lavendar</option>
<option value="Font Color - Orange">Orange</option>
<option value="Font Color - Pink">Pink</option>
<option value="Font Color - Red">Red</option>
<option value="Font Color - Royal Blue">Royal Blue</option>
</select> 

<br><br>

Select Block Color:&nbsp;&nbsp;
<select name="on1">
<option value="Block Color - Light Blue" selected>Light Blue</option>
<option value="Block Color - Pink">Pink</option>
<option value="Block Color - White">White</option>
</select>


<br><br>

Select Size:&nbsp;&nbsp;
<select name="os1">
<option value="Size: Small" selected>Small</option>
<option value="Size: Medium">Medium</option>
<option value="Size: Large">Large</option>
</select>

<br><br>

<input type="image" src="https://www.paypalobjects.com/en_US/i/btn/btn_cart_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">
<input type="hidden" name="add" value="1">
<input type="hidden" name="cmd" value="_cart">
<!-- Replace "business" value with your PayPal Email Address or Account ID -->
<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-1001">
<input type="hidden" name="amount" value="10.00">
<input type="hidden" name="no_shipping" value="2">
<!-- Replace value with the web page you want the customer to return to -->
<input type="hidden" name="shopping_url" value="http://www.yourwebsite.com/Basic_01.html">
<!-- Replace value with the web page you want the customer to return to after a successful transaction -->
<input type="hidden" name="return" value="http://www.yourwebsite.com/ThankYou.html">
<!-- Replace value with the web page you want the customer to return to after item cancellation -->
<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="button_subtype" value="products">
<input type="hidden" name="no_note" value="0">
<input type="hidden" name="cn" value="Add special instructions to the seller:">
<input type="hidden" name="bn" value="PP-ShopCartBF:btn_cart_LG.gif:NonHosted">
</form>
<!-- End of Form -->

<br>

<!--  Start of View Cart Button Code  -->
<form target="_self" action="https://www.paypal.com/cgi-bin/webscr" method="post">
<!-- If using a Business or Company Logo Graphic, include the "cpp_header_image" variable in your View Cart code. -->
<input type="hidden" name="cpp_header_image" value="https://www.yourwebsite.com/logo.jpg"> 
<input type="hidden" name="cmd" value="_cart">
<input type="hidden" name="display" value="1">
<!-- Replace "business" value with your PayPal Email Address or Account ID -->
<input type="hidden" name="business" value="your email address">
<!-- Replace value with the web page you want the customer to return to -->
<input type="hidden" name="shopping_url" value="http://www.yourwebsite.com/Script_10.html">
<input type="image" src="https://www.paypalobjects.com/en_US/i/btn/btn_viewcart_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> 
<!--  End of View Cart Button Code  -->


<!-- END BUTTON EXAMPLES -->



<!-- END SAMPLE CODE SECTION -->

<br><br><br><br>
<hr align="left" width="50%" noshade>
<br><br>
NOTES:
<br>
In order to test the code, you must replace the &quot;business&quot; value variable with your PayPal Email Address or Account ID.

</body>
</html>

 

 

 

Login to Me Too

emailmarketing
Contributor
Contributor
This script is working great for my form to require fom completion:

<!--
function CheckForm(obj1) {

 if (obj1.os1.value == ""){
  alert ("Please enter account name!");
  return false;
 }
 return true;
}
//-->
</script>


I want to add the minimum field os1 length of 5 characters to this code?

Can you give me full code please.

My page for view source: http://www.emailmarketingclient.com/prices.html

Thanks
Dave


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.