0

We have a Sprout Forms form being used for gated content access. The form appears to work correctly but none of the entries are appearing in the database/CMS.

Here is an example URL with the form: http://thisisbeyond.co.uk/blog/feel-good-brands-report-2015/

Below is a CMS screenshot of the form settings.enter image description here

Below is the template code we are using to generate the form:

{% if craft.request.getParam('message') == 'success' %}

<div class="alert alert-success" role="alert">Thank you for your message, we'll get back to you as soon as possible.</div>

{% else %}

{% macro errorList(errors) %}
{% if errors %}
{% for error in errors %}
<span class="label label-alert">{{ error }}</span>
{% endfor %}
{% endif %}
{% endmacro %}

{% from _self import errorList %}

<form method="post" action="" accept-charset="UTF-8">
{{ getCsrfInput() }}
<input type="hidden" name="action" value="sproutForms/entries/saveEntry">
<input type="hidden" name="handle" value="gatedForm">
{% set gated = entry.gatedDocument.first() %}
<input type="hidden" name="redirect" value="{{ gated.url }}">

<div class="form-group">
    <label for="fields-fullName">Full Name *</label>
    <input type="text" name="fields[fullName]" id="fields-fullName" class="form-control" value="{% if gatedForm.fullName is defined %}{{ gatedForm.fullName }}{% endif %}" required/>
    {% if gatedForm is defined %}{{ errorList(gatedForm.getErrors('fullName')) }}{% endif %}
</div>

<div class="form-group">
    <label for="fields-companyName">Company Name *</label>
    <input type="text" name="fields[companyName]" id="fields-companyName" class="form-control" value="{% if gatedForm.companyName is defined %}{{ gatedForm.companyName }}{% endif %}" required/>
    {% if gatedForm is defined %}{{ errorList(gatedForm.getErrors('companyName')) }}{% endif %}
</div>

<div class="form-group">
    <label for="fields-email">Email *</label>
    <input type="text" name="fields[email]" id="fields-email" class="form-control" value="{% if gatedForm.email is defined %}{{ gatedForm.email }}{% endif %}" required/>
    {% if gatedForm is defined %}{{ errorList(gatedForm.getErrors('email')) }}{% endif %}
</div>

<p>
    <button type="submit" class="btn btn-primary">Submit</button>
</p>

</form>

{% endif %}

UPDATE: re-installing the Sprout Invisible Captcha plugin and including the following line before the closing tag got it working:

{{ craft.sproutInvisibleCaptcha.protect() }}
4
  • Hi Steve, is it possible you have Invisible Captcha or another spam prevention plugin silently blocking your form submissions? Dec 7, 2015 at 15:43
  • Hi Ben, That may be a possibility. I'll take a look into that, thanks Dec 7, 2015 at 16:15
  • Hi Ben, that helped me to get to the bottom of it. I needed to re-install the Sprout Invisible Captcha plugin and add a line to the template to include it. I'll update the question with the code snippet Dec 7, 2015 at 17:11
  • Thanks for the follow-up, @SteveRowland. Can you add that as an official answer?
    – Brad Bell
    Dec 7, 2015 at 18:53

1 Answer 1

4

Re-installing the Sprout Invisible Captcha plugin and including the following line before the closing tag got it working:

{{ craft.sproutInvisibleCaptcha.protect() }}

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.