Opened 8 years ago

Closed 5 years ago

Last modified 5 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: master
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 8 years ago.
8103.2.diff (3.3 KB) - added by Chris Beaven 6 years ago.
8103.3.diff (3.6 KB) - added by Simon Charette 5 years ago.
updated to trunk and moved tests out of doctest

Download all attachments as: .zip

Change History (13)

Changed 8 years ago by Chris Beaven

Attachment: 8103.diff added

comment:1 Changed 8 years ago by Chris Beaven

Has patch: set
Needs documentation: unset
Needs tests: unset
Owner: changed from nobody to Chris Beaven
Patch needs improvement: unset
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 Changed 8 years ago by Russell Keith-Magee

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 Changed 8 years ago by Chris Beaven

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')

Changed 6 years ago by Chris Beaven

Attachment: 8103.2.diff added

comment:4 Changed 5 years ago by Chris Beaven

Severity: Normal
Type: Bug

comment:5 Changed 5 years ago by Jacob

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.

Changed 5 years ago by Simon Charette

Attachment: 8103.3.diff added

updated to trunk and moved tests out of doctest

comment:6 Changed 5 years ago by Simon Charette

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

comment:7 Changed 5 years ago by Julien Phalip

Triage Stage: AcceptedReady for checkin

comment:8 Changed 5 years ago by Chris Beaven

Resolution: fixed
Status: assignedclosed

In [16848]:

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

comment:9 Changed 5 years ago by Chris Beaven

Thanks for updating the patch, charettes!

comment:10 Changed 5 years ago by Simon Charette

You're welcome!

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