W3C home > Mailing lists > Public > whatwg@whatwg.org > September 2009

[whatwg] Setting .value on <input type=file>

From: Jonas Sicking <jonas@sicking.cc>
Date: Tue, 15 Sep 2009 18:44:19 -0700
Message-ID: <63df84f0909151844i1093ef3rfa99b9cbe67ec5aa@mail.gmail.com>
Hi All,

Currently the spec says to throw an INVALID_ACCESS_ERR exception
anytime the 'value' IDL attribute is set. However allowing it to be
set to the empty string would be good.

The simplest use case is allowing the page to implement a 'cancel'
button. Many UAs (in fact all that I know of) don't have explicit UI
for clearing the field. In fact a quick test shows that at least
Firefox and Safari has no way to clear the field at all.

While the page can always delete the old input element and create a
new one, that is much more complicated. Especially if the element has
event listeners or user data associated with it.

Setting it to the empty string works in Firefox, Safari, and Chrome.
It does not appear to work in IE or Opera.

/ Jonas
Received on Tuesday, 15 September 2009 18:44:19 UTC

This archive was generated by hypermail 2.3.1 : Monday, 13 April 2015 23:08:52 UTC