WIP Поправил валидации на инпутах и баг с обновлением формы

This commit is contained in:
DwCay
2023-04-21 18:05:01 +03:00
parent 50409bbd95
commit 75402fb209
6 changed files with 54 additions and 53 deletions

View File

@@ -12,15 +12,8 @@ export function ruleOptionalFields(val, minLength, text) {
}
export function ruleEmailValue(val, text) {
return (
(val &&
val.length < 100 &&
val.includes("@") &&
val.match(/@(?=\S+)/) &&
val.match(/(?<=\S+)@/)) ||
text ||
false
);
const regExp = new RegExp(/^[^\s()<>@,;:/]+@\w[\w.-]+\.[a-z]{2,}$/i);
return (val && val.length < 100 && regExp.test(val)) || text || false;
}
export function ruleMaxLength(val, maxLength, text) {