<p>After talking to Craft Support (Thanks Oli!), the solution for Craft 3 is...</p>
<pre><code>{{ hiddenInput('fields[vendorLocations][sortOrder][]', 'new:1') }}

{{ hiddenInput('fields[vendorLocations][blocks][new:1][type]', 'address') }}


&lt;select name=&quot;fields[vendorLocations][blocks][new:1][fields][city]&quot; required&gt;
   &lt;option value=&quot;&quot;&gt;Choose One&lt;/option&gt;
   {% for city in riCities() %}
     &lt;option value=&quot;{{ city|title }}&quot;&gt;{{ city|title }}&lt;/option&gt;
   {% endfor %}
&lt;/select&gt;
</code></pre>
<p>Make sure the proper entryTypeId, section etc. is defined for your form as well, this is just the specifics for the new matrix block.</p>

CC BY-SA 4.0
2022-09-21T19:54:50.820Z
2022-09-21T19:54:50.820Z
cherrykoda
<p>Referencing <a href="https://craftcms.com/docs/3.x/matrix-fields.html#saving-matrix-fields" rel="nofollow noreferrer">https://craftcms.com/docs/3.x/matrix-fields.html#saving-matrix-fields</a> I believe I did this correctly according to the docs and other posts here. My Matrix field is able to save edits, but when the field is empty adding a new block does NOT work.</p>
<p>POST data from the form submission:</p>
<p><a href="https://i.sstatic.net/awA7D.png" rel="nofollow noreferrer"><img src="https://i.sstatic.net/awA7D.png" alt="enter image description here" /></a></p>
<p>Code:</p>
<pre><code>{{ hiddenInput('fields[vendorLocations][blocks][new1][type]', 'address') }}
{{ hiddenInput('fields[vendorLocations][blocks][new1][enabled]', '1') }}
&lt;select name=&quot;fields[vendorLocations][blocks][new1][fields][city]&quot; required&gt;
   &lt;option value=&quot;&quot;&gt;Choose One&lt;/option&gt;
   {% for city in riCities() %}
     &lt;option value=&quot;{{ city|title }}&quot;&gt;{{ city|title }}&lt;/option&gt;
   {% endfor %}
&lt;/select&gt;
</code></pre>
<p>Desired CMS Result:</p>
<p><a href="https://i.sstatic.net/bOhaP.png" rel="nofollow noreferrer"><img src="https://i.sstatic.net/bOhaP.png" alt="enter image description here" /></a></p>

CC BY-SA 4.0
2022-09-20T01:49:16.463Z
try to remove [blocks].
aodihis
<craft3><matrix><frontend-form>
Adding New Matrix Block via Frontend in Craft 3
# Adding New Matrix Block via Frontend in Craft 3

(Asked by: username_0 on 2022-09-18)

Referencing https://craftcms.com/docs/3.x/matrix-fields.html#saving-matrix-fields I believe I did this correctly according to the docs and other posts here. My Matrix field is able to save edits, but when the field is empty adding a new block does NOT work.
POST data from the form submission:

Code:
{{ hiddenInput('fields[vendorLocations][blocks][new1][type]', 'address') }}
{{ hiddenInput('fields[vendorLocations][blocks][new1][enabled]', '1') }}

   Choose One
   {% for city in riCities() %}
     {{ city|title }}
   {% endfor %}


Desired CMS Result:

**Tags:** craft3, matrix, frontend-form
> **Comments:**
> **username_1**: try to remove [blocks].  

---

## 1 answers

### Answer by username_0 on 2022-09-21. Score: 5 | Accepted answer

After talking to Craft Support (Thanks Oli!), the solution for Craft 3 is...
{{ hiddenInput('fields[vendorLocations][sortOrder][]', 'new:1') }}

{{ hiddenInput('fields[vendorLocations][blocks][new:1][type]', 'address') }}



   Choose One
   {% for city in riCities() %}
     {{ city|title }}
   {% endfor %}


Make sure the proper entryTypeId, section etc. is defined for your form as well, this is just the specifics for the new matrix block.


---

