C
Claire
Hello,
I am having a problem in my struts application with the checkboxes in
my form. I have an array of checkboxes, some of which may be already
selected when the form loads. My problem is when the user then
deselects one or more of these checkboxes and submits the form -
they're being submitted as if they were still checked, when the user
has infact deselected them.
I've heard that this is a common problem, but I don't seem to be able
to find the problem / resolution with any search criteria. If anybody
knows the fix for this it would be greatly appreciated (preferably
without having to use Javascript)
Many Thanks, Claire
Here's the HTML for the checkbox part of the form when it's initially
loaded.
<table style="width:50%;" cellpadding="0" cellspacing="0">
<tr class="spreadsheetvalue">
<td align="left" width="85%">Red</td>
<td align="left" width="15%">
<input type="checkbox" name="cust[0].add" value="on"
checked="checked">
</td>
</tr>
<tr class="spreadsheetvalue">
<td align="left" width="85%">Orange</td>
<td align="left" width="15%">
<input type="checkbox" name="cust[1].add" value="on"
checked="checked">
</td>
</tr>
<tr class="spreadsheetvalue">
<td align="left" width="85%">Yellow</td>
<td align="left" width="15%">
<input type="checkbox" name="cust[2].add" value="on"
checked="checked">
</td>
</tr>
<tr class="spreadsheetvalue">
<td align="left" width="85%">Green</td>
<td align="left" width="15%">
<input type="checkbox" name="cust[3].add" value="on">
</td>
</tr>
<tr class="spreadsheetvalue">
<td align="left" width="85%">Blue</td>
<td align="left" width="15%">
<input type="checkbox" name="cust[4].add" value="on">
</td>
</tr>
<tr class="spreadsheetvalue">
<td align="left" width="85%">Purpler</td>
<td align="left" width="15%">
<input type="checkbox" name="cust[5].add" value="on">
</td>
</tr>
</table>
I am having a problem in my struts application with the checkboxes in
my form. I have an array of checkboxes, some of which may be already
selected when the form loads. My problem is when the user then
deselects one or more of these checkboxes and submits the form -
they're being submitted as if they were still checked, when the user
has infact deselected them.
I've heard that this is a common problem, but I don't seem to be able
to find the problem / resolution with any search criteria. If anybody
knows the fix for this it would be greatly appreciated (preferably
without having to use Javascript)
Many Thanks, Claire
Here's the HTML for the checkbox part of the form when it's initially
loaded.
<table style="width:50%;" cellpadding="0" cellspacing="0">
<tr class="spreadsheetvalue">
<td align="left" width="85%">Red</td>
<td align="left" width="15%">
<input type="checkbox" name="cust[0].add" value="on"
checked="checked">
</td>
</tr>
<tr class="spreadsheetvalue">
<td align="left" width="85%">Orange</td>
<td align="left" width="15%">
<input type="checkbox" name="cust[1].add" value="on"
checked="checked">
</td>
</tr>
<tr class="spreadsheetvalue">
<td align="left" width="85%">Yellow</td>
<td align="left" width="15%">
<input type="checkbox" name="cust[2].add" value="on"
checked="checked">
</td>
</tr>
<tr class="spreadsheetvalue">
<td align="left" width="85%">Green</td>
<td align="left" width="15%">
<input type="checkbox" name="cust[3].add" value="on">
</td>
</tr>
<tr class="spreadsheetvalue">
<td align="left" width="85%">Blue</td>
<td align="left" width="15%">
<input type="checkbox" name="cust[4].add" value="on">
</td>
</tr>
<tr class="spreadsheetvalue">
<td align="left" width="85%">Purpler</td>
<td align="left" width="15%">
<input type="checkbox" name="cust[5].add" value="on">
</td>
</tr>
</table>