Simple java script agree/not agree form

From Fratm.com

Jump to: navigation, search

I wrote this little form that will only let you submit it if the agree box is checked.. It was used when I had to show an EULA and needed the user to agree to it before he continued.

<form>
<input type="checkbox" name="agree" onClick="form.mode_login.disabled = false; form.noagree.value = false; form.agree.disabled=true; form.noagree.checked=false; form.noagree.disabled=false;"> I have read the <a href="#eula">EULA</a> and AGREE to these terms and conditions.<br> 
<input type="checkbox" name="noagree"
 onClick="form.mode_login.disabled = true; form.noagree.disabled=true; form.agree.checked=false; form.agree.disabled=false;"> I have read the <a href="#eula">EULA</a> and DO NOT AGREE to these terms and conditions. <br> 
<input type="submit" name="mode_login" value="Continue" disabled >

</form>


The nice thing about this is that it toggles the check box so you can't have two boxes checked at once, and it also disables the continue button if you do not agree, or nothing is checked.

Here is my live example : http://www.fratm.com/examples/agree-disagree-form.html

Disclaimer : I am not a javascript programmer, this is just something I hacked together.

Fratm 16:26, 20 April 2007 (PDT)

Personal tools