I have been having a look at MVC3 Unobtrusive Validation.
Attributes such as these are attached to form input elements:
data-val="true" //declares that the element should be validated
data-val-required="this field is required" // required constraint + error message
data-val-number="this field must be a number" //number constraint + error message
data-val-range="this number must be in the range 1 to ten" // range constraint + error message
data-val-range-max="10" //range max value
data-val-range-min="1" //range min value
The blog posts I have read about MVC3 unobtrusive validation say that it is valid HTML5. However I have had a look in the W3C HTML5 spec and I don’t see these attributes there..
http://www.w3.org/TR/2011/WD-html5-20110525/
I like the Idea of what these attributes do, enabling client side jQuery validation. But are they valid HTML5? Or will they cause problems in browsers and for search engines?
They’re data attributes. Yes, they’re valid HTML5: