Add email and phone validation to request-access modal

This commit is contained in:
2026-05-14 06:29:37 +00:00
parent beb2781123
commit eb05bcac53
2 changed files with 17 additions and 0 deletions
+12
View File
@@ -175,11 +175,23 @@
const checked = [...document.querySelectorAll('#am-products input[type=checkbox]:checked')];
const products = checked.map(c => c.value);
const emailRe = /^[^\s@]+@[^\s@]+\.[^\s@]+$/;
const phoneRe = /^[\+\d][\d\s\-\(\)]{6,18}$/;
if (!name || !company || !email || !phone) {
errEl.textContent = 'Пожалуйста, заполните все обязательные поля';
errEl.style.display = 'block';
return;
}
if (!emailRe.test(email)) {
errEl.textContent = 'Введите корректный email';
errEl.style.display = 'block';
return;
}
if (!phoneRe.test(phone)) {
errEl.textContent = 'Введите корректный номер телефона';
errEl.style.display = 'block';
return;
}
btnSubmit.disabled = true;
btnSubmit.textContent = 'Отправка...';