bolt / boltforms

Bolt 3 Forms extension - Symfony interface and API for Bolt
http://bolt.cm
GNU General Public License v3.0
52 stars 57 forks source link

Two g-recaptcha in one page #72

Closed errogaht closed 8 years ago

errogaht commented 8 years ago

Hello! I have 2 boltforms with recaptcha. Im moved JS code for recaptcha to main js file, all works, but not PHP. When im submit one form - all forms grecaptcha fields are marked as incorrect. And im cant understand how BoltFormsExtension::twigBoltForms() make TWO calls of reCaptchaResponse() im submit only one form! im think problem is like reCaptchaResponse() send to google validation token from other form, from page, not form which i currently submit

GwendolenLynch commented 8 years ago

The recapture response get checked on a POST in the {{ boltforms() }} Twig call, so if you have two calls to that function, it will get called twice.

errogaht commented 8 years ago

Can you get recommendation how implement two boltforms() in one web-page with re-captcha on both forms?

GwendolenLynch commented 8 years ago

Not as the code is presently.

The Twig function itself was originally designed as a "HOWTO" example, as BoltForms itself was just supposed to be an API wrapper on top of Bolt and Symfony Forms… Things grew :laughing:

I've been thinking about this a bit over the last couple of days, and I think it definitely needs attention, and one of the TODOs on my list is AJAX submissions, so that might be a good time to revisit how this is handled too… I just need to find time.

errogaht commented 8 years ago

Thankyou for your answer, im try to do something for this thing. Maybe if it be usefull im post some code here for duscuss.

GwendolenLynch commented 8 years ago

:+1: