The SitePoint Forums have moved.

You can now find them here.
This forum is now closed to new posts, but you can browse existing content.
You can find out more information about the move and how to open a new account (if necessary) here.
If you get stuck you can get support by emailing forums@sitepoint.com

If this is your first visit, be sure to
check out the FAQ by clicking the
link above. You may have to register
before you can post: click the register link above to proceed. To start viewing messages,
select the forum that you want to visit from the selection below.

Validate Checkbox

Can someone help me, I make a checkbox
<input type="checkbox" name="Agree" value="1">
How can I validate if the checkbox is not checked ?
So user have to checked it first if they want to continue.
Thanks.

Either you misread something, or I am on one of my walkabouts in daze city.
How does my example get submitted if the isOk2Send is false? I do not have a submit button in the form; the submission is through the function.
Also, how does onSubmit give you greater control?

So the user must now go to the effort of grabbing their mouse and going to the button you have specified when an onSubmit in the <form> would allow them to hit enter and still get validated information.

How does onSubmit give you greater control, besides the above? You are staying within user norms and you don't need to do a forced JS submit.

Part of being a programmer is usability. Your ease of use is significantly decreased by requiring the users to click on a specific portion of the screen, versus allowing them to choose between doing that and hitting enter.

Yes, the rest of the JS wouldn't execute if the user had JS turned off. However, in your version how would such a user submit the form? In mine it still gets submitted.

Part of being a programmer is usability. Your ease of use is significantly decreased by requiring the users to click on a specific portion of the screen,

from the original post:

<input type="checkbox" name="Agree" value="1">

The implication of the checkbox (and jet_wang's request) is that:
1) the user must agree to continue
2) the user has scrolled to the position where the checkbox is -- after having read x amount of text -- otherwise, there is no way the user would have any need to agree or disagree.
3) most people use their mouse to scroll
4) once the mouse is in hand, it is generally used to click on a checkbox
5) most web sites do not automatically tab or place the focus on a checkbox
6) 'significantly' ??????
7) I personally would use buttons for agree/disagree and use them in the manner I indicated.
8) this is getting to be more of a design argument, and costing me much more time and effort than I care to expend. jet_wang has a number of options open to him/her, perhaps more than s/he wants. Let sleeping dogs lie.