How to manually intercept and submit form
-
I want to use reCaptcha but the integration into Contact Form loads recaptcha on every page which results in a poor page speed result.
Therefore, I have attempted to load the code manually as per the recaptcha site and ONLY on the contact page: https://developers.google.com/recaptcha/docs/v3
I load the scripts in the header ONLY IF I am on the contact page = OK
I add the attributes to the button through an action hook filter.
However, when the onSubmit callback is called, it does not submit the form and does not produce any errors.
Is there something in the way that contact form is submitted that renders this code unusable?
<script> function onSubmit(token) { document.getElementByClassName("wpcf7-form").submit(); } </script>
Viewing 3 replies - 1 through 3 (of 3 total)
Viewing 3 replies - 1 through 3 (of 3 total)
- The topic ‘How to manually intercept and submit form’ is closed to new replies.