gla
asked on
html table array checkboxes
am developing in JSP but need the following solution done in Javascript or java
What I need:
I have a html table which is created from a sql statement when the page loads
'select * from enrolle'
The table builds out to the following format:
Id CourceID
1 A
2 BC v
3 CC
4 D v
5 F2
etc
The v is a checkbox (or button if better), which the user stores the CourceID for that row.
I want to be able to select the checked checkboxes, and the corresponding table elements for that row will be stored in java variables for that row.
any idea?
Thanks
What I need:
I have a html table which is created from a sql statement when the page loads
'select * from enrolle'
The table builds out to the following format:
Id CourceID
1 A
2 BC v
3 CC
4 D v
5 F2
etc
The v is a checkbox (or button if better), which the user stores the CourceID for that row.
I want to be able to select the checked checkboxes, and the corresponding table elements for that row will be stored in java variables for that row.
any idea?
Thanks
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Aargh, the mental flow has been reversed!!!
you could just use one name for all checkboxes ;-)
>> Aargh, the mental flow has been reversed!!!
hahahaha :-D
hahahaha :-D
>> you could just use one name for all checkboxes
Yes, but it makes a nicer example (and a little easier to follow, but that was probably blown out of the water when I used the Enumeration to output them!)
Yes, but it makes a nicer example (and a little easier to follow, but that was probably blown out of the water when I used the Enumeration to output them!)
>> but that was probably blown out of the water when I used the Enumeration to output them!)
lol! :-D
lol! :-D
Thanks :-)
:-( Looks like the enumeration and multiple checkbox names method won :-(
Just assign them a value based on the row, and read the values out again...
ie:
<%
String[] selected = request.getParameterValues
for( int i = 0 ; i < selected.length ; i++ )
out.println( selected[ i ] + " WAS SELECTED</br>" ) ;
%>
<form>
<table>
<tr>
<td><input type="text" name="row0" value="whatever"/></td>
<td><input type="checkbox" name="check" value="0"/></td>
</tr>
<tr>
<td><input type="text" name="row1" value="blah"/></td>
<td><input type="checkbox" name="check" value="1"/></td>
</tr>
<tr>
<td><input type="text" name="row2" value="heh"/></td>
<td><input type="checkbox" name="check" value="2"/></td>
</tr>
</table>
<input type="submit" value="POST!"/>
</form>