PHP Exception for errors on Craft Contact Form with additional fields I'm having trouble with additional message fields in my Craft Contact Form using Craft 3 and the Pixel &amp; Tonic Contact Form plugin.

I've added two additional fields by splitting up the message field as described in the plugin documentation. If all the fields are filled in, everything goes smoothly. But if the form is submitted with any blank required fields, I get a PHP error "Array to string conversion." Live example at http://striveforfive.creativeforthepeople.org/contact.

EDIT: The code is:

    {% if entry.formCopy|length %}{{ entry.formCopy }}{% endif %}
    {% macro errorList(errors) %}
        {% if errors %}
            &lt;ul class="errors"&gt;
                {% for error in errors %}
                    &lt;li&gt;{{ error }}&lt;/li&gt;
                {% endfor %}
            &lt;/ul&gt;
        {% endif %}
    {% endmacro %}

    {% from _self import errorList %}

    &lt;form class="contact-form" method="post" action="" accept-charset="UTF-8"&gt;
        &lt;div class="form-group"&gt;
            {{ csrfInput() }}
            &lt;input type="hidden" class="form-control" name="action" value="contact-form/send"&gt;
            {{ redirectInput('contact-ty') }}

            &lt;input id="from-name" class="form-control" type="text" name="fromName" value="{{ message.fromName ?? '' }}" placeholder="your name"&gt;
            {{ message is defined and message ? errorList(message.getErrors('fromName')) }}

            &lt;input id="from-email" class="form-control" type="email" name="fromEmail" value="{{ message.fromEmail ?? '' }}" placeholder="your email"&gt;
            {{ message is defined and message ? errorList(message.getErrors('fromEmail')) }}

            &lt;input id="affiliation" class="form-control" type="text" name="message[Affiliation]" value="" placeholder="your school / organization / home locations"&gt;

            &lt;select id="position" class="form-control" type="text" name="message[Position]" value=""&gt;
                &lt;option value="" selected disabled&gt;your position&lt;/option&gt;
                &lt;option&gt;Educator / Care Giver&lt;/option&gt;
                &lt;option&gt;Family Child Care Provider&lt;/option&gt;
                &lt;option&gt;Center Director&lt;/option&gt;
                &lt;option&gt;Student Teacher&lt;/option&gt;
                &lt;option&gt;Other&lt;/option&gt;
            &lt;/select&gt;

            &lt;textarea rows="5" cols="40" id="message" class="form-control" name="message[body]" placeholder="your message"&gt;{{ message.message ?? '' }}&lt;/textarea&gt;
            {{ message is defined and message ? errorList(message.getErrors('message')) }}

            &lt;input id="bluebeard" name="bluebeard" type="text"&gt;

            &lt;input id="contact-submit" type="submit" class="btn btn-outline-primary" value="Send"&gt;
        &lt;/div&gt;
    &lt;/form&gt;


All help is appreciated!
I think this:

{% for error in errors %}
    &lt;li&gt;{{ error }}&lt;/li&gt;
{% endfor %}

  
  ... is where the error originates.
  
  I memory serves me right, errors is an array like this:

[
    ['fieldHandle' =&gt; ['Something went terribly wrong!', 'Really, two errors in ONE FIELD?']],
    ['orderFieldHandle' =&gt; 'I AM REQUIRED, y\'all!'],
];

  
  In which case {{ error }} would dictate Twig (and therefore PHP) to
  echo an array (['fieldHandle' =&gt; ['Something went terribly wrong!',
  'Really, two errors in ONE FIELD?']]), resulting in the error you
  mentioned.
  
  You can fix this, by using the following code:

{% for fieldHandle, fieldErrors in errors %}
    &lt;li&gt;{{ fieldHandle }}: {{ fieldErrors |join(', ') }}&lt;/li&gt;
{% endfor %}



My original answer was not what caused the error (so, apparently, errors was not what I thought it was).

This type of error is caused by an array being echoed by PHP, and not a string. In this case, the cause of the problem is {{ message.message ?? '' }}, which turned into an array because it contains multiple field values.