marko-js / marko

A declarative, HTML-based language that makes building web apps fun
https://markojs.com/
MIT License
13.36k stars 643 forks source link

Recaptcha Integration #806

Closed joshgarde closed 7 years ago

joshgarde commented 7 years ago

I'm building an app that has a few public forms that I'm protecting with reCaptcha. Adding the script and integrating it with the form works fine, but I've noticed that when the DOM is updated, the reCaptcha modifications are removed. Is there anyway to get Marko to reload the DOM to include the modifications? I'm using isomorphic server-side/client-side rendering with Lasso integrations.

EDIT: Just for clarification, I'm referring to the invisible reCaptcha as opposed to the checkbox which renders a little badge in the right hand corner to let the user know that reCaptcha is being used. The checkbox version works fine as long as the g-recaptcha class and no-update are used together.

joshgarde commented 7 years ago

Update: Seem to have figured out my own problem.

<div class="g-recaptcha" data-sitekey="[SITE-KEY]" data-callback="[CALLBACK]" data-size="invisible" no-update></div>

This works perfectly fine for me and persists across DOM updates. Just took a bit more trial and error. Apologies for taking up your time here. It's literally 5am where I am and I am tired af trying to figure this out. We're done here.

patrick-steele-idem commented 7 years ago

No problem. Glad you figured it out 👍 In case anyone else stumbles upon this and is looking for more details on no-update: http://markojs.com/docs/components/#codeno-updatecode