acf-recaptcha icon indicating copy to clipboard operation
acf-recaptcha copied to clipboard

Issues with Multiple Recaptchas

Open UnaOmnia opened this issue 7 years ago • 6 comments

I have a page template with acf_form() on it twice. Once is 'form'=> false BECAUSE it is inside another form. How can I get that to work?

UnaOmnia avatar Apr 01 '18 02:04 UnaOmnia

Nevermind, I got it to work.

What I did was make two separate field groups, and added the recaptcha field to each, AND THEN somehow it was no problem.

AS IN one field group for your form, and TWO field groups with recaptchas for the page the form appears on. Not sure why, but it works.

UnaOmnia avatar Apr 01 '18 02:04 UnaOmnia

I'm not sure why you need to call acf_form() twice - that would trigger the validation of the same reCAPTCHA code twice, which would obviously fail on the second time.

Perhaps you can show me a screenshot or some code to illustrate your setup?

irvinlim avatar Apr 02 '18 12:04 irvinlim

Well, it is because I had two forms on one page. So to avoid using the same recaptcha I made ANOTHER fields that IS ALSO a recaptcha.

I no longer need two forms on one page. So, now I only need one recaptcha. Maybe you could leave instructions for others on how to have two instances of acf_form and whether or not the recaptcha in them has to be a different fields etc.

http://cnyc.unaomnia.com/list/show/

Won't be at that address long but that is what I am making.

UnaOmnia avatar Apr 02 '18 16:04 UnaOmnia

Sorry, I misunderstood what you said earlier, I thought you were referring to acf_form_head() (I haven't touched WordPress in months). Correct, you should be able to have multiple forms (using multiple acf_form()s) on the same page and acf-recaptcha should still work.

What is the error you are getting?

irvinlim avatar Apr 02 '18 17:04 irvinlim

I'm having this exact problem. I have 2 forms in a modal, loaded in the footer. They're interfering. See the added image for the error.

schermafbeelding 2018-05-07 om 09 19 47

wiljeonline avatar May 07 '18 07:05 wiljeonline

I'll take a look at this after my exams, maybe next week. Any chance you can come up with a minimal PoC in the mean time would be great.

If you wanna submit a PR that'll be even better!

irvinlim avatar May 08 '18 11:05 irvinlim