0

I have a list of items, each item having two checkboxes; available and purchased. The item can be available without being purchased. But it cannot not be purchased without it being available. Therefore, I want the user to be able to check purchased and have 'available' auto-checked if it isn't already. This is more as a visual aid to the user feedback since when the form is submitted I can then look to see if purchased was checked and then assume available is as well(since it should be).

<input type="checkbox" name="ua0" id="ua0" value="1" onclick="ub0.checked=true">
<input type="checkbox" name="ub0" id="ub0" value="1">

This almost works as I want. However, once you click on A and then B is auto-checked, if the user unchecks B manually then unchecks A, B gets rechecked. So perhaps, is there a way to only update B when A is being checked and not unchecked?

3
Contributors
5
Replies
17
Views
4 Years
Discussion Span
Last Post by pixelsoul
0

Almost, except that also unchecks both as well. Click box A, box B checks as well. Uncheck box A, box B still stays checked unless manually done so.

In other words, box B only inherits from box A if box A is checked (not unchecked)

0

That's funny, Isn't that what this is doing already?

<input type="checkbox" name="ua0" id="ua0" value="1" onclick="ub0.checked=true">
<input type="checkbox" name="ub0" id="ub0" value="1">
This topic has been dead for over six months. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.