Code

Opened 6 years ago

Closed 3 years ago

Last modified 3 years ago

#8103 closed Bug (fixed)

Select widget should only allow for one selected option

Reported by: SmileyChris Owned by: SmileyChris
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 SmileyChris 6 years ago.
8103.2.diff (3.3 KB) - added by SmileyChris 4 years ago.
8103.3.diff (3.6 KB) - added by charettes 3 years ago.
updated to trunk and moved tests out of doctest

Download all attachments as: .zip

Change History (13)

Changed 6 years ago by SmileyChris

comment:1 Changed 6 years ago by SmileyChris

  • Has patch set
  • Needs documentation unset
  • Needs tests unset
  • Owner changed from nobody to SmileyChris
  • Patch needs improvement unset
  • Status changed from new to assigned
  • Triage Stage changed from Unreviewed to Ready for checkin

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

comment:2 Changed 6 years ago by russellm

  • Triage Stage changed from Ready for checkin to Design 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 6 years ago by SmileyChris

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 4 years ago by SmileyChris

comment:4 Changed 3 years ago by SmileyChris

  • Severity set to Normal
  • Type set to Bug

comment:5 Changed 3 years ago by jacob

  • Easy pickings unset
  • Triage Stage changed from Design decision needed to Accepted
  • 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 3 years ago by charettes

updated to trunk and moved tests out of doctest

comment:6 Changed 3 years ago by charettes

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

comment:7 Changed 3 years ago by julien

  • Triage Stage changed from Accepted to Ready for checkin

comment:8 Changed 3 years ago by SmileyChris

  • Resolution set to fixed
  • Status changed from assigned to closed

In [16848]:

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

comment:9 Changed 3 years ago by SmileyChris

Thanks for updating the patch, charettes!

comment:10 Changed 3 years ago by charettes

You're welcome!

Add Comment

Modify Ticket

Change Properties
<Author field>
Action
as closed
as The resolution will be set. Next status will be 'closed'
The resolution will be deleted. Next status will be 'new'
Author


E-mail address and user name can be saved in the Preferences.

 
Note: See TracTickets for help on using tickets.