-
Notifications
You must be signed in to change notification settings - Fork 56
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
Doesn't work with Phoenix Live View #68
Comments
I feel like I need to update the recaptcha result with an |
Hi @michaelforrest! I hope it can helps you. Although is not complicated, I leave here the code in case it can helps to illustrate what I explained: <div phx-update="ignore">
<%= raw Recaptcha.Template.display(hl: "es") %>
</div> |
Thanks @ivanhercaz - I wasn't aware of |
Thanks @ivanhercaz! This should really be added to the documentation. |
I'm struggling to get this to work with Phoenix Live View.
The live view submit handler is called before the recaptcha javascript can go through its sequence and update the form with a
g-recaptcha-response
field.Here I'm inspecting the form generated with a
phx_submit
callback. The second handler is recaptcha's code, but the form has already been handled via live view by the time it gets torecaptchaCallback
I'm looking into live view's JS interoperability features but I'm not seeing a hook function that can be inserted before the submit event.
Actually it doesn't ever seem to be calling
recaptchaCallback
- I'm not sure how JS scope works if elements containing functions are replaced in the DOM. I see that theform
value is being assigned to thewindow
scope so maybe that's getting overwritten somehow as part of the live view render sequence.I expect I'll be updating this thread with my findings as I go. Sorry not to have a test case for you.
The text was updated successfully, but these errors were encountered: