I'm using Sprout Forms to handle email forms on a website. Hardcoding a template with the code: {{ craft.sproutForms.displayForm('contactForm') }} works fine like in the docs.

But I have a Matrix field to build the page content so I'd like to add a new field type to that I can select which form to display. There is a Matrix field type 'sprout forms' which lets me select the form fine in the CMS.

My question is how do I now display the form in the template. I can't see any documentation on how to do this?

I've tried things like {{ block.customForm.displayForm() }} but with no luck.

Has anyone tried this before? Thanks.

1 Answer 1


Sure, you'll likely want to use:

{% for block in entry.pageBody %}
    {% if block.type == 'form' %}
        {{ craft.sproutForms.displayForm(block.form.first.handle) }}
    {% endif %}
{% endif %}
  • Perfect. This worked. In my case I used: {{ craft.sproutForms.displayForm(block.customForm.first.handle) }} customForm being the name of the field in matrix. Many thanks
    – Garth
    Commented Mar 8, 2016 at 13:11

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

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