[whatwg] Is there any reason for the continued existence of enctype attribute at the form element

Ian Hickson ian at hixie.ch
Sun Oct 11 02:38:51 PDT 2009


On Mon, 5 Oct 2009, Mark Kaplun wrote:
>
> I have only learned now that there is a "text/plain" option that I have 
> never heard of, so maybe I'm wrong, but my impression is that there are 
> only two forms of form, a textual and a file upload. IMHO the browser 
> can inspect the form before submitting it and decide by itself what is 
> the correct encoding to use.
> 
> Can the use of this attribute be deprecated, be valid only for backward 
> compatibility?

On Mon, 5 Oct 2009, Boris Zbarsky wrote:
> 
> You can use multipart/form-data with a form that doesn't include any 
> file uploads (and people do this).  Presumably they might have reasons 
> for this (e.g. they happen to have a sane multipart MIME parsing library 
> and don't want to deal with the url-encoding mess the 
> application/x-www-form-urlencoded option produces.

On Tue, 6 Oct 2009, Mark Kaplun wrote:
>
> Fair enough. Can the spec be changed in regard to the default encoding, 
> and make it depend on the content of the form instead of being 
> application/x-www-form-urlencoded, and then like today, the enctype 
> attribute can be used to override the default encoding?

While I agree that it is probably an authoring error if the author 
included a type=file control on a page with the default enctype, I don't 
think the magic of changing the default in that case would help authors on 
the long run. Consider, for instance, an author who sets up his form with 
a file upload control, gets everything working, and then decides to remove 
the file upload control because they don't actually use it, or because 
it's optional and they want a script to add it dynamically. They might 
find that suddenly their form doesn't work, but as far as they are 
concerned all they did was remove a form control that wasn't used in the 
first place.

I think this would be too confusing.

-- 
Ian Hickson               U+1047E                )\._.,--....,'``.    fL
http://ln.hixie.ch/       U+263A                /,   _.. \   _\  ;`._ ,.
Things that are impossible just take longer.   `._.-(,_..'--(,_..'`-.;.'



More information about the whatwg mailing list