Html5 requires validation to work fine in browser, but not phonegap application

I am developing an application on the phone (v 5.1.1) and use the phone application to test locally on android. I created the form in html and for verification purposes I used the required property. In the browser (firefox, chrome) it works fine, as it should be, while on the mobile phone it does not confirm anything. and obeys. Why is this happening? Is html5 required to support Android.

<form id="LoginForm" action=""> <input type="email" name="email" id="inputEmail3" placeholder="Email" required> <input type="password" name="pwd" id="inputPassword3" placeholder="Password" required> <button type="submit">Sign in</button> </form> 

Thanks.

+7
javascript android html5 cordova
source share
2 answers

You are running Android 4.2.2, and the β€œrequired” / verification form is not supported properly until newer versions of Android. Here caniuse.com has a good support matrix .

To cover all versions of Android, you can use β€œmandatory”, but not rely on it, and also protect the code for missing values ​​in your JavaScript when the user submits the form.

+3
source share

An interesting situation for iOS: it is now supported in Safari Mobile , and when used with the "Add to Home Screen" function, however, after the application is built using Cordoba, the verification is simply ignored .

Tested for the required attribute, the same device, almost the same navigator.userAgent :

Browser navigator.userAgent :

Mozilla / 5.0 (iPhone, iPhone OS 11_2, like Mac OS X) AppleWebKit / 604.4.7 (KHTML, e.g. Gecko) Version /11.0 Mobile / 15C107 Safari / 604.1

Cordoba app navigator.userAgent :

Mozilla / 5.0 (iPhone, iPhone with iPhone 11_2, like Mac OS X) AppleWebKit / 604.4.7 (KHTML, e.g. Gecko) Mobile / 15C107

0
source share

All Articles