Thursday, November 21

Tag: POSTing an Indeterminate Checkbox Value

CSS Tricks

POSTing an Indeterminate Checkbox Value

There is a such thing as an indeterminate checkbox value. It's a checkbox (<input type="checkbox">) that isn't checked. Nor is it not checked. It's indeterminate. We can even select a checkbox in that state and style it with CSS! Some curious points though: It's only possible to set via JavaScript. There is no HTML attribute or value for it. It doesn't POST (or GET or whatever else) or have a value. It's like being unchecked.   So, say you had a form like this: <form action="" method="POST" id="form"> <input name="name" type="text" value="Chris" /> <input name="vegetarian" type="checkbox" class="veg"> <input type="submit" value="Submit"> </form> And, for whatever reason, you make that checkbox indeterm...