<p>The problem is due you're trying to get a property from the <a href="https://craftcms.com/classreference/models/FieldLayoutModel" rel="nofollow noreferrer">FieldLayoutModel</a> instead of <a href="https://craftcms.com/classreference/models/FieldLayoutFieldModel" rel="nofollow noreferrer">FieldLayoutFieldModel</a> please see the code bellow to fix the error.</p>

<pre><code>{%- set layoutFields = tab.getFields() %}

    {% for layoutField in layoutFields -%}

        {%- set field     = layoutField.getField() -%}
        {{ field.settings.placeholder }}
    {% endfor %}
</code></pre>

CC BY-SA 3.0
2017-02-08T20:14:24.810Z
2017-02-08T20:14:24.810Z
Andre L.
<p>I'm trying to create a dynamic form that loops through all the form fields and dynamically applies the HTML that matches the field type. </p>

<p>I can't seem to find what to use to output: Placeholder, Max Length, Line Breaks, Initial Rows.</p>

<p>Other values like <code>field.type</code>, <code>field.required</code>, <code>field.handle</code> work fine. But trying <code>field.placeholder</code> or <code>field.settings.placeholder</code> does not work.</p>

<pre><code>{% set fields = tab.getFields() %}

{% for field in fields %}

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

    {% if field.type == "PlainText" %}
        &lt;input type="text" name="fields[{{ field.handle }}]" value="{{ attribute(submittedEntry, field.handle) }}" placeholder=""&gt;
    {% endif %}

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

<plugin-sproutforms>
Output Placeholder, Max Length, Line Breaks, Initial Rows values for Fields in Sprout Forms
# Output Placeholder, Max Length, Line Breaks, Initial Rows values for Fields in Sprout Forms

(Asked by: username_0 on 2017-01-26)

I'm trying to create a dynamic form that loops through all the form fields and dynamically applies the HTML that matches the field type. 
I can't seem to find what to use to output: Placeholder, Max Length, Line Breaks, Initial Rows.
Other values like field.type, field.required, field.handle work fine. But trying field.placeholder or field.settings.placeholder does not work.
{% set fields = tab.getFields() %}

{% for field in fields %}

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

    {% if field.type == "PlainText" %}
        
    {% endif %}

{% endfor %}

**Tags:** plugin-sproutforms


---

## 1 answers

### Answer by username_1 on 2017-02-08. Score: 1

The problem is due you're trying to get a property from the FieldLayoutModel instead of FieldLayoutFieldModel please see the code bellow to fix the error.
{%- set layoutFields = tab.getFields() %}

    {% for layoutField in layoutFields -%}

        {%- set field     = layoutField.getField() -%}
        {{ field.settings.placeholder }}
    {% endfor %}


---

