the checkbox and recaptcha mandatoriness get ignored.
I have Umbraco v7.13.1.
My js code:
$(document).ready(function () {
//Intercept Submit button in order to make ajax call instead of a postback
var $modalForm = $('.modal .umbraco-forms-form form');
$modalForm.preventDoubleSubmission();
console.log('preventDoubleSubmission');
});
// jQuery plugin to prevent double submission of forms
jQuery.fn.preventDoubleSubmission = function () {
$(this).on('submit', function (e) {
console.log('submit');
e.preventDefault();
var $form = $(this);
var $brochure = $form.parents(".modal").data("brochure");
if ($form.data('submitted') === true) {
console.log('submitted');
// Previously submitted - don't submit again
} else {
if ($form.valid()) {
console.log('valid');
// Mark it so that the next submit can be ignored
$form.data('submitted', true);
// Disabled button intil post
$form.find('[name="submitbtn"]').prop('disabled', true);
// Make ajax call form submission
$.ajax({
url: $form.attr('action'),
type: 'POST',
cache: false,
data: $form.serialize(),
success: function (result) {
console.log('success');
var thankYouMessage = $(result).find('.umbraco-forms-submitmessage').first();
//Handles edge case where Recaptcha wasn't checked
if (thankYouMessage.length == 0) {
console.log('error');
$(result).find('.field-validation-error').each(function (i, v) {
console.log($(v).text());
});
$form.data('submitted', false);
$form.find('[name="submitbtn"]').prop('disabled', false);
}
else {
$form.html(thankYouMessage);
console.log('thanks');
}
}
});
}
}
});
// Keep chainability
return this;
};
Also weird when I loop through the errors, the checkbox and captcha errors appears in console, but the actual nodes (span.field-validation-error) are missing:
Thanks for the response. You can test here on staging: https://staging.fortescuegardens.co.uk/
At the bottom of the page there is a download brochure button.
When you fill in Recaptcha is getting ignored, however in console log you can see the error message: "Please confirm you are a human".
Above there is the error message span which should be there but it isn't:
span.field-validation-error
It's a standard Recaptcha field in Umbraco forms, so yes, it's inside the form tag.
Checkbox and recaptcha validation ignored
Hi,
I have two forms on my page. A simple and one in a modal view. If I add these scripts to the page:
the checkbox and recaptcha mandatoriness get ignored.
I have Umbraco v7.13.1. My js code:
Also weird when I loop through the errors, the checkbox and captcha errors appears in console, but the actual nodes (span.field-validation-error) are missing:
Some help would be great.
Hi Levente
Could you share some HTML? Or is your trial already somewhere online?
I guess the Recaptcha is not inside the html FORM tag which disregards the MVC validation.
Kind regards
Hi Damiaan,
Thanks for the response. You can test here on staging: https://staging.fortescuegardens.co.uk/ At the bottom of the page there is a download brochure button. When you fill in Recaptcha is getting ignored, however in console log you can see the error message: "Please confirm you are a human". Above there is the error message span which should be there but it isn't: span.field-validation-error
It's a standard Recaptcha field in Umbraco forms, so yes, it's inside the form tag.
Amy more ideas maybe?
PS: If I remove
from the page, the recaptcha is working. But I need for the client form of course.is working on a reply...