<p>As Ben Parizek pointed out in the comments this was a bug that was fixed on Sprout Reports 1.2.8.</p>

<p>I couldn't see Sprout Reports update because my Craft CMS installation was below v3.3.7, I updated Craft CMS and then updated Sprout Forms to v1.2.8 which fixed the bug.</p>

CC BY-SA 4.0
2019-10-24T01:32:32.850Z
2019-10-24T01:32:32.850Z
Luiz Machado
<p>I'm getting an error on my options template when I run the report, the sprout from can't find the form fields template and I get this error</p>

<blockquote>
  <p>Unable to find the template “_includes/forms” in
  "__string_template__1e75d07f7afb92cfc030941cdd0c214a5067c25743f143e36dcfc3dd77a06f62"
  at line 1.</p>
</blockquote>

<p>When I remove the import I get this error</p>

<blockquote>
  <p>Variable "forms" does not exist in
  "__string_template__68fd366166a1d3cc8e58752e3634a261ca9faaa526e284d487e82cc2434316c9"
  at line 2.</p>
</blockquote>

<p>Here is my options.twig</p>

<pre><code>{% import '_includes/forms' as forms %}

{% set limitByDateRange = settings.limitByDateRange ?? false %}

{{ forms.lightswitchField({
    label: 'Filter By Date Range'|t,
    name: 'limitByDateRange',
    on: limitByDateRange,
    value: 1,
    toggle: 'toggle-dateRangeFields',
    first: true
}) }}

&lt;div id="toggle-dateRangeFields" class="{% if not limitByDateRange %}hidden{% endif %}"&gt;
    {{ forms.date({
        label: 'Start Date'|t,
        id: 'datetimeStartDate',
        name: 'datetimeStartDate',
        value: settings.datetimeStartDate is defined ? settings.datetimeStartDate : now|date_modify('-1 month')
    }) }}

    &lt;p style="display: inline-block;margin: 0 5px;"&gt;to&lt;/p&gt;

    {{ forms.date({
        label: 'End Date'|t,
        id: 'datetimeEndDate',
        name: 'datetimeEndDate',
        value: settings.datetimeEndDate is defined ? settings.datetimeEndDate : now
    }) }}
&lt;/div&gt;

{%- js %}
    $('#options-datetimeStartDate-date').datepicker($.extend({
        defaultDate: new Date({{ now.year }}, {{ now.month-1 }}, {{ now.day }})
    }, Craft.datepickerOptions));

    $('#options-datetimeEndDate-date').datepicker($.extend({
        defaultDate: new Date({{ now.year }}, {{ now.month }}, {{ now.day }})
    }, Craft.datepickerOptions));

    $('#modify-options-panel').attr('style', null);
{%- endjs %}
</code></pre>

<p>I also already tried to copy the examples templates from the plugin folder and I get the same error. 
Does anyone have an idea what could be wrong? I appreciate any help, thanks.</p>

CC BY-SA 4.0
2019-10-23T23:04:18.767Z
Can you confirm what version of Craft and Sprout Reports you are using? I believe this issue was introduced in Craft CMS v3.3.7 and solved updating to Sprout Reports v1.2.8.
Ben Parizek
CC BY-SA 4.0
2019-10-23T23:10:19.643Z
Hi Ben thanks for your reply, I'm using Craft CMS 3.3.1.2 and Sprout Reports 1.2.7
Luiz Machado
<plugin-sproutreports>
Sprout reports options can't find form fields
# Sprout reports options can't find form fields

(Asked by: username_0 on 2019-10-23)

I'm getting an error on my options template when I run the report, the sprout from can't find the form fields template and I get this error

Unable to find the template “_includes/forms” in
  "__string_template__1e75d07f7afb92cfc030941cdd0c214a5067c25743f143e36dcfc3dd77a06f62"
  at line 1.

When I remove the import I get this error

Variable "forms" does not exist in
  "__string_template__68fd366166a1d3cc8e58752e3634a261ca9faaa526e284d487e82cc2434316c9"
  at line 2.

Here is my options.twig
{% import '_includes/forms' as forms %}

{% set limitByDateRange = settings.limitByDateRange ?? false %}

{{ forms.lightswitchField({
    label: 'Filter By Date Range'|t,
    name: 'limitByDateRange',
    on: limitByDateRange,
    value: 1,
    toggle: 'toggle-dateRangeFields',
    first: true
}) }}


    {{ forms.date({
        label: 'Start Date'|t,
        id: 'datetimeStartDate',
        name: 'datetimeStartDate',
        value: settings.datetimeStartDate is defined ? settings.datetimeStartDate : now|date_modify('-1 month')
    }) }}

    to

    {{ forms.date({
        label: 'End Date'|t,
        id: 'datetimeEndDate',
        name: 'datetimeEndDate',
        value: settings.datetimeEndDate is defined ? settings.datetimeEndDate : now
    }) }}


{%- js %}
    $('#options-datetimeStartDate-date').datepicker($.extend({
        defaultDate: new Date({{ now.year }}, {{ now.month-1 }}, {{ now.day }})
    }, Craft.datepickerOptions));

    $('#options-datetimeEndDate-date').datepicker($.extend({
        defaultDate: new Date({{ now.year }}, {{ now.month }}, {{ now.day }})
    }, Craft.datepickerOptions));

    $('#modify-options-panel').attr('style', null);
{%- endjs %}

I also already tried to copy the examples templates from the plugin folder and I get the same error. 
Does anyone have an idea what could be wrong? I appreciate any help, thanks.

**Tags:** plugin-sproutreports
> **Comments:**
> **username_1**: Can you confirm what version of Craft and Sprout Reports you are using? I believe this issue was introduced in Craft CMS v3.3.7 and solved updating to Sprout Reports v1.2.8.  
> **username_0**: Hi Ben thanks for your reply, I'm using Craft CMS 3.3.1.2 and Sprout Reports 1.2.7  

---

## 1 answers

### Answer by username_0 on 2019-10-24. Score: 2

As Ben Parizek pointed out in the comments this was a bug that was fixed on Sprout Reports 1.2.8.

I couldn't see Sprout Reports update because my Craft CMS installation was below v3.3.7, I updated Craft CMS and then updated Sprout Forms to v1.2.8 which fixed the bug.


---

