Jump to content

Form Javascript Verification


Arsenal

Recommended Posts

My goal is to make it so if the check box is checked, the page continues as normal. If the checkbox is not checked, then the page is redirected. I don't get any syntax errors but the code does not do what it is intended. What am I missing?

 

 

<script language="JavaScript">
			function check_agreement(){
				if(document.getElementById('term_agreement') == false){
					window.location = 'index.php';
				}
			}
		</script>
		<form name="registration" enctype="application/x-www-form-urlencoded" method="post" action="index.php?PHPKatalyst=register&step=user_info" onSubmit="check_agreement();">
		In order to proceed, you must agree to the following <strong>Terms & Conditions</strong>:<br /><br />
		<fieldset stlye="font-style: italic;">


		</fieldset>
		<label for="term_agreement"><input type="checkbox" name="term_agreement" id="term_agreement" />If you agree to these <strong>Terms & Conditions</strong>, then check this box.</label>
		<div style="text-align: center;"><input type="submit" value="Continue" /></div>
		</form>

Link to comment
https://forums.phpfreaks.com/topic/47800-form-javascript-verification/
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.