Skip to content

Conversation

hjanuschka
Copy link

to allow captcha logic to be run BEFORE the submit happens,
in AJAX forms, check if PowerMailFormOverrideAjax exists
in the window. object, if so - call it and wait for it (promise)

this enables a clean interception of the ajax submit
as messing with multiple onSubmit handlers is a nightmare

to allow captcha logic to be run BEFORE the submit happens,
in AJAX forms, check if `PowerMailFormOverrideAjax` exists
in the `window.` object, if so - call it and wait for it (promise)

this enables a clean interception of the ajax submit
as messing with multiple onSubmit handlers is a nightmare
@hjanuschka
Copy link
Author

hjanuschka commented Feb 9, 2024

as a workaround - cloning and replacing the form node seem'd to work

var oldForm = document.querySelector('form');
var newForm = oldForm.cloneNode(true);
oldForm.parentNode.replaceChild(newForm, oldForm);
form = newForm;

edit: but this disables ajax :/

@hjanuschka
Copy link
Author

@mschwemer any chances you can take a look?
happy to discuss and change whatever is needed, as long as ajax allow's somehow to intercept/chain into.

@mschwemer
Copy link
Collaborator

As I am not FE guy, I asked my colleagues to review it.

We need to make sure, that's not breaking.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants