Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

captcha: allow for interception #967

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

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.

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.

None yet

1 participant