Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > comp.lang.javascript > #16668

Re: radiobuttons and checkboxes

Message-ID <337611277.18NyDrsYic@PointedEars.de> (permalink)
From Thomas 'PointedEars' Lahn <PointedEars@web.de>
Organization PointedEars Software (PES)
Date 2012-10-16 21:00 +0200
Subject Re: radiobuttons and checkboxes
Newsgroups comp.lang.javascript
References <m-idnR5KbdOWc-HNnZ2dnUVZ_gadnZ2d@westnet.com.au>
Followup-To comp.lang.javascript

Followups directed to: comp.lang.javascript

Show all headers | View raw


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.
> 
> 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.

You can and should mark obvious errors in the form *before* the form has 
been submitted.  The "message box" could then be limited to a friendly 
reminder in the document.

> 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.

You could record the first unchecked/checked checkbox and check/uncheck that 
when a third checkbox is about to be unchecked/checked.  However, it is 
probably best to display a message explaining why selecting no item or too 
many items does not make sense, if and when the user tried to do that.  And 
to prevent submission of the form when an obviously erroneous form is about 
to be submitted, and explaining – by marking the errors – why submitting it 
has failed.
 
> Or is there some other control that I can create/design that is
> intuitive to use to achieve the same thing?

There is also

  <select … multiple>
    <option …>
    …
  </select>

But if your users are using a pointing device, they will probably need a 
keyboard also, in particular the Ctrl/Cmd or Space key.  So this is not as 
accessible as the solution above, maybe not as intuitive and could well be 
considered overkill for a short list of options.


PointedEars
-- 
> If you get a bunch of authors […] that state the same "best practices"
> in any programming language, then you can bet who is wrong or right...
Not with javascript. Nonsense propagates like wildfire in this field.
  -- Richard Cornford, comp.lang.javascript, 2011-11-14

Back to comp.lang.javascript | Previous | Next — Previous in thread | Find similar | Unroll thread


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