YetAnotherForum
Welcome Guest Search | Active Topics | Log In | Register

Buy Now and Terms Checkbox - How? Options
bloy.d
#1 Posted : Monday, July 25, 2005 11:19:57 AM
Rank: Starting Member

Groups: Registered

Joined: 7/25/2005
Posts: 9
Location: ,
Hi All, I'm new to all this scripting so go easy on me. Im creating a website that will use the PayPal Buy Now button which takes the user to the PayPal website to payment processing. (I'm only seeling a single item). The button works great but I want to force the user to agree to the terms and conditions (T&C's) of the purchase before being allowed to make the payment. I have this simple script that works for this type of function: <HTML> <HEAD> </HEAD> <BODY> <P> <SCRIPT> function Do_it ( ok ) { if (ok ==false) { alert("You must agree to the Terms and Conditions before you can enter"); } } </SCRIPT> <INPUT TYPE="CHECKBOX" NAME="CheckBox" VALUE="CheckBox"></P> <INPUT TYPE="button" NAME="Submit" VALUE="Submit" onClick="Do_it(CheckBox.checked)"> </BODY> </HTML> But I don't know how to incorporate it into the Buy Now button. The Buy Now button script is: <form action="https://www.paypal.com/cgi-bin/webscr" method="post"> <input type="hidden" name="cmd" value="_xclick"> <input type="hidden" name="business" value="EMAIL ADDRESS GOES HERE"> <input type="hidden" name="undefined_quantity" value="1"> <input type="hidden" name="item_name" value="ITEM NAME GOES HERE"> <input type="hidden" name="item_number" value="WMH001"> <input type="hidden" name="amount" value="50.00"> <input type="hidden" name="page_style" value="PayPal"> <input type="hidden" name="no_shipping" value="1"> <input type="hidden" name="no_note" value="1"> <input type="hidden" name="currency_code" value="GBP"> <input type="hidden" name="lc" value="GB"> <table><tr><td><input type="hidden" name="on0" value="Which charity do I support?">Which charity do I support?</td><td><select name="os0"><option value="Age Concern">Age Concern<option value="NSPCC">NSPCC<option value="Lupus">Lupus<option value="Cancer Research UK">Cancer Research UK</select> </td></tr></table><input type="image" src="https://www.paypal.com/en_US/i/btn/x-click-but23.gif" border="0" name="submit" alt="Make payments with PayPal - it's fast, free and secure!"> </form> Any help will be greatly appreciated Regrds Dan
Sponsor  
 
mj3
#2 Posted : Monday, July 25, 2005 12:28:10 PM
Rank: Starting Member

Groups: Registered

Joined: 9/24/2004
Posts: 106
Location: ,
This should work:

&lt;!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"&gt;
&lt;html&gt;
&lt;head&gt;
&lt;SCRIPT&gt;
function Do_it ( ok )
{

if (ok == false)
{
alert("You must agree to the Terms and Conditions before you can enter");
}
else
{
document.form.submit();
}

}

&lt;/SCRIPT&gt;
&lt;/head&gt;
&lt;body&gt;
&lt;form name="form" action="https://www.paypal.com/cgi-bin/webscr" method="post"&gt;
&lt;input type="hidden" name="cmd" value="_xclick"&gt;
&lt;input type="hidden" name="business" value="EMAIL ADDRESS GOES HERE"&gt;
&lt;input type="hidden" name="undefined_quantity" value="1"&gt;
&lt;input type="hidden" name="item_name" value="ITEM NAME GOES HERE"&gt;
&lt;input type="hidden" name="item_number" value="WMH001"&gt;
&lt;input type="hidden" name="amount" value="50.00"&gt;
&lt;input type="hidden" name="page_style" value="PayPal"&gt;
&lt;input type="hidden" name="no_shipping" value="1"&gt;
&lt;input type="hidden" name="no_note" value="1"&gt;
&lt;input type="hidden" name="currency_code" value="GBP"&gt;
&lt;input type="hidden" name="lc" value="GB"&gt;
&lt;table&gt;&lt;tr&gt;&lt;td&gt;&lt;input type="hidden" name="on0" value="Which charity do I support?"&gt;Which charity do I support?&lt;/td&gt;&lt;td&gt;&lt;select name="os0"&gt;&lt;option value="Age Concern"&gt;Age Concern&lt;option value="NSPCC"&gt;NSPCC&lt;option value="Lupus"&gt;Lupus&lt;option value="Cancer Research UK"&gt;Cancer Research UK&lt;/select&gt;
&lt;/td&gt;&lt;/tr&gt;&lt;/table&gt;
I have read the terms & conditions. &lt;INPUT TYPE="CHECKBOX" NAME="CheckBox" VALUE="CheckBox"&gt;&lt;br&gt;
&lt;a href="Javascript:Do_it(document.form.CheckBox.checked);"&gt;
&lt;img src="https://www.paypal.com/en_US/i/btn/x-click-but23.gif" border="0" alt="Make payments with PayPal - it's fast, free and secure!"&gt;&lt;/a&gt;&lt;/form&gt;
&lt;/body&gt;
&lt;/html&gt;
bloy.d
#3 Posted : Monday, July 25, 2005 12:54:18 PM
Rank: Starting Member

Groups: Registered

Joined: 7/25/2005
Posts: 9
Location: ,
Thank-you so much mj3. It been racking my brain all day.

I might have to do my work now :)

