Jump to content
Larry Ullman's Book Forums

Form Validation - Javascript Or Html5?


Recommended Posts

This book uses JS - what are the use cases and pros/cons of each?  (in addition to PHP server side validation of course)

 

I understand users can disable JavaScript... Can HTML5 validation be thwarted like JS?  If not, is it then better?  Isn't HTML5 approach less taxing from a resources perspective?

 

Thanks!

Link to comment
Share on other sites

HTML5 validation is only performed in newer browsers that recognize it.

It's completely ignored in older browsers.

 

JS validation will run in any browser that has JS enabled, but JS can be easily disabled in most browsers and because all JS code is client-side, any user can view your JS validation and try to find ways around it.

 

The best COA is to do all real validation on the server-side. That's not to say that you can't use client-side validation for a more responsive experience, but you should never rely on only client-side validation.

  • Upvote 2
Link to comment
Share on other sites

 Share

×
×
  • Create New...