Skip to content
Grav 2.0 is officially stable. Read the announcement →
Archive

reCaptcha form in footer for every page

Started by Muut Archive 10 years ago · 1 replies · 776 views
10 years ago

Hello,
I first tested with simple-contact and that worked fine until the part where I need a token key from Simple form (https://getsimpleform.com/) and it does not work. Nor there is any information in regards to using Askismet for anti-spam.

I am using now reCaptcha form and I have added the following the template code to my footer partial with hope that it works but it has clearly not.

---code
<div> {# Twig or Parsedown will render this template as raw HTML without this DIV. #}
{% if not recaptchacontact.message %}
<form class="form-horizontal" action="{{ target_slug }}" method="post" id="recaptchacontact">
<fieldset>

HTML
            {# @todo: you can use to integrate with ajax response #}
            <div id="recaptchacontact-messages"></div>
            <div class="col-xs-6">
            <label class="control-label" for="name">{{ recaptchacontact.fields.name.label ?:'RECAPTCHACONTACT.FIELDS.NAME.LABEL'|t }}</label>
            </div>
             <div class="col-xs-6">
             <label class="c ontrol-label" for="email">{{ recaptchacontact.fields.email.label ?:'RECAPTCHACONTACT.FIELDS.EMAIL.LABEL'|t }}</label>
            </div>

            <div class="col-xs-6">
            <div class="form-group">                   
                <input id="name" name="name" type="text" placeholder="{{ recaptchacontact.fields.name.placeholder ?:'RECAPTCHACONTACT.FIELDS.NAME.PLACEHOLDER'|t }}" class="form-control input-sm" required />
            </div>
                </div>
            <div class="col-xs-6">
            <div class="form-group">

                <input id="email" name="email" type="text" placeholder="{{ recaptchacontact.fields.email.placeholder ?:'RECAPTCHACONTACT.FIELDS.EMAIL.PLACEHOLDER'|t }}" class="form-control input-sm" required />
             </div>
            </div>
            <div class="col-xs-12">
            <div class="form-group">
                <label class="control-label" for="message">{{ recaptchacontact.fields.message.label ?:'RECAPTCHACONTACT.FIELDS.MESSAGE.LABEL'|t }}</label>
                <textarea class="form-control" id="message" name="message" placeholder="{{ recaptchacontact.fields.message.placeholder ?:'RECAPTCHACONTACT.FIELDS.MESSAGE.PLACEHOLDER'|t }}" rows="5" required  ></textarea>
            </div>
                </div>
            <div class="col-xs-8">
            <div class="g-recaptcha" data-sitekey={{ recaptchacontact.grecaptcha_sitekey }}></div>

            <div class="form-group antispam-div">
                <label class="control-label" for="antispam">{{ 'RECAPTCHACONTACT.FIELDS.ANTISPAM.LABEL'|t }}</label>
                <input id="antispam" name="antispam" type="text" placeholder="{{ 'RECAPTCHACONTACT.FIELDS.ANTISPAM.PLACEHOLDER'|t }}" class="form-control"  />
            </div>
                </div>
            <div class="col-xs-4">
            <div class="form-group">
                <div class="text-right">
                    <button type="submit" class="btn btn-success btn-block  btn-sm hvr-wobble-to-bottom-right">{{ recaptchacontact.fields.submit.label ?:'RECAPTCHACONTACT.FIELDS.SUBMIT.LABEL'|t }}</button>
                </div>
            </div>
                </div>
        </fieldset>
    </form>
{% else %}
    {% include 'partials/recaptcha_message.html.twig' with { 'message': recaptchacontact.message } %}
{% endif %}
<script>$.getScript("https://www.google.com/recaptcha/api.js?hl={{ grav.language.getActive ?: recaptchacontact.default_lang }}");</script>

</div>

TXT

Test website: hk.helpstore.co.uk

Suggested topics

Topic Participants Replies Views Activity
Archive · by Deleted User, 9 years ago
0 1354 9 years ago
Archive · by Muut Archive, 9 years ago
2 935 9 years ago
Archive · by Muut Archive, 9 years ago
2 4065 9 years ago
Archive · by Muut Archive, 9 years ago
1 2953 9 years ago
Archive · by Muut Archive, 9 years ago
3 1119 9 years ago