<p>The easiest way to figure this out is to edit an entry with these fields in the CP and monitor the network request that is made on save (or when saving a draft). Here's what I see in my browser dev tools, for example.</p>
<p><a href="https://i.sstatic.net/AMH84.png" rel="nofollow noreferrer"><img src="https://i.sstatic.net/AMH84.png" alt="Screenshot" /></a></p>
<p>Where:</p>
<ul>
<li>Matrix field handle = <code>contentBuilder</code></li>
<li>Table field handle = <code>tableField</code></li>
</ul>
<p>So your fields should be set up as follows (in Craft 4).</p>
<pre><code>fields[matrixFieldHandle][blocks][new1][type] = tableFieldHandle
fields[matrixFieldHandle][blocks][new1][enabled] = 1
fields[matrixFieldHandle][blocks][new1][tableFieldHandle][0][col1] = value1
fields[matrixFieldHandle][blocks][new1][tableFieldHandle][0][col2] = value2
fields[matrixFieldHandle][blocks][new1][tableFieldHandle][0][col3] = value3
</code></pre>

CC BY-SA 4.0
2022-10-30T23:10:29.733Z
Thanks Ben, I did eventually get there on my own, but that's a useful tip. FWIW, what I eventually needed was `fields[fieldHandle][new1][fields][blockFieldHandle][X][colX]` as well as `<input type="hidden" value="1" name="fields[fieldHandle][new1][enabled]"> <input type="hidden" value="blockHandle" name="fields[fieldHandle][new1][type]">`.
Tyssen
CC BY-SA 4.0
2022-10-31T23:12:06.770Z
Updated my answer accordingly.
Ben Croker
CC BY-SA 4.0
2022-10-29T14:39:42.227Z
2022-10-31T23:11:49.003Z
2022-10-31T23:11:49.003Z
Ben Croker
<p>I have an entry form with both table fields and matrix fields containing table fields. I can save data into the table fields OK with <code>fields[fieldHandle][X][colX]</code> but with the below, I get a matrix block with the first row in the table field created, but no data in the table field's columns:</p>
<pre><code>&lt;input
    type=&quot;hidden&quot;
    value=&quot;new:1&quot;
    name=&quot;fields[fieldHandle][sortOrder][]&quot;
&gt;
&lt;input
    type=&quot;hidden&quot;
    value=&quot;blockHandle&quot;
    name=&quot;fields[fieldHandle][blocks][new:1][type]&quot;
&gt;
&lt;input
    type=&quot;text&quot;
    name=&quot;'fields[fieldHandle][tableFieldHandle][X][colX]'&quot;
&gt;
</code></pre>
<p>What should it be?</p>

<matrix><table-field><entry-form>
Saving data in a table field in a matrix field via entry form
# Saving data in a table field in a matrix field via entry form

(Asked by: username_0 on 2022-10-23)

I have an entry form with both table fields and matrix fields containing table fields. I can save data into the table fields OK with fields[fieldHandle][X][colX] but with the below, I get a matrix block with the first row in the table field created, but no data in the table field's columns:




What should it be?

**Tags:** matrix, table-field, entry-form


---

## 1 answers

### Answer by username_1 on 2022-10-29. Score: 2 | Accepted answer

The easiest way to figure this out is to edit an entry with these fields in the CP and monitor the network request that is made on save (or when saving a draft). Here's what I see in my browser dev tools, for example.

Where:

Matrix field handle = contentBuilder
Table field handle = tableField

So your fields should be set up as follows (in Craft 4).
fields[matrixFieldHandle][blocks][new1][type] = tableFieldHandle
fields[matrixFieldHandle][blocks][new1][enabled] = 1
fields[matrixFieldHandle][blocks][new1][tableFieldHandle][0][col1] = value1
fields[matrixFieldHandle][blocks][new1][tableFieldHandle][0][col2] = value2
fields[matrixFieldHandle][blocks][new1][tableFieldHandle][0][col3] = value3

> **Comments:**
> **username_0**: Thanks Ben, I did eventually get there on my own, but that's a useful tip. FWIW, what I eventually needed was `fields[fieldHandle][new1][fields][blockFieldHandle][X][colX]` as well as `<input type="hidden" value="1" name="fields[fieldHandle][new1][enabled]"> <input type="hidden" value="blockHandle" name="fields[fieldHandle][new1][type]">`.  
> **username_1**: Updated my answer accordingly.  

---

