Is there a way to override the formatting template used when rendering a Freeform form? 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.
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:


  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 as a starting place, or install their Demo Templates.