Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > comp.lang.javascript > #16655
| From | "Jukka K. Korpela" <jkorpela@cs.tut.fi> |
|---|---|
| Newsgroups | comp.lang.javascript |
| Subject | Re: radiobuttons and checkboxes |
| Date | 2012-10-16 11:09 +0300 |
| Organization | A noiseless patient Spider |
| Message-ID | <k5j4o9$fl9$1@dont-email.me> (permalink) |
| References | <m-idnR5KbdOWc-HNnZ2dnUVZ_gadnZ2d@westnet.com.au> |
2012-10-16 8:17, Andrew Poulos wrote: > The user needs to select one or more items. I can't use radio button > sets because that limits you to only one selected item, but if I use > checkboxes it means users can have no selected items. HTML is really rather limited in issues like this. > My options are: > > 1. Use checkboxes and when the user submits the form tell them to make a > selection if no selection has been made. This seems the obvious choice > but I'd rather solve the problem with design rather than message boxes. I'm afraid there is no design solution other than checking that the user has selected at least one alternative. You could try to apply the principle of early error detection by checking the situation whenever any field after the set of checkboxes is focused on. But this might be confusing, and people don't always fill out forms sequentially. As a rule, checking on submit time (and, naturally, in server-side code, if the form data is submitted to a server) is sufficient - unless the page works in a stepwise, application-like manner where the set of checkboxes is one step, so that filling out the form is sequential in a forced manner. In such a setup, you could show just the checkboxes (and explanations) and provide a "Continue" button only after at least one choice has been made. > 2. Use checkboxes and don't let the user uncheck the last checked > checkbox in the set. This means that a checkbox may not behave as expected. And initially there is no checked checkbox, so this would not work to prevent the most common scenario: the user just skips the set of checkboxes without checking anything. > Or is there some other control that I can create/design that is > intuitive to use to achieve the same thing? Well, in theory you could use a <select> element with the attributes 'required' and 'multiple': <select required multiple size=5 name=sel> <option>foo <option>bar <option>zap <option>something <option>something else </select> However, this a) does not enforce the requirement "at least one" unless the browser supports the HTML5 attribute 'required' (though you can of course add such a check in JavaScript) b) on browsers that do support it, the user sees an implementation-dependent error message if he tries to proceed without making any choice c) <select> with 'multiple' means poor usability: users don't encounter them often, and there's little intuitiveness in the usage. -- Yucca, http://www.cs.tut.fi/~jkorpela/
Back to comp.lang.javascript | Previous | Next — Previous in thread | Next in thread | Find similar | Unroll thread
radiobuttons and checkboxes Andrew Poulos <ap_prog@hotmail.com> - 2012-10-16 16:17 +1100
Re: radiobuttons and checkboxes "Jukka K. Korpela" <jkorpela@cs.tut.fi> - 2012-10-16 11:09 +0300
Re: radiobuttons and checkboxes "Tom de Neef" <tdeneef@qolor.nl> - 2012-10-16 12:27 +0200
Re: radiobuttons and checkboxes "Jukka K. Korpela" <jkorpela@cs.tut.fi> - 2012-10-16 15:20 +0300
Re: radiobuttons and checkboxes Thomas 'PointedEars' Lahn <PointedEars@web.de> - 2012-10-16 21:02 +0200
Re: radiobuttons and checkboxes Scott Sauyet <scott.sauyet@gmail.com> - 2012-10-16 04:30 -0700
Re: radiobuttons and checkboxes SAM <stephanemoriaux.NoAdmin@wanadoo.fr.invalid> - 2012-10-16 16:44 +0200
Re: radiobuttons and checkboxes "Jukka K. Korpela" <jkorpela@cs.tut.fi> - 2012-10-16 19:32 +0300
Re: radiobuttons and checkboxes SAM <stephanemoriaux.NoAdmin@wanadoo.fr.invalid> - 2012-10-17 00:51 +0200
Re: radiobuttons and checkboxes JJ <jaejunks_at@_googlemail_dot._com> - 2012-10-16 14:58 +0000
Re: radiobuttons and checkboxes Matt McDonald <matt@fortybelow.ca> - 2012-10-16 12:00 -0400
Re: radiobuttons and checkboxes "Jukka K. Korpela" <jkorpela@cs.tut.fi> - 2012-10-16 19:30 +0300
Re: radiobuttons and checkboxes Denis McMahon <denismfmcmahon@gmail.com> - 2012-10-16 17:23 +0000
Re: radiobuttons and checkboxes Denis McMahon <denismfmcmahon@gmail.com> - 2012-10-16 17:33 +0000
Re: radiobuttons and checkboxes Thomas 'PointedEars' Lahn <PointedEars@web.de> - 2012-10-16 21:00 +0200
csiph-web