View Single Post
  #15  
Old 05-01-2007, 05:14 AM
  caviar's Avatar 
caviar caviar is offline
 

Newbie
  
Join Date: Sep 2006
Posts: 5
 

Default Re: Click "I agree" checkbox before allowing purchase.

Here is another solution.

Display the "I agree" text with a checkbox and the submit button initially. When the customer goes to click the submit button the script below checks to see if the checkbox was checked or not. If so the order goes through else a popup box is displayed telling the customer he/she must agree to the terms and conditons before placing the order.

Code:
{literal} <script language="javascript" type="text/javascript"> function wrapperCheckTerms(formName) { if (checkTermsBox(formName)) { return true; } else { return false; } } function checkTermsBox(formName) { var alertMsg = "You must agree to our Terms and Conditions before placing this order."; if (formName.AgreeToTermsAndConditions.checked) { return true; } else { alert(alertMsg); return false; } } </script> {/literal}

And place this code in the submit button link.

Code:
onclick='return wrapperCheckTerms(checkout_form);'

I've seen most websites operate in this matter. Check out the UPS website to see this in action. Try clicking the 'Track' button without filling out the form and you'll see what happens.

Code:
http://www.ups.com/content/us/en/index.jsx
__________________
X-Cart version 3.5.11
PHP 4.4.4
MySQL server 4.1.21-standard
OS Linux
Perl 5.008007
XML parser (expat) 1.95.6
Reply With Quote