简体   繁体   中英

form validation in mobile

When we are viewing our forms in mobile, I noticed that all validation goes away and I can simply submit my email address without any "@" or ".". I thought I had taken care of this with the pattern attribute and it works seamlessly on desktop, but not in mobile. Any ideas on what I'm doing wrong here?

   <input type="email" name="email" placeholder="type your email..." class="textInput defaultText required email input-text" pattern="/^[a-zA-Z0-9.!#$%&'*+/=?^_`{|}~-]+@[a-zA-Z0-9-]+(?:\.[a-zA-Z0-9-]+)*$/" />

For some reason most phone browsers don't prevent a form submission when there is invalid data, although most do support the API involved.

See http://www.telerik.com/blogs/four-options-for-mobile-form-validation#html5 for a good discussion

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM