MktoForms2.loadForm("//viden.bdo.dk", "462-YQN-293", 1074, function (form) {
MktoForms2.$("#mktoForm").append(form.getFormElem());
});
MktoForms2.whenReady(function (form) {
captchaRender();
$('#g-recaptcha').prependTo($('.mktoButtonRow')[0]);
$('.mktoButton')[0].style.marginTop = '20px'
$(".mktoButton")[0].style.marginTop = "20px";
var formEl = form.getFormElem()[0];
var emailEl = formEl.querySelector("#Email");
var submitEl = formEl.querySelector("button[type='submit']");
var recaptchaEl = document.querySelector('.g-recaptcha');
var formElId = form.getId();
var submitButtonRow = formEl.querySelector(".mktoButtonRow");
form.onValidate(function (builtInValidation) {
var recaptchaResponse = grecaptcha.getResponse();
if (!recaptchaResponse) {
recaptchaEl.classList.add('mktoInvalid');
form.submittable(false);
alert("Please complete the reCaptcha and required fields before submitting.");
} else {
recaptchaEl.classList.remove('mktoInvalid');
form.addHiddenFields({
lastRecaptchaUserInput: recaptchaResponse,
lastRecaptchaEnabledFormID: formElId
});
form.submittable(true);
}
});
});
function captchaCallback(response) {
return new Promise(function (resolve) { return resolve(); });
}
function captchaRender() {
var recaptcha = grecaptcha.render("g-recaptcha", { sitekey: "XXXXXXXXXXXXXXXX", callback: captchaCallback });
}
$(function () {
marketoForm.init();
});