<p>I'm not sure if it can make a difference, but you should try to remove the white space between the two array in the name attribute.</p>

<p>Then I think you may have to format the date value with the date filter.</p>

<pre><code>&lt;label&gt;
    &lt;input :class="{ error: error['formDate'] }" type="checkbox" name="fields[formDate][]" value="{{ date.value|date('Y-m-d') }}"&gt;{{ date.label|t }}
&lt;/label&gt;
</code></pre>

CC BY-SA 4.0
2019-11-26T12:42:32.637Z
2019-11-26T12:42:32.637Z
Elodie Grondin
<p>I have a form with multiple checkboxes in it. However, when submitting the form it returns an error like this:</p>

<pre><code>{"success":false,"errors":{"formDate":["Date is invalid."]}}
</code></pre>

<p>template:</p>

<pre><code>&lt;input type="hidden" name="fields[formDate]" value=""&gt;

&lt;label&gt;{{ 'Select your date(s):' | t }}&lt;/label&gt;
{% for date in dateList.options %}
    &lt;label&gt;&lt;input :class="{ error: error['formDate'] }" type="checkbox" name="fields[formDate] []" value="{{ date.value }}"&gt;{{ date.label | t }}&lt;/label&gt;
{% endfor %}
</code></pre>

<p>I'm using Vue component to serialise the form. Checkbox field is posted as the array of checked values.</p>

<p>While searching the documentation I found only how to display the checkbox on the template. Probably the error is connected with the format of values passed through the AJAX call. Does anyone know the acceptable value format for the checkbox with multiple values?  </p>

<form><error><checkboxes>
Error 'form[fieldName] : <fieldName> is invalid' while submitting multiple checkboxes
# Error 'form[fieldName] : <fieldName> is invalid' while submitting multiple checkboxes

(Asked by: username_0 on 2019-11-25)

I have a form with multiple checkboxes in it. However, when submitting the form it returns an error like this:
{"success":false,"errors":{"formDate":["Date is invalid."]}}

template:


{{ 'Select your date(s):' | t }}
{% for date in dateList.options %}
    {{ date.label | t }}
{% endfor %}

I'm using Vue component to serialise the form. Checkbox field is posted as the array of checked values.
While searching the documentation I found only how to display the checkbox on the template. Probably the error is connected with the format of values passed through the AJAX call. Does anyone know the acceptable value format for the checkbox with multiple values?

**Tags:** form, error, checkboxes

---

## 1 answers

### Answer by username_1 on 2019-11-26. Score: 2 | Accepted answer

I'm not sure if it can make a difference, but you should try to remove the white space between the two array in the name attribute.
Then I think you may have to format the date value with the date filter.

    {{ date.label|t }}


---

