On 4/15/2020 at 10:23 AM, D. Tengler said:No problem and add recaptcha to templates and modules.
Always put before the button code:<div class="g-recaptcha" data-sitekey="you google key" style="margin-bottom: 10px; margin-top: 12px;"></div> <button .....And add the code to the ./themes/your theme name/templates/_partials/head.tpl file at the very bottom:
<script src="https://www.google.com/recaptcha/api.js" async defer></script>
Hello,
I am trying to implement this solution, I already pasted the recaptcha script in the head section, that's a no brainer. But when I tried pasting the above class into the button, it's not working as expected.
Here's what I'm trying so far. Lines 9-11 and 18-20.
<div class="block_newsletter"> <div class="row"> <h4 class="sub_heading title"><span class="news1">{l s='Get our latest news and special sales' d='Shop.Theme'}</span></h4> <div class="block_content"> <form action="{$urls.pages.index}#footer" method="post"> <div class="newsletter-form"> <input class="btn btn-primary pull-xs-right hidden-xs-down" class="g-recaptcha" data-sitekey="mypublickey" data-callback='onSubmit' name="submitNewsletter" type="submit" value="{l s='Subscribe' d='Shop.Theme.Actions'}" > <input class="btn btn-primary pull-xs-right hidden-sm-up" class="g-recaptcha" data-sitekey="mypublickey" data-callback='onSubmit' name="submitNewsletter" type="submit" value="{l s='OK' d='Shop.Theme.Actions'}" > <div class="input-wrapper"> <input name="email" type="text" value="{$value}" placeholder="{l s='Your email address' d='Shop.Forms.Labels'}" > </div> <input type="hidden" name="action" value="0"> <div class="clearfix"></div> </div> {if $msg} <p class="alert {if $nw_error}alert-danger{else}alert-success{/if}"> {$msg} </p> {/if} <div class="newsletter-message"> {if $conditions} <p>{$conditions}</p> {/if} </div> </form> </div> </div> </div>
** 'mypublickey' was replaced.
I believe my template has two inputs because it's one for mobile and one for desktop. But besides that, is the above solution correct? Can you give some pointers?