Новый правки на сайте
This commit is contained in:
parent
a5d9de59b1
commit
89cfc834da
1 changed files with 53 additions and 4 deletions
|
|
@ -84,7 +84,7 @@ import { SITE_URL } from '@constants';
|
|||
required
|
||||
autocomplete="new-password"
|
||||
minlength="8"
|
||||
maxlength="12"
|
||||
maxlength="20"
|
||||
/>
|
||||
<button type="button" class="toggle-password" data-target="password">
|
||||
<svg class="eye-open" xmlns="http://www.w3.org/2000/svg" width="20" height="20" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round">
|
||||
|
|
@ -111,7 +111,7 @@ import { SITE_URL } from '@constants';
|
|||
required
|
||||
autocomplete="new-password"
|
||||
minlength="8"
|
||||
maxlength="12"
|
||||
maxlength="20"
|
||||
/>
|
||||
<button type="button" class="toggle-password" data-target="confirmPassword">
|
||||
<svg class="eye-open" xmlns="http://www.w3.org/2000/svg" width="20" height="20" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round">
|
||||
|
|
@ -134,7 +134,7 @@ import { SITE_URL } from '@constants';
|
|||
</label>
|
||||
</div>
|
||||
|
||||
<button type="submit" class="btn-submit">
|
||||
<button type="submit" class="btn-submit" disabled>
|
||||
Зарегистрироваться
|
||||
</button>
|
||||
</form>
|
||||
|
|
@ -611,11 +611,23 @@ import { SITE_URL } from '@constants';
|
|||
margin-top: 0.25rem;
|
||||
}
|
||||
|
||||
.btn-submit:hover {
|
||||
.btn-submit:hover {
|
||||
transform: translateY(-2px);
|
||||
box-shadow: 0 8px 20px rgba(206, 159, 64, 0.4);
|
||||
}
|
||||
|
||||
.btn-submit:disabled {
|
||||
background: #94a3b8;
|
||||
cursor: not-allowed;
|
||||
transform: none;
|
||||
box-shadow: none;
|
||||
}
|
||||
|
||||
.btn-submit:disabled:hover {
|
||||
transform: none;
|
||||
box-shadow: none;
|
||||
}
|
||||
|
||||
.btn-submit:disabled {
|
||||
opacity: 0.7;
|
||||
cursor: not-allowed;
|
||||
|
|
@ -1083,4 +1095,41 @@ if (result.success) {
|
|||
closePrivacyModal();
|
||||
}
|
||||
});
|
||||
|
||||
// Функция проверки всей формы
|
||||
function checkFormValidity() {
|
||||
const firstName = firstNameInput?.value.trim() || '';
|
||||
const lastName = lastNameInput?.value.trim() || '';
|
||||
const email = emailInput?.value.trim() || '';
|
||||
const password = passwordInput?.value || '';
|
||||
const confirmPassword = confirmPasswordInput?.value || '';
|
||||
const agreement = document.querySelector('input[name="agreement"]') as HTMLInputElement;
|
||||
|
||||
const isFirstNameValid = firstName.length > 0 && validateFirstName(firstName);
|
||||
const isLastNameValid = lastName.length > 0 && validateLastName(lastName);
|
||||
const isEmailValid = validateEmail(email);
|
||||
const isPasswordValid = validatePassword(password);
|
||||
const isConfirmValid = password === confirmPassword && confirmPassword.length > 0;
|
||||
const isAgreementValid = agreement?.checked || false;
|
||||
|
||||
const submitBtn = document.querySelector('.btn-submit') as HTMLButtonElement;
|
||||
if (submitBtn) {
|
||||
if (isFirstNameValid && isLastNameValid && isEmailValid && isPasswordValid && isConfirmValid && isAgreementValid) {
|
||||
submitBtn.disabled = false;
|
||||
} else {
|
||||
submitBtn.disabled = true;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// Добавляем обработчики на все поля для проверки формы
|
||||
firstNameInput?.addEventListener('input', checkFormValidity);
|
||||
lastNameInput?.addEventListener('input', checkFormValidity);
|
||||
emailInput?.addEventListener('input', checkFormValidity);
|
||||
passwordInput?.addEventListener('input', checkFormValidity);
|
||||
confirmPasswordInput?.addEventListener('input', checkFormValidity);
|
||||
document.querySelector('input[name="agreement"]')?.addEventListener('change', checkFormValidity);
|
||||
|
||||
// Начальная проверка при загрузке
|
||||
checkFormValidity();
|
||||
</script>
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue