0

So validation is part of HTML 5, but can and how does one implement with just html to trigger the error message once an input leaves focus and the content entered is not validated correctly? This goes for URL, email, number and ranges, etc... Does it require some pattern to make this work correctly?

Thanks much.

Mark
  • 1,812
  • 3
  • 29
  • 51
  • http://stackoverflow.com/questions/7548612/triggering-html5-form-validation – sinisake Oct 14 '14 at 06:44
  • you can find your answer here... http://stackoverflow.com/questions/16493797/fire-html5-email-validator-on-losing-focus-besides-just-on-submission-of-forms – FaheemFayaz Oct 14 '14 at 06:47

1 Answers1

1

Have a look at the data-val attributes, for example data-val-email. This is an attribute for the <input /> tag. And will validate your input, not sure if it is onLeave or on submit though..

For more data-val attributes have a look at: http://bodomvu.wordpress.com/2013/05/09/a-list-of-data-val-property/

Willem
  • 398
  • 1
  • 6
  • 23