Cheers
Dan
bloy.d
#4 Posted : Tuesday, July 26, 2005 11:02:26 AM
Rank: Starting Member

Groups: Registered

Joined: 7/25/2005
Posts: 9
Location: ,
Hi All,

I've modified the script to change the drop down list to 3 radio buttons and I now need this to be complusiry like the T&C's box. Any ideas?

Here is my code:

&lt;!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"&gt;
&lt;html&gt;
&lt;head&gt;
&lt;SCRIPT&gt;
function Do_it ( ok )
{

if (ok == false)
{
alert("You must agree to the Terms and Conditions before you can enter");
}
else
{
document.form.submit();
}

}

&lt;/SCRIPT&gt;
&lt;/head&gt;
&lt;body&gt;
&lt;form name="form" action="https://www.paypal.com/cgi-bin/webscr" method="post"&gt;
&lt;input type="hidden" name="cmd" value="_xclick"&gt;
&lt;input type="hidden" name="business" value="E-MAIL ADRESS"&gt;
&lt;input type="hidden" name="undefined_quantity" value="1"&gt;
&lt;input type="hidden" name="item_name" value="ITEM NAME"&gt;
&lt;input type="hidden" name="item_number" value="WMH001"&gt;
&lt;input type="hidden" name="amount" value="50.00"&gt;
&lt;input type="hidden" name="page_style" value="PayPal"&gt;
&lt;input type="hidden" name="no_shipping" value="1"&gt;
&lt;input type="hidden" name="no_note" value="1"&gt;
&lt;input type="hidden" name="currency_code" value="GBP"&gt;
&lt;input type="hidden" name="lc" value="GB"&gt;

&lt;table&gt;

&lt;tr&gt;

&lt;td&gt;

&lt;input type="hidden" name="on0" value="Which charity do I support?"&gt;Which charity do I support?

&lt;/td&gt;

&lt;td&gt;



&lt;input type="radio" name="os0" value="NSPCC"&gt; NSPCC
&lt;input type="radio" name="os0" value="Lupus"&gt; Lupus
&lt;input type="radio" name="os0" value="Cancer Research"&gt; Cancer Research


&lt;/select&gt;

&lt;/td&gt;

&lt;/tr&gt;

&lt;/table&gt;

&lt;p&gt;

&lt;INPUT TYPE="CheckBox" NAME="CheckBox" VALUE="CheckBox"&gt; I have read the terms & conditions. &lt;br&gt;

&lt;a href="Javascript:Do_it(document.form.CheckBox.checked);"&gt;


&lt;img src="https://www.paypal.com/en_US/i/btn/x-click-but23.gif" border="0" alt="Make payments with PayPal - it's fast, free and secure!"&gt;&lt;/a&gt;&lt;/form&gt;
&lt;/body&gt;
&lt;/html&gt;



Any help would be greatly appreciated.

Thanks
Dan
mj3
#5 Posted : Tuesday, July 26, 2005 1:31:21 PM
Rank: Starting Member

Groups: Registered

Joined: 9/24/2004
Posts: 106
Location: ,
Try this:

&lt;!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"&gt;
&lt;html&gt;
&lt;head&gt;
&lt;SCRIPT&gt;
function Do_it ( checkbox, radiobutton )
{
if (checkbox == false)
{
alert("You must agree to the Terms and Conditions before you can enter");
}
else if(radiobutton == "false")
{
alert("You must select a charity before you can enter");
}
else
{
document.form.submit();
}

}

&lt;/SCRIPT&gt;
&lt;/head&gt;
&lt;body&gt;
&lt;form name="form" action="https://www.paypal.com/cgi-bin/webscr" method="post"&gt;
&lt;input type="hidden" name="cmd" value="_xclick"&gt;
&lt;input type="hidden" name="business" value="E-MAIL ADRESS"&gt;
&lt;input type="hidden" name="undefined_quantity" value="1"&gt;
&lt;input type="hidden" name="item_name" value="ITEM NAME"&gt;
&lt;input type="hidden" name="item_number" value="WMH001"&gt;
&lt;input type="hidden" name="amount" value="50.00"&gt;
&lt;input type="hidden" name="page_style" value="PayPal"&gt;
&lt;input type="hidden" name="no_shipping" value="1"&gt;
&lt;input type="hidden" name="no_note" value="1"&gt;
&lt;input type="hidden" name="currency_code" value="GBP"&gt;
&lt;input type="hidden" name="lc" value="GB"&gt;

