Answers.Body: <p>Sure, you'll likely want to use:</p>
  
  <pre><code>{% for block in entry.pageBody %}
      {% if block.type == 'form' %}
          {{ craft.sproutForms.displayForm(block.form.first.handle) }}
      {% endif %}
  {% endif %}
  </code></pre>
  
Answers.ContentLicense: CC BY-SA 3.0
Answers.CreationDate: 2016-03-08T13:11:59.363Z
Answers.Text: 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
Answers.UserDisplayName: Garth
Answers.ContentLicense: CC BY-SA 3.0
Answers.CreationDate: 2016-03-08T13:01:40.070Z
Answers.LastActivityDate: 2016-03-08T13:01:40.070Z
Answers.UserDisplayName: crawf
Body: <p>I'm using Sprout Forms to handle email forms on a website. Hardcoding a template with the code: <code>{{ craft.sproutForms.displayForm('contactForm') }}</code> works fine like in the docs.</p>
  
  <p>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.</p>
  
  <p>My question is how do I now display the form in the template. I can't see any documentation on how to do this?</p>
  
  <p>I've tried things like <code>{{ block.customForm.displayForm() }}</code> but with no luck.</p>
  
  <p>Has anyone tried this before?
  Thanks.</p>
  
Tags: <plugin-sproutforms>
Title: Outputting Sprout Form from a matrix field
ThreadText: # Outputting Sprout Form from a matrix field
  
  (Asked by: username_0 on 2016-03-08)
  
  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.
  
  **Tags:** plugin-sproutforms
  
  
  ---
  
  ## 1 answers
  
  ### Answer by username_1 on 2016-03-08. Score: 2 | Accepted answer
  
  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 %}
  
  ```
  
  > **Comments:**
  > **username_0**: 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  
  
  ---
  
  