Beverly, Thank you for your reply. I have completely given up with the selector input[type="checkbox'] as it seems just to not find it from the document tree. So, I instead used the class selectors that I had made for formatting, boxer and boxes like this:
Code:
$('.boxer').change(function(){
var which = $(this);
var checkbx = which.parent().next().find('.boxes'),
dis = checkbx.prop('checked');
checkbx.prop('checked', !dis);
});
And then I added the css rule to push the one that I didn't want to be visible off the page:
Code:
.offscreen {position: absolute;left: -999em;}
I'm sure that there are other jQuery/javascript ways that I haven't found, but this works for me, and I spent so much time on this one! Too bad there wasn't an example for this on the internet. I was surprised to later find that the second array was not sent in the POST action. Evidently when an input is disabled, even though the check shows in a greyed box, the array is also disabled, and this makes absolutely no sense because it is necessary. Without this second array, you cannot know if a box has been changed, because all POST arrays (radio buttons and check boxes) contain only the checked elements.
My final code for the checkboxes in the page (in php because there are a variable number of rows) is like this, just in case anyone is interested:
Code:
foreach($oldeliveries as $lineitem) {
echo '<tr>'."\n";
foreach($areas as $site) {
if($lineitem['profilenum'] == $site['profilenum']) {
$ckd1a = ($lineitem['emailtable'] == 0) ? '' : 'checked="checked"';
$ckd1b = ($lineitem['emailtable'] == 1) ? '' : 'checked="checked"';
$ckd2a = ($lineitem['emailplot'] == 0) ? '' : 'checked="checked"';
$ckd2b = ($lineitem['emailplot'] == 1) ? '' : 'checked="checked"';
echo '<td><input class="boxer" name="tablite['.$lineitem['profilenum'].']" type="checkbox" '.$ckd1a.'/></td>';
echo '<td><input class="boxes offscreen" name="untablite['.$lineitem['profilenum'].']" type="checkbox" '.$ckd1b.' /></td>';
echo '<td><input class="boxer" name="plotite['.$lineitem['profilenum'].']" type="checkbox" '.$ckd2a.' /></td>';
echo '<td><input class="boxes offscreen" name="unplotite['.$lineitem['profilenum'].']" type="checkbox" '.$ckd2b.' /></td>';
echo '<td class="boxes">'.$lineitem['profilenum'].'</td><td class="boxed">'.$site['note'].'</td>'."\n";
break;
}
}
echo "</tr>"."\n";
}
Bookmarks