Open For Registration
function onRecaptchaLoadCallback() {
var clientId = grecaptcha.render('contactus-inline-badge', {
'sitekey': '6LclkhoqAAAAAN0po3WqylDKN67deTTyI8DLdEBO',
'badge': 'inline',
'size': 'invisible'
});
grecaptcha.ready(function() {
grecaptcha.execute(clientId, {
action: 'ws_customform'
})
.then(function(token) {
// Verify the token on the server.
var recaptchaResponse = document.getElementById('recaptchaResponse');
recaptchaResponse.value = token;
});
});
}
// Function to check if all required fields are filled
function checkRequiredFields() {
let allFilled = true;
// Loop through each required field and check if it has a value
$('input[required]').each(function() {
if ($(this).val() === '') {
allFilled = false;
return false; // Break the loop if any required field is empty
}
});
return allFilled;
}
// Event listener for any input change on required fields
$('input[required]').on('input', function() {
if (checkRequiredFields()) {
if ($('#recaptchaResponse').val() === '') {
onRecaptchaLoadCallback();
}
}
});