This week's book giveaway is in the Other Languages forum.
We're giving away four copies of Functional Reactive Programming and have Stephen Blackheath and Anthony Jones on-line!
See this thread for details.
Win a copy of Functional Reactive Programming this week in the Other Languages forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Check boxes

 
Jeff Dube
Ranch Hand
Posts: 44
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 3244
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
 
Jeff Dube
Ranch Hand
Posts: 44
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Thanks Dave,
Have a nice day!
Jeff
 
Jeff Dube
Ranch Hand
Posts: 44
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Is it the same process for Radio button?
 
Dave Vick
Ranch Hand
Posts: 3244
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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

 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic