From f13ab02361863baaeda216dcffdbb04224665486 Mon Sep 17 00:00:00 2001
From: Chris Jones <rollercow@sucs.org>
Date: Sun, 11 Oct 2009 20:06:24 +0000
Subject: [PATCH] Adds a agree to TnC's tick box to the signup page... and wont
 let you submit untill you do.. also fixes the not enabling the submit button
 when you've filled out the last field problem

Needs checking for agreement in the php too.. otherwise non JS enabled people will still get away with it
---
 htdocs/js/signup.js  |  3 ++-
 templates/signup.tpl | 10 +++++++---
 2 files changed, 9 insertions(+), 4 deletions(-)

diff --git a/htdocs/js/signup.js b/htdocs/js/signup.js
index 5ed910b..0268037 100644
--- a/htdocs/js/signup.js
+++ b/htdocs/js/signup.js
@@ -8,7 +8,7 @@ function validate(){
 			break;
 		}
 	}
-	if((valid || ($('input#override:checked').size()==1)) && !submitted ){
+	if((valid || ($('input#override:checked').size()==1)) && !submitted && ($('input#tnc:checked').size()==1)){
 		$('input#submit').removeAttr("disabled");
 		return true;
 	}
@@ -237,6 +237,7 @@ $(function(){
         $("input#phone").change(processPhone);
 	$("textarea#address").change(processAddress);
 	$("input#override").change(validate);
+	$("input#tnc").change(validate);
 	// Disable the submit button once clicked
 	$("form#mainform").submit(function() {
 		var valid = validate();
diff --git a/templates/signup.tpl b/templates/signup.tpl
index e0b634b..323f612 100644
--- a/templates/signup.tpl
+++ b/templates/signup.tpl
@@ -4,7 +4,7 @@
         <div class="boxhead"><h2>Membership Signup</h2></div>
         <div class="boxcontent">
 
-            <p>Please enter the details from your signup receipt</p>
+           <p>Please enter the details from your signup receipt</p>
 
             <div class="row">
                 <label for="signupid">Signup ID:</label>
@@ -70,12 +70,16 @@
                                         <span class="textinput"><input type="text" id="email" name="email" size="30" {if $mode=='re-form'}value='{$fields.email}'{/if}/></span>
 					<div id="emailmessage"{if $mode=='re-form'}{if isset($errors.email)} style="color:red; float:right; clear:right;">{$errors.email}{else} style="color:green; float:right; clear:right;">OK{/if}{else}>{/if}</div>
                                 </div>
-                                <div class="row" id="phonediv">
+           	                 <div class="row" id="phonediv">
                                         <label for="phone">Phone Number</label>
                                         <span class="textinput"><input type="text" id="phone" name="phone" size="30" {if $mode=='re-form'}value='{$fields.phone}'{/if}/></span>
 					<div id="phonemessage"{if $mode=='re-form'}{if isset($errors.phone)} style="color:red; float:right; clear:right;">{$errors.phone}{else} style="color:green; float:right; clear:right;">OK{/if}{else}>{/if}</div>
 				</div>
-				{if $overridable}
+		                <div class="row" id="tncdiv">
+                                        <span class="textinput"><input type="checkbox" id="tnc" name="tnc" size="30" {if $mode=='re-form'}value='{$fields.tnc}'{/if}/>I have read and understood, and agree to be bound by the <a href="/About/Conditions">Terms and Conditions</a>.</span>
+					<div id="tncmessage"{if $mode=='re-form'}{if isset($errors.tnc)} style="color:red; float:right; clear:right;">{$errors.tnc}{else} style="color:green; float:right; clear:right;">OK{/if}{else}>{/if}</div>
+				</div>
+			{if $overridable}
 				<div class="row" id="overridediv">
 					<label for="overridable">Override Validation</label>
 					<span class="textinput"><input type="checkbox" id="override" name="override" /></span>
-- 
GitLab