-
Tri-state Checkboxes
Hey,
Over the weekend I was writing a search page and realised that a user needed to be able to select a field to be true, false, and don't care. Now, as we all know, html checkboxes are on/off only. I couldn't find one I liked, so I created a very simple javascript class to create and handle tri-state checkboxes.
It could still use some polishing (it uses images to render the checkbox, for example, and it could do with an image autoloader). The images it currently uses is firefox's checkbox, with some custom modifications. You can change these files to fit the style you need.
The link is a zip containing the javascript file tristate.js, which contains the class TriStateBox, along with an example html file to show you how to instantiate your own boxes, and a folder containing the necessary images.
Tristate Checkbox
Hope it's helpful
-
Hi, Kazar.
Thanks for the post. This should probably go in the DD script submission forum, though I'm not positive you want to submit it. Should I move it?
-
Yeah, thanks - I'm just new, not sure where everything goes
-
Well, if it isn't finished, it really should stay out here in the general forum.
-
Well, it works, it's just at version 1.0, not 2.0
-
Ok, it's been moved then.
Tested as well. I like it. The style doesn't look like FF (at least not as I'm used to it), but I don't mind the look. having it differ could help the user understand as well.
The problem I see with such a script is explaining it to the user, and what happens if javascript isn't enabled. A dropdown or radio set could do the same thing, using standard methods.
Aside from that, though, nice.
-
The problem with explaining is evident - it could maybe do with more obvious negative, postive images.
-
Perhaps [ ], [?], and [√] would be best.
-
That is wise, although that would require the default state to be [?] - means perhaps that users would register it as different i guess
-
Not necessarily. You could have it blank, then they click, get the [?] and figure it out from there.
However, that's a making a few assumptions.
It would be a very nice feature, but I'm not sure it really is practical, considering what users are used to.