[Web] Complain about non-email email fields

This commit is contained in:
andryyy
2020-01-10 20:49:07 +01:00
parent e76beebebb
commit 157d2579e4
2 changed files with 23 additions and 5 deletions

View File

@@ -99,6 +99,15 @@ $(document).ready(function() {
$(this).removeClass('inputMissingAttr');
}
}
if ($(this).attr("type") == 'email') {
var emailReg = /^([\w-\.]+@([\w-]+\.)+[\w-]{2,4})?$/;
if (!emailReg.test($(this).val())) {
invalid = true;
$(this).addClass('inputMissingAttr');
} else {
$(this).removeClass('inputMissingAttr');
}
}
if ($(this).attr("max")) {
if (Number($(this).val()) > Number($(this).attr("max"))) {
invalid = true;
@@ -191,6 +200,15 @@ $(document).ready(function() {
$(this).removeClass('inputMissingAttr');
}
}
if ($(this).attr("type") == 'email') {
var emailReg = /^([\w-\.]+@([\w-]+\.)+[\w-]{2,4})?$/;
if (!emailReg.test($(this).val())) {
invalid = true;
$(this).addClass('inputMissingAttr');
} else {
$(this).removeClass('inputMissingAttr');
}
}
if ($(this).attr("max")) {
if (Number($(this).val()) > Number($(this).attr("max"))) {
invalid = true;