W3C home > Mailing lists > Public > whatwg@whatwg.org > June 2010

[whatwg] select element should have a required attribute

From: Garrett Smith <dhtmlkitchen@gmail.com>
Date: Sat, 19 Jun 2010 11:46:16 -0700
Message-ID: <AANLkTimx0359rpbtquP6lX8rHEkFsyITmiMRXYIQ8vaq@mail.gmail.com>
On 6/19/10, Ashley Sheridan <ash at ashleysheridan.co.uk> wrote:
> On Fri, 2010-06-18 at 13:34 -0700, Garrett Smith wrote:
>> On 6/18/10, Garrett Smith <dhtmlkitchen at gmail.com> wrote:
>> > On 6/18/10, Ashley Sheridan <ash at ashleysheridan.co.uk> wrote:
>> >> On Fri, 2010-06-18 at 11:35 +0200, Mounir Lamouri wrote:
>> >>
>> [...]
>> >
>> > Implementations vary on actual behavior. See also:
>> > https://bug-20184-attachments.webkit.org/attachment.cgi?done=true&id=22519
>> >

That is the wrong URL to begin the test; instead, the following URL
must be used:

Looking closer, that test is no good. Doesn't run in IE anyway. Since
I made it, it's my fault and so I've attached a simpler test bug. The
simpler test is still not that good because it tests two things:
  1) is a SELECT with no name successful?
  2) is a disabled, selected OPTION in a SELECT successful?

 but it's not as bad as the other test, which did some complicated
onload stuff that made it hard to understand.

This test is also posted below, though with using "block" instead of
"inline-block" to show the results in more browsers.

>> The actual bug:
>> https://bugs.webkit.org/show_bug.cgi?id=20184
>> Garrett
> I'd expect a disabled control to still send the value it would have sent
> if it weren't disabled. A select element without a name shouldn't be
> sent, which I believe is the case with all form elements not given a
> name?

Controls that are disabled cannot be successful. Browser behavior
varies on what happens when a SELECT has a disabled OPTION selected.

To be successful, all form controls must have a name. FORM element
itself does not need to be given a name.

A better example, to be sent from a web server below, the results are:

   IE8, 9b, FF 2, FF 3.6,

   IE7 an below, Opera 10.5, Safari 4.

<html lang="en">
	<style type="text/css">
	h2 {
		display: none;
	#pass {
		background: #0f0;
	#fail {
		background: Red;
<form action="">
<select><option disabled>invalid</option></select>
<select><option disabled></option></select>
<select name="wrong"><option disabled
<input type='submit' id="done" name="done" value="Submit"/>
<h2 id="pass">PASS</h2>
<h2 id="fail">FAIL</h2>
<script type="text/javascript">
onload =  function() {
	var q = location.search,
		f = document.forms[0],
		id = document.getElementById('id');
	if(!/done/.test(q)) return;
	// Options with "disabled" or "invalid" value
	// are are failures here.
	if(q && /invalid|disabled/.test(q)) {
	  document.getElementById("fail").style.display = "block";
	} else {		
		document.getElementById("pass").style.display = "block";

Received on Saturday, 19 June 2010 11:46:16 UTC

This archive was generated by hypermail 2.4.0 : Wednesday, 22 January 2020 16:59:24 UTC