'); window.zzpFormAnswer = firstRandom + secondRandom; } else { window.zzpFormAnswer = null; sendForm = true; } } else if ($(zzpFallbackAnswerId).attr("required") === "required") { if ($(zzpFallbackAnswerId).val() != window.formAnswer) { const firstRandom = Math.floor(Math.random() * 11); const secondRandom = Math.floor(Math.random() * 11); $(zzpFallbackAnswerId).attr("placeholder", firstRandom + " + " + secondRandom); $(zzpFallbackAnswerId).addClass("is-invalid"); window.formAnswer = firstRandom + secondRandom; $(zzpFallbackAnswerId).val(""); } else { $(zzpFallbackAnswerId).remove(); sendForm = true; } } else { sendForm = true; }*/ if (sendForm) { $(`${formId}--alert-info`).remove(); alertBox('form-sending-message', 'alert-info', 'Een moment geduld Uw aanmelding wordt verzonden...'); $('#loader-overlay').removeClass('d-none'); const formData = new FormData(); $.each($(`${formId} input, ${formId} select, ${formId} textarea`), function () { const fieldName = this.id !== '' ? this.id : this.name; let fieldValue = ''; if (this.type === 'checkbox') { fieldValue = this.checked; } else if (this.type === 'file') { const attachment = this.files[0]; if (attachment !== undefined || attachment !== null) { fieldValue = attachment; } } else { fieldValue = this.value; } formData.append(fieldName, fieldValue); }); $.ajax('/umbraco/surface/forms/jobformzzpapplication', { type: 'POST', enctype: 'multipart/form-data', cache: false, contentType: false, processData: false, data: formData, success: function (message) { $(`${formId}--alert-info`).remove(); if (message !== null) { alertBox('form-message-sent', 'alert-success', `Aanmelding verzonden! ${message}`); } $(formId)[0].reset(); }, error: function (data) { alertBox('form-message-failure', 'alert-danger', `Error! Er ging iets mis bij het verzenden van het bericht. Probeer het nogmaals of neem direct contact op met info@kizgroep.nl
Error code: ${data.status}`); }, complete: function () { $('#loader-overlay').addClass('d-none'); } }); } else { alertBox('form-persona-failure', 'alert-info', 'Je hebt nog niet bewezen dat je geen robot bent.'); } });