&lt;table&gt;

&lt;tr&gt;

&lt;td&gt;

&lt;input type="hidden" name="on0" value="Which charity do I support?"&gt;Which charity do I support?

&lt;/td&gt;

&lt;td&gt;



&lt;input type="radio" name="os0" value="NSPCC" onClick="javascript:document.form.radiochecked='true';"&gt; NSPCC
&lt;input type="radio" name="os0" value="Lupus" onClick="javascript:document.form.radiochecked='true';"&gt; Lupus
&lt;input type="radio" name="os0" value="Cancer Research" onClick="javascript:document.form.radiochecked='true';"&gt; Cancer Research
&lt;input type="hidden" name="radioChecked" value="false"&gt;

&lt;/select&gt;

&lt;/td&gt;

&lt;/tr&gt;

&lt;/table&gt;

&lt;p&gt;

&lt;INPUT TYPE="CheckBox" NAME="CheckBox" VALUE="CheckBox"&gt; I have read the terms & conditions. &lt;br&gt;

&lt;a href="Javascript:Do_it(document.form.CheckBox.checked, document.form.radioChecked.value);"&gt;

&lt;img src="https://www.paypal.com/en_US/i/btn/x-click-but23.gif" border="0" alt="Make payments with PayPal - it's fast, free and secure!"&gt;&lt;/a&gt;&lt;/form&gt;
&lt;/body&gt;
&lt;/html&gt;
bloy.d
#6 Posted : Tuesday, July 26, 2005 5:53:29 PM
Rank: Starting Member

Groups: Registered

Joined: 7/25/2005
Posts: 9
Location: ,
Hi mj3,

Thanks for the quick reply. I've tried with code in IE and Mozilla and it doesn't seem to allow the user to execute the Pay Now button.

The test for else if(radiobutton == "false") always seems to be true. (Well i think it does).

When the user selects a radio button and checks the terms box this the dialog box appears: You must select a charity before you can enter.

I've tried modifing it but without any luck.

Are you able to help?

Cheers
Dan
ron
#7 Posted : Tuesday, July 26, 2005 7:04:58 PM
Rank: Starting Member

Groups: Registered

Joined: 11/24/2002
Posts: 2,004
Location: ,
The problem is that you cannot just test "radiobutton". That may be an IE extension, but it is not normal code. You must identify the "path" to the button. I think mj3 meant this as a metaphorical name...

You have two problems. The first is that "radiobutton" is not defined properly, and the 2nd is that the script does not support the "general" case. It is really simple to do, and I'm gonna give it to you without flair.... (start with your first example)...

1. drop the JavaScript (take it out).
2. take your checkbox and submit lines and put them into the botton code (anywhere), but without the event handler code....
3. change your FORM statement from this...

&lt;form action="https://www.paypal.com/cgi-bin/webscr" method="post"&gt;

to this...

&lt;form action="https://www.paypal.com/cgi-bin/webscr" method="post"
onsubmit="return this.CheckBox.checked;"&gt;

And it shall work just fine...

Ron.
mj3
#8 Posted : Wednesday, July 27, 2005 6:10:47 AM
Rank: Starting Member

Groups: Registered

Joined: 9/24/2004
Posts: 106
Location: ,
just seen, with my code the lines:
onClick="javascript:document.form.radiochecked='true';"

should be

onClick="javascript:document.form.radioChecked.value='true';"

this line occurs for all 3 radio buttons, then it does work
bloy.d
#9 Posted : Wednesday, July 27, 2005 6:35:07 AM
Rank: Starting Member

Groups: Registered

Joined: 7/25/2005
Posts: 9
Location: ,
Hi Ron,

I'd done what you suggested and the script on checks that the checkbox is checked and not the radio buttons. This is the same as the first replt from mj3. I need both the check box and one radio button selected.

Cheers
Dan
bloy.d
#10 Posted : Wednesday, July 27, 2005 8:37:48 AM
Rank: Starting Member

Groups: Registered

Joined: 7/25/2005
Posts: 9
Location: ,
Hi mj3,

Thanks so much for that, it's really appreciated.

Thanks for you advice Ron.

Cheers
Dan

Incase anyone wants to knwo the findal code is:

