Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Autocapitalize attribute on input element (used for iOS) breaks validation

As can be seen here, Safari and Safari for the iPhone support all HTML elements, including deprecated elements and even some proprietary elements that were never part of any W3C specifications.

It's actually very useful including autocapitalize in the 'email' and 'website' fields in forms, as there's nothing so annoying as having to unselect the SHIFT key when filling in either of those two inputs. Doing this is trivial as all you need to do is add the autocapitalize=off attribute to the corresponding input, e.g.:

<label for="email">E-mail</label>
<input type="email" name="email" placeholder="[email protected]" autocapitalize="off" title="Enter your e-mail address" class="required email" id="email">

Both the iPhone and the iPad perfectly match keyboards to the attributes attached to the input element in forms. Unfortunately, this markup seems to break validation, with W3C responding with 'Attribute autocapitalize not allowed on element input at this point' when the above is set.

I suppose this isn't something to die for, but is there a way of including the attributes without breaking validation? Maybe I've got something wrong here.

like image 526
Donald Jenkins Avatar asked Mar 17 '11 00:03

Donald Jenkins


1 Answers

The comment by ughoavgfhw fully answers the question: as W3C specs stand at present, you can't include the autocapitalize attribute in your forms without breaking validation, so it's a case of weighing that inconvenience against that of users having to fumble through your forms clicking on the SHIFTkey on iOS.

I think this is one of those rare cases (inline styles being another) where it makes sense to put up with errors on one page, so long as they aren't symptomatic of anything gone wrong but just of W3C being a bit slow on the uptake.

like image 56
Donald Jenkins Avatar answered Oct 22 '22 01:10

Donald Jenkins