Disable form submit in preview mode

[MAILPOET-2743]
This commit is contained in:
Rostislav Wolny
2020-04-15 18:35:49 +02:00
committed by Veljko V
parent ac359dacf1
commit e7b4ab1dfe

View File

@@ -123,6 +123,11 @@ jQuery(($) => {
});
form.parsley().on('form:submit', (parsley) => {
// Disable form submit in preview mode
const formDiv = form.parent('.mailpoet_form');
if (formDiv && formDiv.data('is-preview')) {
return false;
}
const formData = form.mailpoetSerializeObject() || {};
// check if we're on the same domain
if (isSameDomain(window.MailPoetForm.ajax_url) === false) {