So this is what I have:
<script src="scripts/jquery-1.3.2.js" type="text/javascript"></script>
<script>
$().ready(function() {
var allVals = [];
$("input[name^=utType]").each(function() {
var input = $(this);
var name = input.attr('name');
var num = /\d+$/.exec(name)[0];
if ($(this).checked) {
allVals.push($(this).val());
alert(allVals);
}
});
});
</script>
and I have a form with:
<form action="" method="post">
<table width="70%" cellspacing="3" cellpadding="3">
<tr>
<td align="center">
<label>All</label><br />
<input type="checkbox" name="utType1" id="utType1" value="all">
</td>
<td align="center">
<label>E</label><br />
<input type="checkbox" name="utType1" id="utType1" value="e">
</td>
<td align="center">
<label>G</label><br />
<input type="checkbox" name="utType1" id="utType1" value="g">
</td>
<td align="center">
<label>S</label><br />
<input type="checkbox" name="utType1" id="utType1" value="w">
</td>
<td align="center">
<label>W</label><br />
<input type="checkbox" name="utType1" id="utType1" value="s">
</td>
</tr>
<tr>
<td align="center">
<label>All</label><br />
<input type="checkbox" name="utType2" id="utType2" value="all">
</td>
<td align="center">
<label>E</label><br />
<input type="checkbox" name="utType2" id="utType2" value="e">
</td>
<td align="center">
<label>G</label><br />
<input type="checkbox" name="utType2" id="utType2" value="g">
</td>
<td align="center">
<label>S</label><br />
<input type="checkbox" name="utType2" id="utType2" value="w">
</td>
<td align="center">
<label>W</label><br />
<input type="checkbox" name="utType1" id="utType1" value="s">
</td>
</tr>
</table>
</form>
Several things that I will need to do: if "All" is checked, check all the other checkboxes in the same <tr>
; if one of them is unchecked then uncheck the "all" checkbox in that row. Also, I have to store the checked values for each row with the id to process the form.
Grr, today is not my day.