&lt;!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"&gt;
&lt;html&gt;
&lt;head&gt;
&lt;SCRIPT&gt;
function Do_it ( checkbox, radiobutton )
{
if (checkbox == false)
{
alert("You must agree to the Terms and Conditions before you can enter");
}
else if(radiobutton == "false")
{
alert("You must select a charity before you can enter");
}
else
{
document.form.submit();
}

}

&lt;/SCRIPT&gt;
&lt;/head&gt;
&lt;body&gt;
&lt;form name="form" action="https://www.paypal.com/cgi-bin/webscr" method="post"&gt;
&lt;input type="hidden" name="cmd" value="_xclick"&gt;
&lt;input type="hidden" name="business" value="E-MAIL ADRESS"&gt;
&lt;input type="hidden" name="undefined_quantity" value="1"&gt;
&lt;input type="hidden" name="item_name" value="ITEM NAME"&gt;
&lt;input type="hidden" name="item_number" value="WMH001"&gt;
&lt;input type="hidden" name="amount" value="50.00"&gt;
&lt;input type="hidden" name="page_style" value="PayPal"&gt;
&lt;input type="hidden" name="no_shipping" value="1"&gt;
&lt;input type="hidden" name="no_note" value="1"&gt;
&lt;input type="hidden" name="currency_code" value="GBP"&gt;
&lt;input type="hidden" name="lc" value="GB"&gt;

&lt;table&gt;

&lt;tr&gt;

&lt;td&gt;

&lt;input type="hidden" name="on0" value="Which charity do I support?"&gt;Which charity do I support?

&lt;/td&gt;

&lt;td&gt;



&lt;input type="radio" name="os0" value="NSPCC" onClick="javascript:document.form.radioChecked.value='true';"&gt; NSPCC
&lt;input type="radio" name="os0" value="Lupus" onClick="javascript:document.form.radioChecked.value='true';"&gt; Lupus
&lt;input type="radio" name="os0" value="Cancer Research" onClick="javascript:document.form.radioChecked.value='true';"&gt; Cancer Research
&lt;input type="hidden" name="radioChecked" value="false"&gt;

&lt;/select&gt;

&lt;/td&gt;

&lt;/tr&gt;

&lt;/table&gt;

&lt;p&gt;

&lt;INPUT TYPE="CheckBox" NAME="CheckBox" VALUE="CheckBox"&gt; I have read the terms & conditions. &lt;br&gt;

&lt;a href="Javascript:Do_it(document.form.CheckBox.checked, document.form.radioChecked.value);"&gt;

&lt;img src="https://www.paypal.com/en_US/i/btn/x-click-but23.gif" border="0" alt="Make payments with PayPal - it's fast, free and secure!"&gt;&lt;/a&gt;&lt;/form&gt;
&lt;/body&gt;
&lt;/html&gt;
GeoCal
#11 Posted : Thursday, January 12, 2012 8:36:29 PM
Rank: Starting Member

Groups: Registered

Joined: 1/12/2012
Posts: 1
Location: Arkansas
bloy.d I have a similar problem and I am a complete noob. I rent lawn announcement displays, like the big stork you may have seen in a yard announcing a new birth. The code for my button is as follows:

<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="UV2NANNXUG77U">
<table>
<tr><td><input type="hidden" name="on0" value="Display Dates">Display Dates</td></tr><tr><td><select name="os0">
<option value="One Day">One Day $45.00 USD</option>
<option value="Two Day">Two Day $80.00 USD</option>
<option value="Three Day">Three Day $105.00 USD</option>
<option value="Four Day">Four Day $130.00 USD</option>
<option value="Five Day">Five Day $155.00 USD</option>
<option value="Six Day">Six Day $180.00 USD</option>
<option value="Seven Day">Seven Day $205.00 USD</option>
</select> </td></tr>
<tr><td><input type="hidden" name="on1" value="Enter Phone #">Enter Phone #</td></tr><tr><td><input type="text" name="os1" maxlength="200"></td></tr>
</table>
<input type="hidden" name="currency_code" value="USD">
<input type="image" src="https://www.paypalobjects.com/en_US/i/btn/btn_paynowCC_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>

I want to force the customer to accept Rental and Refund Agreement before going to PayPal Payment Page. I have seen the code samples here and I have no idea where to paste them. Thanks in advance for your kind response. My web page is http://geocals.net/Pages/Storks.html
Users browsing this topic
Guest
Forum Jump  
You cannot post new topics in this forum.
You cannot reply to topics in this forum.
You cannot delete your posts in this forum.
You cannot edit your posts in this forum.
You cannot create polls in this forum.
You cannot vote in polls in this forum.

YAFVision Theme by Jaben Cargman (Tiny Gecko)
Powered by YAF | YAF © 2003-2009, Yet Another Forum.NET
This page was generated in 0.499 seconds.