Results 1 to 3 of 3
Thread: Arrays and checkboxes
Jul 17, 2006, 15:55 #1
- Join Date
- Oct 2004
- Hemet, CA
- 0 Post(s)
- 0 Thread(s)
Arrays and checkboxes
OK, I have been working on this for the last couple days and have made a lot of headway, but am still stuck on a spot. I have a group of checkboxes on my form that allow the user to select which items apply. I want to verify that at least one checkbox in each group has been selected before allowing them to continue. PHP requires the naming of the arrays to include the  but jsp (for verification) doesn't like it. I read about and used the .elements method to overcome part of that problem so my for loop is now executing for the number of items in my group:
for (var i=0; i<document.form1.elements['dining_out1'].length; i++)
however my if statement won't execute:
even if I have checked ALL checkboxes. I have tried all the different methods I can think of to test for a checked value on each item in the array, but I can't quite figure out what I am missing.
Any help will be greatly appreciated.
P.S. I had posted this to the Java and JSP forum and then realized it should actually be here so I am reposting it, and if possible I will now go delete my other thread. Sorry for the crosspost... been a longtime lurker, just now feel like I am getting into the code deep enough to ask some decent questions!