[html5] Placeholder attribute on date inputs and validation

Ian Hickson ian at hixie.ch
Wed Aug 4 14:06:40 PDT 2010

On Wed, 2 Jun 2010, Rob Crowther wrote:
> I notice from 4.10.7 that the placeholder attribute is not valid on any 
> of the date input types, so this produces an error at 
> html5.validator.nu:

>  <label for="exin">An input:</label>
>  <input id="exin" type="date" placeholder="2010-06-02">
> However it works just fine in Chromium 6 and Firefox 4 nightlies, and 
> Opera displays the date picker control [1].  Chromium does report the 
> input type as being 'date' but Firefox still thinks it's 'text'.
> My feeling is that if there are user agents that support the placeholder 
> attribute but don't display any special UI for the date input type then 
> using the placeholder to provide useful information to the user is 
> perfectly acceptable.  Other than it not being valid, is there anything 
> else I should be concerned about?

The main reason to discourage use of placeholder="" in this way is that it 
would encourage authors to do things like placeholder="2010-06-02" when 
the actual format the UA accepts is something else, which would just 
confuse users.

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

More information about the Help mailing list