View Single Post
  #1  
Old 09-12-2006, 04:04 AM
  photo's Avatar 
photo photo is offline
 

X-Wizard
  
Join Date: Feb 2006
Location: UK
Posts: 1,146
 

Default Checkbox Validation

This mod is a adaptation of Zaja's must except terms mod http://forum.x-cart.com/showthread.php?t=20597
The differance is that if you do not check the "I agree to the terms and conditions" checkbox you will get a popup warning message.
This is for xcart version 4.1.3 it has not been extensively tested so use at your own risk.

1. open skin/customer/main/checkout.tpl and add following code after {capture name=checkout_dialog}:
Code:
<SCRIPT LANGUAGE="JavaScript"> <!-- Original: Colin Pc --> <!-- Web Site: http://www.insighteye.com/ --> <!-- This script and many more are available free online at --> <!-- The JavaScript Source!! http://javascript.internet.com --> <!-- Begin {literal} function checkCheckBox(f){ if (f.agree.checked == false ) { alert('You must agree to the terms and conditions to continue.'); return false; }else return true; } // End --> {/literal} </script>
2. Replace:
Code:
{$lng.txt_terms_and_conditions_note}
with:
Code:
<input type="checkbox" value="0" name="agree"> {$lng.txt_terms_and_conditions_note}
3. Replace:
Code:
{include file="buttons/button.tpl" button_title=$lng.lbl_submit_order style="button" href=$button_href}
with:
Code:
<input type="submit" value="Submit Order" />
4. Replace:
Code:
<form action="{$payment_data.payment_script_url}" method="post" name="checkout_form">
with:
Code:
<form action="{$payment_data.payment_script_url}" method="post" name="checkout_form" onsubmit="return checkCheckBox(this)">
5. Repeat procedure in skin/customer/main/checkout.tpl (add javascript code after {capture name=checkout_dialog})

That should do it, if you find any issues please reply to this thread.
__________________
v4.1.10
In Dev v4.5.x


"If you don't keep an eye on your business, someone else will."
Reply With Quote