Hey guys, I'm looking for a nice tri-state checkbox controller in JS ? Got anything to recommend me?
The states I'm looking for are
- Checked
- Unchecked
- Indifferent (Was never checked/unchecked)
Hey guys, I'm looking for a nice tri-state checkbox controller in JS ? Got anything to recommend me?
The states I'm looking for are
Use radio buttons.
<input type="radio" name="tristate" value="checked" />Checked
<input type="radio" name="tristate" value="unchecked" />Unchecked
If none if the radios are turned on, then you have your third "indifferent" or null state.
You may want to look into EXTJS.
They have a big community that often builds things like this and I'm sure if you googled for one it might come up. Actually here you go you may be able to make a few changes to this and get it to work how you want:
http://extjs.net/forum/showthread.php?t=28096
Hope this helps!
If you need more than two states, then use 3 radio buttons.
Don't assume if the user didn't select anything to mean the third state. What if the user missed the question all together, or hit submit by mistake?
If you want 3 states, then have 3 states!