Welcome to Webune Support Forums

We provide web hosting to people just like you who are just beginning to program their websites. We provide excellent support service, that is why we have created this post to show you how you can make a checkbox validate.

Javascript is an important tool for validating your forms

if you did not put any kind of validation on your forms, then you will most likely get alot of un desired results when your users submit the information you are requesting.


in this post we will show you how you can use javascript to check and verify that the users are putting what we want.

the example we are going to use is a simple form, lets say you have a forum and you want your users to agree to your terms of service, if they dont check the agree checkbox, then you will show them a pop up message letting them know that they have to agree to continue.


for example, lets say i have this simple form:
Agree To Terms


if you click on the Agree button above, nothing will happen, since i have not put any javascript validation on it.

Now we are going to put some javascript to our form for validating the checkbox: try it!
Agree To Terms


Try clicking on the button without checking the agree checkbox, and you will see a popup message telling you that you have to agree.

you can download the code i used in the attachments section at the bottom of this post

javascript-checkbox-validation.html