2 ms·
Even if you use AJAX forms for logging in or registering (I'd prefer you didn't but whatever), you should still use the proper form validation API for things li
by jeroenhd 7y ago
Even if you use AJAX forms for logging in or registering (I'd prefer you didn't but whatever), you should still use the proper form validation API for things like this. If you use the proper HTML API for gathering data properly, you're most likely not affected badly functionality wise; only your UI will be affected because the form will refuse to be posted without proper explanation.
If the change really does get bypassed by everyone, that only underlines the sad state of modern website design relying completely on javascript.
I'm not sure why they don't limit this to just passwords but I can imagine it's easier to change the behaviour for all form elements than it is to change the behaviour of just password fields.
- gruez 7y ago>Even if you use AJAX forms for logging in or registering (I'd prefer you didn't but whatever), you should still use the proper form validation API for things like this. You don't even need to use "the proper form validation API". It's as simple as changing your ajax call from an onclick (on the submit button) to an onsubmit (on the form).
- jeroenhd 7y agoAgreed. Though, as a developer, I like to extend the submission actions a little bit to make error messages fit in with the rest of the site and maybe suggest what to do in order to correct the input (e.g. remove letters from phone numbers, pick a better password, etc.) I do consider using the HTML5 form validation to be the proper validation API. Browser can do a lot without javascript and relying on their default behaviour is still making use of the validation API.
- unilynx 7y agoYou can do a lot with setCustomValidity to improve error messages while still using the rest of the HTML5 validation API.
- jeroenhd 7y agoYou're totally right, but the Firefox popover indicating what's going wrong doesn't go with some of the designs I make. On a bootstrap-based design I much prefer bootstrap-style error messages which are easy to do with Javascript, and the same is true for Material-based designs. I do think that people generally overlook the built-in form validation though, and I like to use them as a fallback for Javascriptless environments to ensure everyone can get proper validation.