Answers.Body: <p>No, I don't think it's possible to pass a template file name to the render() method. The render() method is meant to use the template selected in the control panel. I don't think you can override that option.</p>
  
  <p><a href="https://docs.solspace.com/craft/freeform/v3/overview/forms-composer.html#formatting-template" rel="nofollow noreferrer">From Freeform's documentation on the Forms Composer:</a></p>
  
  <blockquote>
    <p><strong>Formatting Template</strong><br>
    Optional, if using the render() method, this essentially allows you to "attach" a formatting template to a form so that you don't need to include formatting inside the template(s) you place the form inside.</p>
  </blockquote>
  
  <p>You can do something like pass a Freeform handle to another template via an include. If you have an entry with a Freeform field called <code>sidebarForm</code> it would look like this:</p>
  
  <pre><code>{% include "forms/sidebar-form" with {'formHandle': entry.sidebarForm } %}
  </code></pre>
  
  <p>Then the included template <code>forms/sidebar-form</code> could look something like this:</p>
  
  <pre><code>{% set form = formHandle is defined ? craft.freeform.form(formHandle) : null %}
  
  {% if form %}
  
    {{ form.renderTag() }}
  
      manually iterate through fields...
  
    {{ form.renderClosingTag }}
  
  {% endif %}
  </code></pre>
  
  <p>You can use <a href="https://docs.solspace.com/craft/freeform/v3/templating/formatting-template-examples.html" rel="nofollow noreferrer">Freeform's Formatting Template Examples</a> as a starting place, or install their <a href="https://docs.solspace.com/craft/freeform/v3/setup/demo-templates.html" rel="nofollow noreferrer">Demo Templates</a>.</p>
  
Answers.ContentLicense: CC BY-SA 4.0
Answers.CreationDate: 2020-04-22T21:43:14.143Z
Answers.LastActivityDate: 2020-04-22T21:43:14.143Z
Answers.UserDisplayName: Alex Roper
Body: <p>I have a form that can appear either in the regular body flow of a page, or in a sidebar-esque box. When rendering normally, I want it to use the formatting template selected in the backend, but when I render it in the sidebar box, I want it to use a different formatting template.</p>
  
  <p>I know there's manual overrides for rendering everything exactly the way you want in a custom fashion, but I'm looking for something more like this:</p>
  
  <pre><code>{{ craft.freeform.form(entry.form.handle).render( { template: 'specialtyTemplateHandle' } ) }}
  </code></pre>
  
  <p>Is something like that possible?</p>
  
  <p>We're using Freeform 3.6.2 Pro.</p>
  
Comments.ContentLicense: CC BY-SA 4.0
Comments.CreationDate: 2020-04-22T19:50:08.203Z
Comments.Text: https://docs.solspace.com/craft/freeform/v3/template-functions/freeform.form.html#usage-in-templates may provide the documentation you are looking for.
Comments.UserDisplayName: Alex Carpenter
Tags: <plugin-freeform><freeform>
Title: Is there a way to override the formatting template used when rendering a Freeform form?
ThreadText: # Is there a way to override the formatting template used when rendering a Freeform form?
  
  (Asked by: username_0 on 2020-04-22)
  
  I have a form that can appear either in the regular body flow of a page, or in a sidebar-esque box. When rendering normally, I want it to use the formatting template selected in the backend, but when I render it in the sidebar box, I want it to use a different formatting template.
  
  I know there's manual overrides for rendering everything exactly the way you want in a custom fashion, but I'm looking for something more like this:
  
  ```
  {{ craft.freeform.form(entry.form.handle).render( { template: 'specialtyTemplateHandle' } ) }}
  
  ```
  
  Is something like that possible?
  
  We're using Freeform 3.6.2 Pro.
  
  **Tags:** plugin-freeform, freeform
  
  > **Comments:**
  > **username_1**: https://docs.solspace.com/craft/freeform/v3/template-functions/freeform.form.html#usage-in-templates may provide the documentation you are looking for.  
  
  ---
  
  ## 1 answers
  
  ### Answer by username_2 on 2020-04-22. Score: 1
  
  No, I don't think it's possible to pass a template file name to the render() method. The render() method is meant to use the template selected in the control panel. I don't think you can override that option.
  
  [From Freeform's documentation on the Forms Composer:](https://docs.solspace.com/craft/freeform/v3/overview/forms-composer.html#formatting-template)
  
  > **Formatting Template**  
  > Optional, if using the render() method, this essentially allows you to "attach" a formatting template to a form so that you don't need to include formatting inside the template(s) you place the form inside.
  
  You can do something like pass a Freeform handle to another template via an include. If you have an entry with a Freeform field called `sidebarForm` it would look like this:
  
  ```
  {% include "forms/sidebar-form" with {'formHandle': entry.sidebarForm } %}
  
  ```
  
  Then the included template `forms/sidebar-form` could look something like this:
  
  ```
  {% set form = formHandle is defined ? craft.freeform.form(formHandle) : null %}
  
  {% if form %}
  
    {{ form.renderTag() }}
  
      manually iterate through fields...
  
    {{ form.renderClosingTag }}
  
  {% endif %}
  
  ```
  
  You can use [Freeform's Formatting Template Examples](https://docs.solspace.com/craft/freeform/v3/templating/formatting-template-examples.html) as a starting place, or install their [Demo Templates](https://docs.solspace.com/craft/freeform/v3/setup/demo-templates.html).
  
  
  ---
  
  