Opened 16 years ago

Closed 13 years ago

Last modified 12 years ago

#8103 closed Bug (fixed)

Select widget should only allow for one selected option

Reported by: Chris Beaven Owned by: Chris Beaven
Component: Forms Version: dev
Severity: Normal Keywords:
Cc: Triage Stage: Ready for checkin
Has patch: yes Needs documentation: no
Needs tests: no Patch needs improvement: no
Easy pickings: no UI/UX: no

Description

According to http://www.w3.org/TR/html401/interact/forms.html#h-17.6.1 :

It is considered an error if more than one OPTION element has the selected attribute set and the SELECT element does not have the multiple attribute set.

Attachments (3)

8103.diff (7.8 KB ) - added by Chris Beaven 16 years ago.
8103.2.diff (3.3 KB ) - added by Chris Beaven 13 years ago.
8103.3.diff (3.6 KB ) - added by Simon Charette 13 years ago.
updated to trunk and moved tests out of doctest

Download all attachments as: .zip

Change History (13)

by Chris Beaven, 16 years ago

Attachment: 8103.diff added

comment:1 by Chris Beaven, 16 years ago

Has patch: set
Owner: changed from nobody to Chris Beaven
Status: newassigned
Triage Stage: UnreviewedReady for checkin

Patch with tests. It's a lot smaller in reality - it just cleans up some whitespace...

comment:2 by Russell Keith-Magee, 16 years ago

Triage Stage: Ready for checkinDesign decision needed

Isn't this fixing the problem at the wrong point? Isn't the real error the fact that you have a choices definition with a duplicated index value?

comment:3 by Chris Beaven, 16 years ago

But there's nothing wrong with that. Nothing in the spec says you can't have duplicated values for your options.

A common example, and one I was encountering, is using a separator between sections in your choices - ('', '-------'). All of these will get have the selected attribute currently (which also has the unfortunate side-effect of the last one being selected rather than the first empty option - e.g. ('', 'ALL')

by Chris Beaven, 13 years ago

Attachment: 8103.2.diff added

comment:4 by Chris Beaven, 13 years ago

Severity: Normal
Type: Bug

comment:5 by Jacob, 13 years ago

Easy pickings: unset
Triage Stage: Design decision neededAccepted
UI/UX: unset

Marking accepted. The patch no longer applies, but once it does the approach is fine so feel free to commit or mark RFC.

by Simon Charette, 13 years ago

Attachment: 8103.3.diff added

updated to trunk and moved tests out of doctest

comment:6 by Simon Charette, 13 years ago

I updated the patch to apply on trunk and moved tests out of doctest.

comment:7 by Julien Phalip, 13 years ago

Triage Stage: AcceptedReady for checkin

comment:8 by Chris Beaven, 13 years ago

Resolution: fixed
Status: assignedclosed

In [16848]:

Fixes #8103 -- Select widget should only allow for one selected option

comment:9 by Chris Beaven, 13 years ago

Thanks for updating the patch, charettes!

comment:10 by Simon Charette, 13 years ago

You're welcome!

Note: See TracTickets for help on using tickets.
Back to Top