<p>Make sure those "missing" fields aren't used in the title format (under the advanced tab) or in your notifications -  both in the control panel. Ran into something similar just now.</p>

CC BY-SA 3.0
2017-09-25T21:46:48.203Z
2017-09-25T21:46:48.203Z
erwinheiser
<p>I'm working on a site that was partially built by another dev and am having some trouble with Sprout Forms. </p>

<p>It's partially working but when I add a new field (sailSeries) to the template (it exists in the sprout forms control panel) I get this error:</p>

<pre><code>Craft\SproutForms_EntryModel and its behaviors do not have a method or closure named "sailSeries".
</code></pre>

<p>Expanding on what the original dev has I added the sails series inside this for loop at the bottom.</p>

<pre><code>{% for tab in form.getFieldLayout().getTabs() %}
    {% set fields = tab.getFields() %}

    {% for field in fields %}

      {% set required = field.required %}
      {% set tabId = field.tabId %}

      {% set field = field.getField() %}

      {% if field.handle == 'contactType' %}
       {% set dropdownField = field %}
      {% endif %}

      various more fields


      {% if field.handle == 'sailSeries' %}
        {% set  sailSeries = field %}
      {% endif %}

    {% endfor %}
{% endfor %}
</code></pre>

<p>The the code later in the template to have the field display:</p>

<pre><code>&lt;div class="frm-row"&gt;
&lt;div class="section colm colm6"&gt;

    {% set submittedDropdownValue = attribute(submittedEntry, sailSeries.handle) %}

    &lt;label class="field select"&gt;
      {{ sailSeries.name }}
        &lt;select id="sailSeries" name="sailSeries"&gt;
        {% for option in sailSeries.settings.options %}
            {% set defaultValue = option.default ? option.value : null %}
            {% set selectedDropdownValue = submittedDropdownValue != '' ? submittedDropdownValue : defaultValue %}

            &lt;option value="{{ option.value }}" {% if selectedDropdownValue == option.value %}selected="selected"{% endif %}&gt;{{ option.label }}&lt;/option&gt;
        {% endfor %}
        &lt;/select&gt;
        &lt;i class="arrow"&gt;&lt;/i&gt;                    
    &lt;/label&gt;  
&lt;/div&gt;&lt;!-- end section --&gt; 
&lt;/div&gt;&lt;!-- /.frm-row --&gt;
</code></pre>

<p>As soon as I add this in I get errors. Not sure why or how to troubleshoot. Please advise.</p>

<p>Revised code and now I'm getting this error:</p>

<blockquote>
  <p>Variable "sailSeries" does not exist.</p>
</blockquote>

<p>no clue why this is happening.</p>

CC BY-SA 3.0
2017-07-12T14:58:10.320Z
Probably obvious, but is the field listed in the form in the control panel?
erwinheiser
CC BY-SA 3.0
2017-07-13T13:43:14.977Z
@erwinheiser yes it is.
CreateSean
CC BY-SA 3.0
2017-07-14T11:15:43.010Z
@CreateSean Are you getting the error when you load the form page the first time or after you submit the form? The second block of code appears to be displaying information after the form is submitted in which case you may have to check if the `sailSeries` variable is defined on the initial page load before form submission.
Ben Parizek
CC BY-SA 3.0
2017-07-14T12:59:58.380Z
@BenParizek This error is on page load. The form is in an include - should these variables be defined on the page where the include is called?
CreateSean
CC BY-SA 3.0
2017-07-14T13:20:57.683Z
@CreateSean I'd have to see the full template code, but the Submitted Entry `SproutForms_EntryModel` is going to be null until after you submit a form. Once a form is submitted, a Form Entry is created and the form values are returned to the page as a `SproutForms_EntryModel`. On the first page load (before a form is submitted), you'll need to check and confirm that the `SproutForms_EntryModel` exists before you try to access any attributes that it contains.
Ben Parizek
<error-message><plugin-sproutforms><entrymodel>
Craft\SproutForms_EntryModel and its behaviors do not have a method or closure named
# Craft\SproutForms_EntryModel and its behaviors do not have a method or closure named

(Asked by: username_0 on 2017-07-11)

I'm working on a site that was partially built by another dev and am having some trouble with Sprout Forms. 
It's partially working but when I add a new field (sailSeries) to the template (it exists in the sprout forms control panel) I get this error:
Craft\SproutForms_EntryModel and its behaviors do not have a method or closure named "sailSeries".

Expanding on what the original dev has I added the sails series inside this for loop at the bottom.
{% for tab in form.getFieldLayout().getTabs() %}
    {% set fields = tab.getFields() %}

    {% for field in fields %}

      {% set required = field.required %}
      {% set tabId = field.tabId %}

      {% set field = field.getField() %}

      {% if field.handle == 'contactType' %}
       {% set dropdownField = field %}
      {% endif %}

      various more fields


      {% if field.handle == 'sailSeries' %}
        {% set  sailSeries = field %}
      {% endif %}

    {% endfor %}
{% endfor %}

The the code later in the template to have the field display:



    {% set submittedDropdownValue = attribute(submittedEntry, sailSeries.handle) %}

    
      {{ sailSeries.name }}
        
        {% for option in sailSeries.settings.options %}
            {% set defaultValue = option.default ? option.value : null %}
            {% set selectedDropdownValue = submittedDropdownValue != '' ? submittedDropdownValue : defaultValue %}

            {{ option.label }}
        {% endfor %}
        
                            
      
 


As soon as I add this in I get errors. Not sure why or how to troubleshoot. Please advise.
Revised code and now I'm getting this error:

Variable "sailSeries" does not exist.

no clue why this is happening.

**Tags:** error-message, plugin-sproutforms, entrymodel

> **Comments:**
> **username_1**: Probably obvious, but is the field listed in the form in the control panel?  
> **username_0**: @username_1 yes it is.  
> **username_2**: @username_0 Are you getting the error when you load the form page the first time or after you submit the form? The second block of code appears to be displaying information after the form is submitted in which case you may have to check if the `sailSeries` variable is defined on the initial page load before form submission.  
> **username_0**: @BenParizek This error is on page load. The form is in an include - should these variables be defined on the page where the include is called?  
> **username_2**: @username_0 I'd have to see the full template code, but the Submitted Entry `SproutForms_EntryModel` is going to be null until after you submit a form. Once a form is submitted, a Form Entry is created and the form values are returned to the page as a `SproutForms_EntryModel`. On the first page load (before a form is submitted), you'll need to check and confirm that the `SproutForms_EntryModel` exists before you try to access any attributes that it contains.  

---

## 1 answers

### Answer by username_1 on 2017-09-25. Score: 1

Make sure those "missing" fields aren't used in the title format (under the advanced tab) or in your notifications - both in the control panel. Ran into something similar just now.


---

