Bug 20184 - SELECT with no name generates invalid query string
Summary: SELECT with no name generates invalid query string
Status: RESOLVED FIXED
Alias: None
Product: WebKit
Classification: Unclassified
Component: Forms (show other bugs)
Version: 525.x (Safari 3.1)
Hardware: All All
: P2 Normal
Assignee: Alexey Proskuryakov
URL:
Keywords: HasReduction, InRadar
: 19005 21478 (view as bug list)
Depends on:
Blocks:
 
Reported: 2008-07-27 00:24 PDT by Garrett Smith
Modified: 2011-05-20 08:49 PDT (History)
5 users (show)

See Also:


Attachments
Test Case Showing Problem (1.07 KB, text/html)
2008-07-27 00:33 PDT, Garrett Smith
no flags Details
Test Case Showing Problem (1.22 KB, text/html)
2008-07-27 00:44 PDT, Garrett Smith
no flags Details
Test Case Showing Problem (1.17 KB, text/html)
2008-07-27 20:33 PDT, Garrett Smith
no flags Details
Test Case Showing Problem (1.17 KB, text/html)
2008-07-27 22:13 PDT, Garrett Smith
no flags Details
Test Case Showing Problem (1.37 KB, text/html)
2008-07-27 23:05 PDT, Garrett Smith
no flags Details
proposed fix (4.47 KB, patch)
2009-02-16 06:54 PST, Alexey Proskuryakov
darin: review+
Details | Formatted Diff | Diff
Simpler testcase. (1.02 KB, text/html)
2010-06-19 11:31 PDT, Garrett Smith
no flags Details

Note You need to log in before you can comment on or make changes to this bug.
Description Garrett Smith 2008-07-27 00:24:51 PDT
A SELECT element with no name is submitted. 
A SELECT with a selected, disabled OPTION submits the disabled OPTION.

This results in the unsuccessful controls generating values in query strings and invalid query strings:

 ?=invalid&=&wrong=disabled#done

 *  "invalid" is the selected OPTION of a SELECT that has no name
 * "&=" is the selected OPTION with no value of a SELECT that has no name
 * "wrong=disabled" is the selected OPTION with the value "disabled" of a SELECT with the name "wrong"

Instead, the submit with no name should not be submitted and disabled OPTIONS should not be submitted.

If the selected option does not have a value, the browser may consider the select to be unsuccessful. This would result in either the query string "wrong=" or no query string. 

If there is no OPTION selected, the browser may select the first OPTION or the first enabled OPTION. This would result in the test case:
 1) (no query string)
 2) wrong=enabled (only if the enabled OPTION were default selected).

|  If a control doesn't have a current value when the form is 
| submitted user agents are not required to treat it as a successful 
| control." [1]

[1] HTML 4.01, Forms, Successful Controls.
http://www.w3.org/TR/html401/interact/forms.html#h-17.13.2
Comment 1 Garrett Smith 2008-07-27 00:33:38 PDT
Created attachment 22499 [details]
Test Case Showing Problem

?=invalid&=&wrong=disabled#done

Also of note: in Firefox, the disabled options are not selected unless they have the selected attribute. This is perfectly valid and affords the developer more control and flexibility.

Safari Version 3.1.1 (4525.18), navigator.userAgent: 
Mozilla/5.0 (Macintosh; U; PPC Mac OS X 10_4_11; en) AppleWebKit/525.18 (KHTML, like Gecko) Version/3.1.1 Safari/525.18
Comment 2 Garrett Smith 2008-07-27 00:44:46 PDT
Created attachment 22501 [details]
Test Case Showing Problem

Bring in the bug id "id=" param for bugs.webkit.org bug id.
Comment 3 Mark Rowe (bdash) 2008-07-27 00:57:47 PDT
<rdar://problem/6104686>
Comment 4 Garrett Smith 2008-07-27 20:33:12 PDT
Created attachment 22512 [details]
Test Case Showing Problem
Comment 5 Garrett Smith 2008-07-27 22:13:28 PDT
Created attachment 22517 [details]
Test Case Showing Problem
Comment 6 Garrett Smith 2008-07-27 23:05:34 PDT
Created attachment 22519 [details]
Test Case Showing Problem
Comment 7 Gérard Talbot 2008-08-31 17:24:36 PDT
There is an identical bug at bugs.kde.org:
B u g 148981: Do not submit disabled option in combobox
https://bugs.kde.org/show_bug.cgi?id=148981
Comment 8 Alexey Proskuryakov 2009-02-16 06:54:08 PST
Created attachment 27697 [details]
proposed fix

This patch fixes the "select with no name" issue. As far as "disabled selected option" goes, this is a separate issue that needs to be discussed in a separate bug, especially since we match IE behavior here.
Comment 9 Alexey Proskuryakov 2009-02-23 00:46:47 PST
Comment on attachment 27697 [details]
proposed fix

Oops, I clicked the wrong option when submitting the patch! Marking for review now.
Comment 10 Darin Adler 2009-02-23 00:55:01 PST
Comment on attachment 27697 [details]
proposed fix

r=me
Comment 11 Alexey Proskuryakov 2009-02-23 01:23:21 PST
Committed revision 41135.

Comment 12 Alexey Proskuryakov 2009-03-02 03:56:35 PST
*** Bug 19005 has been marked as a duplicate of this bug. ***
Comment 13 Garrett Smith 2010-06-19 11:31:38 PDT
Created attachment 59190 [details]
Simpler testcase.

Submitting better testcase to FIXED bug for future reference/clarity -- the previous testcase was confusing.
Comment 14 Alexey Proskuryakov 2011-05-20 08:49:17 PDT
*** Bug 21478 has been marked as a duplicate of this bug. ***