aspose file tools*
The moose likes HTML, CSS and JavaScript and the fly likes Check boxes Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Soft Skills this week in the Jobs Discussion forum!
JavaRanch » Java Forums » Engineering » HTML, CSS and JavaScript
Bookmark "Check boxes" Watch "Check boxes" New topic
Author

Check boxes

Jeff Dube
Ranch Hand

Joined: Jun 14, 2001
Posts: 44
Hi all,
I have 4 check boxes and i would like to insert the checked boxes into tables. The problem is that i don't know how to check if the box is checked or not.
Can somebody help me??
Here is the code for the check boxes:
<form name="testform" method="post" onSubmit="return validateMe(this)">
...
...
Select languages you are working with:<br><br>
<input type="checkbox" name="check1">Java<br>
<input type="checkbox" name="check2">C++<br>
<input type="checkbox" name="check3">Visual Basic<br>
<input type="checkbox" name="check4">SQL PL/SQL<br>
</form>
Thank you.
I heard that i need to set a value for each check box but i am not quite sure of this fact..
Jeff
Dave Vick
Ranch Hand

Joined: May 10, 2001
Posts: 3244
Jeff
to test if the box is checked or not just use this test:
if (document.formName.checkboxName.checked)
will return true if it is checked and false if not.
hope that helps
Dave


Dave
Jeff Dube
Ranch Hand

Joined: Jun 14, 2001
Posts: 44
Thanks Dave,
Have a nice day!
Jeff
Jeff Dube
Ranch Hand

Joined: Jun 14, 2001
Posts: 44
Is it the same process for Radio button?
Dave Vick
Ranch Hand

Joined: May 10, 2001
Posts: 3244
Yes it is, except that they will all have th same name so you have you the index of the button you want to check:
if (document.formName.radioButtonName[index].checked)
have a good one
Dave

 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Check boxes