Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

What’s a good client-side fallback for HTML5 form field validation?

I've seen many different suggestions for fallbacks for browsers who don't fully implement html5 forms (solutions involving Modernizr, YepNope, Jquery validate...) but I haven't managed to get anything to work effectively.

Essentially apart from adding a datepicker which I've managed to get going with Modernizr and JQuery datepicker all I really need to do is get the validation to work in all browsers (main priority is the email validation)

Chrome and FF everything seems to work natively, yet surprisingly Safari validates without a proper email address. IE obviously doesn't support it either

Could anyone help with a reasonably straightforward fallback (probably via Modernizr)?

Thanks

like image 742
onjegolders Avatar asked May 11 '11 10:05

onjegolders


People also ask

Which are the correct input restrictions used for validation purposes in HTML5?

Validation-related attributesThe value must be greater than or equal to the value. There must be a value (if set). Unless the step is set to the any literal, the value must be min + an integral multiple of the step. The number of characters (code points) must not be less than the value of the attribute, if non-empty.

Is HTML5 validation accessible?

Short Answer. Yes the standard HTML5 validation is accessible and will pass WCAG2. 1 AA, but you can do a lot better with some JavaScript.

What is client-side form validation?

When you enter data, the browser and/or the web server will check to see that the data is in the correct format and within the constraints set by the application. Validation done in the browser is called client-side validation, while validation done on the server is called server-side validation.

Which of the following does not help in validating form fields in an HTML5 form?

novalidate attribute is used in form tag to disable HTML5 based Form validation. After using novalidate in form tag, required and type based validation will not work.


1 Answers

Have you tried webshims lib? It's build on top of jQuery and I have implemented the forms chapter of HTML5 very accurately. You can find a list of supported attributes, properties and methods on the webforms site of webhims lib.

I would like to have some feedback on this.

cheers Alex

like image 104
alexander farkas Avatar answered Jan 02 '23 08:01

alexander farkas