Html5 form validation not working with iphone, android or safari

后端 未结 5 1643
执念已碎
执念已碎 2021-02-08 02:34

I am trying to implement html5 form validation for my web app but it\'s not working with safari 5.0.1 , iphone3 or android2. Is the form input attribute required, pattern or any

5条回答
  •  面向向阳花
    2021-02-08 03:14

    In order to be as cross-browser friendly as possible, you should always code with the expectation that the client platforms will not have support for newer things, like HTML5 validation. So, while leveraging the capabilities of newer browsers is great and lets you give your users a much nicer experience, it is still important to remember that not everyone has the same capabilities.

    That being said, any sort of validation you do in the browser (with Javascript or HTML5) is only a convenience for the user and a savings on calls back to the server. You should ALWAYS implement validation on the server because it is very easy to circumvent client-side validation. My preferred way of developing is to do the validation entirely server-side first, and then once that is solid, add in javascript--based, and then HTML5-based validation, using a "progressive development" approach to progressive enhancement.

提交回复
热议问题