Re: [whatwg] [WF2] |min| and |max| number of selected |option|s

2008-11-05 Thread Ian Hickson
On Sat, 31 May 2008, Christoph P�per wrote:
 
 When using
 
   input type=checkbox
 
 or
 
   select multiple
 
 one somtimes wants to limit the number of selected check boxes or 
 options. I have no idea how to model this with |input|, but |select| 
 could adopt the |min| and |max| attributes. They would not limit the 
 content of |value| but the number of selected |option|s, which is 
 similar to what is already specified for file upload controls. A common 
 and special case would be setting the same value on both attributes to 
 require a certain number of options to be selected.
 
 I'd really like it if someone could come up with a way to make this work 
 with |input|, too.

Since this is a pretty specialised desire, and not one that we really want 
to encourage (it's somewhat sub-optimal UI), I think this is something we 
should leave up to scripts to enforce, using oninput=, 
setCustomValidity(), and so forth.

-- 
Ian Hickson   U+1047E)\._.,--,'``.fL
http://ln.hixie.ch/   U+263A/,   _.. \   _\  ;`._ ,.
Things that are impossible just take longer.   `._.-(,_..'--(,_..'`-.;.'

Re: [whatwg] [WF2] |min| and |max| number of selected |option|s

2008-07-05 Thread Matthew Paul Thomas

On Jun 11, 2008, at 1:08 PM, Lachlan Hunt wrote:


Christoph Päper wrote:

...
When using
  input type=checkbox
or
  select multiple
one somtimes wants to limit the number of selected check boxes or  
options.


Could you provide some examples of some sites that need to apply such  
limits, and show how people are currently achieving this?


Are there sites that use JavaScript to achieve this now, perhaps by  
listening for click events on the checkboxes, counting how many are  
checked and then preventing too many being checked.  Or are there  
sites that count how many are checked onsubmit to ensure there aren't  
too few or too many?

...


http://www.drugstore.com/qxc44_333181_sespider/sample_center/ 
sample_center.htm invites you to choose up to three free samples.  
Choosing more than three is detected after submission, returning you to  
the same page with an error message.


http://www.diggerslist.com/register.php asks you to choose up to  
three areas of specialty. This is handled using three option menus  
containing exactly the same options. Choosing the same option twice or  
thrice, though probably a human error, is accepted without complaint.


http://www.bbc.co.uk/wales/livinginwales/nameyourhouse/housename.swf  
invites you to specify up to three features of your house. The design  
annoyingly requires each choice to be confirmed separately followed by  
a Would you like to choose another? alert. It is implemented using  
Flash, though it would be easy to implement in HTML and JavaScript.


http://www.oup.com/elt/global/products/goodgrammarbook/menu/apretest/  
invites you to select up to five topics of English grammar using  
checkboxes. Whenever five checkboxes are checked, all unchecked  
checkboxes are disabled. It is implemented using Flash, though again it  
would be easy to implement in HTML and JavaScript.


http://members.c-span.org/Subscribe.aspx requires you to choose at  
least one of two alert types, and at least one of five programmes. In  
both cases, selecting zero is detected after submission, returning you  
to the same page with an error message.


http://www.nicelabel.com/Products/Product-Selector invites you to  
select at least one of four label types. Submitting the form with zero  
selected is detected using a script that reveals the text Please,  
choose at least one option. This text was there all the time, just  
hidden, so would be confusing in UAs that disregarded CSS.


A browser supplied with min= and max= attribute values could provide  
more consistent and timely error prevention in all these cases. One  
challenge would be conveying the minimum and maximum requirement where  
the form's initial selection was outside the allowed range (most  
commonly where a minimum is required but no options are selected by  
default); without having the site author's knowledge about where an  
error message can sensibly be inserted in the page, a browser might  
need to use tooltips or help balloons instead.


Cheers
--
Matthew Paul Thomas
http://mpt.net.nz/

---AV  Spam Filtering by M+Guardian - Risk Free Email (TM)---



Re: [whatwg] [WF2] |min| and |max| number of selected |option|s

2008-06-11 Thread Lachlan Hunt

Christoph Päper wrote:

Dear WHAT WG

When using

  input type=checkbox

or

  select multiple

one somtimes wants to limit the number of selected check boxes or 
options.


Could you provide some examples of some sites that need to apply such 
limits, and show how people are currently achieving this?


Are there sites that use JavaScript to achieve this now, perhaps by 
listening for click events on the checkboxes, counting how many are 
checked and then preventing too many being checked.  Or are there sites 
that count how many are checked onsubmit to ensure there aren't too few 
or too many?


--
Lachlan Hunt - Opera Software
http://lachy.id.au/
http://www.opera.com/


[whatwg] [WF2] |min| and |max| number of selected |option|s

2008-05-31 Thread Christoph Päper

Dear WHAT WG

When using

  input type=checkbox

or

  select multiple

one somtimes wants to limit the number of selected check boxes or  
options. I have no idea how to model this with |input|, but |select|  
could adopt the |min| and |max| attributes. They would not limit the  
content of |value| but the number of selected |option|s, which is  
similar to what is already specified for file upload controls. A  
common and special case would be setting the same value on both  
attributes to require a certain number of options to be selected.


I'd really like it if someone could come up with a way to make this  
work with |input|, too.