Tuesday, 1 August 2017

html - autocomplete attribute is not passing XHTML 1.0 Transitional validation, why?




I'm trying to cleanup my xhtml validation -- I'm running my pages through the W3C validator. For some puzzling reason it's not passing on input fields with the autocomplete="off" attribute:



            onblur="if(this.value=='')this.value=this.defaultValue;" class="searchbox" value="Search" />


I'm using this doctype:








And this is the validation error:



Line 410, Column 81: there is no attribute "autocomplete"



…li_search_1" type="text" autocomplete="off" onfocus="if(this.defaultValue==thi…



I thought this was okay with the W3C -- but, maybe it's still in "submission" phase?
http://www.w3.org/Submission/web-forms2/#autocomplete




Thoughts?


Answer



The Web forms specification has nothing to do with HTML 4 / XHTML. Sadly, autocomplete will not pass validation.



I think the only way to achieve valid HTML 4 /XHTML with autocomplete turned off is adding the attribute on page load using JavaScript. Sucks, I know - but I think it's the only way.


No comments:

Post a Comment

casting - Why wasn't Tobey Maguire in The Amazing Spider-Man? - Movies & TV

In the Spider-Man franchise, Tobey Maguire is an outstanding performer as a Spider-Man and also reprised his role in the sequels Spider-Man...