Answers.Body: <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>
  
Answers.ContentLicense: CC BY-SA 4.0
Answers.CreationDate: 2020-02-24T12:37:31.590Z
Answers.LastActivityDate: 2020-02-24T12:37:31.590Z
Answers.UserDisplayName: James Smith
Body: <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>
  
Tags: <matrix><frontend-form>
Title: Updating a matrix row in an existing entry using a frontend form
ThreadText: # 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() %}
      <form method="post" accept-charset="UTF-8">
        {{ csrfInput() }}
        {{ actionInput('entries/save-entry') }}
        {{ hiddenInput('sectionId', craft.app.sections.getSectionByHandle('orders').id) }}
        {{ hiddenInput('entryId', entry.id) }}
        <input type="checkbox" name="fields[fieldOrderItemsMatrix][new{{ loop.index }}][fields][fieldOrderDelivered]" {{ delivered ? 'checked' }}>
        <span>Delivered</span>
        <button>Save</button>
      </form>
  {% 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`.
  
  
  ---
  
  