Кнопка отправки отключена до тех пор, пока не будет решена recaptcha. Но теперь форма не подтверждается до тех пор, пока не будет решена Recaptcha. Как мне настроить так, чтобы форма проверила до того, как решается Recaptcha, но не отправляется в форму?
>
< /code>
javascript < /h3>
function enableBtn() {
var response = grecaptcha.getResponse();
var $result = $('#myParagraph');
if(response.length === 0) {
$result.text("reCaptcha not verified");
}
else {
$result.text("reCaptcha Verified");
document.getElementById("g-recaptcha-response").setAttribute('value', response);
document.getElementById("button1").disabled = false;
}
}
< /code>
это то, что я попробовал < /h2>
html < /h3>
Submit
< /code>
javascript < /h3>
function checkInputs() {
const input1 = document.getElementById('input1').value;
const input2 = document.getElementById('input2').value;
const input3 = document.getElementById('input3').value;
const submitBtn = document.getElementById('submitBtn');
if (input1.trim() !== '' || input2.trim() !== '' || input3.trim() !== '') {
submitBtn.disabled = false; // Enable the button
} else {
submitBtn.disabled = true; // Keep the button disabled
}
}
// Initial check when the page loads (in case inputs are pre-filled)
document.addEventListener('DOMContentLoaded', checkInputs);
< /code>
Это то, что я имею для проверки на стороне клиента < /p>
$(document).ready(function() {
$("#emailForm").validate({
rules: {
contributor: {
required: true
},
email: {
required: true,
email: true
},
password: {
required: true,
minlength: 3
},
password_confirm: {
required: true,
equalTo: "#password"
}
},
messages: {
contributor: "Please enter your name",
email: {
required: "Please enter your email address",
email: "Please enter a valid email address"
},
password: {
required: "Please enter a password",
minlength: "Your password must be at least 3 characters long"
},
password_confirm: {
required: "Please confirm your password",
equalTo: "Passwords do not match"
}
}
});
});
Подробнее здесь: https://stackoverflow.com/questions/797 ... form-doesn
Кнопка отправки отключена, пока не будет решена Recaptcha. Но теперь форма не подтверждается, пока не будет решена Recap ⇐ Jquery
Программирование на jquery
1758493282
Anonymous
Кнопка отправки отключена до тех пор, пока не будет решена recaptcha. Но теперь форма не подтверждается до тех пор, пока не будет решена Recaptcha. Как мне настроить так, чтобы форма проверила до того, как решается Recaptcha, но не отправляется в форму?
>
< /code>
javascript < /h3>
function enableBtn() {
var response = grecaptcha.getResponse();
var $result = $('#myParagraph');
if(response.length === 0) {
$result.text("reCaptcha not verified");
}
else {
$result.text("reCaptcha Verified");
document.getElementById("g-recaptcha-response").setAttribute('value', response);
document.getElementById("button1").disabled = false;
}
}
< /code>
это то, что я попробовал < /h2>
html < /h3>
Submit
< /code>
javascript < /h3>
function checkInputs() {
const input1 = document.getElementById('input1').value;
const input2 = document.getElementById('input2').value;
const input3 = document.getElementById('input3').value;
const submitBtn = document.getElementById('submitBtn');
if (input1.trim() !== '' || input2.trim() !== '' || input3.trim() !== '') {
submitBtn.disabled = false; // Enable the button
} else {
submitBtn.disabled = true; // Keep the button disabled
}
}
// Initial check when the page loads (in case inputs are pre-filled)
document.addEventListener('DOMContentLoaded', checkInputs);
< /code>
Это то, что я имею для проверки на стороне клиента < /p>
$(document).ready(function() {
$("#emailForm").validate({
rules: {
contributor: {
required: true
},
email: {
required: true,
email: true
},
password: {
required: true,
minlength: 3
},
password_confirm: {
required: true,
equalTo: "#password"
}
},
messages: {
contributor: "Please enter your name",
email: {
required: "Please enter your email address",
email: "Please enter a valid email address"
},
password: {
required: "Please enter a password",
minlength: "Your password must be at least 3 characters long"
},
password_confirm: {
required: "Please confirm your password",
equalTo: "Passwords do not match"
}
}
});
});
Подробнее здесь: [url]https://stackoverflow.com/questions/79771060/the-submit-button-is-disabled-until-recaptcha-is-solved-but-now-the-form-doesn[/url]
Ответить
1 сообщение
• Страница 1 из 1
Перейти
- Кемерово-IT
- ↳ Javascript
- ↳ C#
- ↳ JAVA
- ↳ Elasticsearch aggregation
- ↳ Python
- ↳ Php
- ↳ Android
- ↳ Html
- ↳ Jquery
- ↳ C++
- ↳ IOS
- ↳ CSS
- ↳ Excel
- ↳ Linux
- ↳ Apache
- ↳ MySql
- Детский мир
- Для души
- ↳ Музыкальные инструменты даром
- ↳ Печатная продукция даром
- Внешняя красота и здоровье
- ↳ Одежда и обувь для взрослых даром
- ↳ Товары для здоровья
- ↳ Физкультура и спорт
- Техника - даром!
- ↳ Автомобилистам
- ↳ Компьютерная техника
- ↳ Плиты: газовые и электрические
- ↳ Холодильники
- ↳ Стиральные машины
- ↳ Телевизоры
- ↳ Телефоны, смартфоны, плашеты
- ↳ Швейные машинки
- ↳ Прочая электроника и техника
- ↳ Фототехника
- Ремонт и интерьер
- ↳ Стройматериалы, инструмент
- ↳ Мебель и предметы интерьера даром
- ↳ Cантехника
- Другие темы
- ↳ Разное даром
- ↳ Давай меняться!
- ↳ Отдам\возьму за копеечку
- ↳ Работа и подработка в Кемерове
- ↳ Давай с тобой поговорим...
Мобильная версия