<p>You only use <code>new1</code>, <code>new2</code> etc for creating <strong>new</strong> matrix blocks during the submission. For editing existing blocks, you need to use the block's ID in that same place. In your case that would be <code>block.id</code>.</p>

CC BY-SA 4.0
2020-02-24T12:37:31.590Z
2020-02-24T12:37:31.590Z
James Smith
<p>I am trying to update a specific row in a matrix field using a frontend form, I created them using another form with each row following the [new1], [new2] etc. naming format, but I can't seem to get it working using the code below</p>

<pre><code>{% for block in entry.fieldOrderItemsMatrix.all() %}
    &lt;form method="post" accept-charset="UTF-8"&gt;
      {{ csrfInput() }}
      {{ actionInput('entries/save-entry') }}
      {{ hiddenInput('sectionId', craft.app.sections.getSectionByHandle('orders').id) }}
      {{ hiddenInput('entryId', entry.id) }}
      &lt;input type="checkbox" name="fields[fieldOrderItemsMatrix][new{{ loop.index }}][fields][fieldOrderDelivered]" {{ delivered ? 'checked' }}&gt;
      &lt;span&gt;Delivered&lt;/span&gt;
      &lt;button&gt;Save&lt;/button&gt;
    &lt;/form&gt;
{% endfor %}
</code></pre>

<matrix><frontend-form>
Updating a matrix row in an existing entry using a frontend form
# Updating a matrix row in an existing entry using a frontend form

(Asked by: username_0 on 2020-02-24)

I am trying to update a specific row in a matrix field using a frontend form, I created them using another form with each row following the [new1], [new2] etc. naming format, but I can't seem to get it working using the code below
{% for block in entry.fieldOrderItemsMatrix.all() %}
    
      {{ csrfInput() }}
      {{ actionInput('entries/save-entry') }}
      {{ hiddenInput('sectionId', craft.app.sections.getSectionByHandle('orders').id) }}
      {{ hiddenInput('entryId', entry.id) }}
      
      Delivered
      Save
    
{% endfor %}

**Tags:** matrix, frontend-form


---

## 1 answers

### Answer by username_1 on 2020-02-24. Score: 1 | Accepted answer

You only use `new1`, `new2` etc for creating **new** matrix blocks during the submission. For editing existing blocks, you need to use the block's ID in that same place. In your case that would be `block.id`.


---

