Answers.Body: <p>According to the craft cms docs</p>
  
  <blockquote>
    <p>To show a “New Block” form, first come up with a temporary ID for the
    block, prefixed with new:. For example, new:1, new:2, etc.</p>
  </blockquote>
  
  <p>so, you need to you use prefix <code>new:</code> with the colon is a must.</p>
  
Answers.ContentLicense: CC BY-SA 4.0
Answers.CreationDate: 2020-04-09T14:16:14.260Z
Answers.Text: Still no. Even made sure I upgraded from 3.4.0 to 3.4.14. Tried both [new:{{ currentUser.id }}] and [new:1]. Can you please link to craft docs? I can't find that page.
Answers.UserDisplayName: Amanda Lutz
Answers.ContentLicense: CC BY-SA 4.0
Answers.CreationDate: 2020-04-10T08:23:45.523Z
Answers.Text: This is the page of craft docs,  https://docs.craftcms.com/v3/matrix-fields.html#templating
Answers.UserDisplayName: aodihis
Answers.ContentLicense: CC BY-SA 4.0
Answers.CreationDate: 2020-04-14T01:49:16.997Z
Answers.Text: Classic case of RTFM.
Answers.UserDisplayName: Amanda Lutz
Answers.ContentLicense: CC BY-SA 4.0
Answers.CreationDate: 2020-04-09T13:24:35.967Z
Answers.LastActivityDate: 2020-04-09T13:24:35.967Z
Answers.UserDisplayName: aodihis
Body: <p>I have Notification entry with sendTo field and nViewed matrix:<br />
  - viewedBy = Users field, limit of 1<br />
  - viewedDateTime = Plain Text</p>
  
  <p>User's don't see whole front end form, just a 'Mark as Read' link. The link uses js to populate viewedDateTime and submit form. My form:</p>
  
  <pre><code>&lt;form id="update-{{ msg.id }}" method="post" accept-charset="UTF-8"&gt;
     {{ csrfInput() }}
     &lt;input type="hidden" name="action" value="entries/save-entry" /&gt;
     &lt;input type="hidden" name="redirect" value="{{ theredirect }}" /&gt;
     &lt;input type="hidden" name="sectionId" value="{{ msg.section.id }}" /&gt;
     &lt;input type="hidden" name="entryId" value="{{ msg.id }}" /&gt;
     &lt;input type="hidden" name="fields[nViewed]" /&gt;
     &lt;input type="hidden" name="fields[nViewed][new1][type]" value="viewed" /&gt;
     &lt;input type="hidden" name="fields[nViewed][new1][enabled]" value="1" /&gt;
     &lt;input type="hidden" name="fields[nViewed][new1][fields][viewedBy][]" value="{{ currentUser.id }}" /&gt;
     &lt;input type="hidden" name="fields[nViewed][new1][fields][viewedDateTime]" value="" /&gt;
     &lt;button type="submit" class="tx-11 btn bd-0"&gt;Mark as read&lt;/button&gt;
  &lt;/form&gt;
  </code></pre>
  
  <p>When the first user from sentTo clicks the 'Mark as Read' link, they get added to the matrix. All good.</p>
  
  <p>When the second user from sentTo (testing on a different browser) clicks the 'Mark as Read' link it overwrites the first users row instead of adding another row to matrix.</p>
  
  <p>I've also tried using field <code>name="fields[nViewed][new{{ currentUser.id }}]...</code> to make them unique but still overwrites.</p>
  
  <p>What am I missing?<br />
  Amanda</p>
  
Tags: <craft3><matrix><frontend-form>
Title: Front end form with Matrix won't add more than one row
ThreadText: # Front end form with Matrix won't add more than one row
  
  (Asked by: username_0 on 2020-04-08)
  
  I have Notification entry with sendTo field and nViewed matrix:  
  - viewedBy = Users field, limit of 1  
  - viewedDateTime = Plain Text
  
  User's don't see whole front end form, just a 'Mark as Read' link. The link uses js to populate viewedDateTime and submit form. My form:
  
  ```
  <form id="update-{{ msg.id }}" method="post" accept-charset="UTF-8">
     {{ csrfInput() }}
     <input type="hidden" name="action" value="entries/save-entry" />
     <input type="hidden" name="redirect" value="{{ theredirect }}" />
     <input type="hidden" name="sectionId" value="{{ msg.section.id }}" />
     <input type="hidden" name="entryId" value="{{ msg.id }}" />
     <input type="hidden" name="fields[nViewed]" />
     <input type="hidden" name="fields[nViewed][new1][type]" value="viewed" />
     <input type="hidden" name="fields[nViewed][new1][enabled]" value="1" />
     <input type="hidden" name="fields[nViewed][new1][fields][viewedBy][]" value="{{ currentUser.id }}" />
     <input type="hidden" name="fields[nViewed][new1][fields][viewedDateTime]" value="" />
     <button type="submit" class="tx-11 btn bd-0">Mark as read</button>
  </form>
  
  ```
  
  When the first user from sentTo clicks the 'Mark as Read' link, they get added to the matrix. All good.
  
  When the second user from sentTo (testing on a different browser) clicks the 'Mark as Read' link it overwrites the first users row instead of adding another row to matrix.
  
  I've also tried using field `name="fields[nViewed][new{{ currentUser.id }}]...` to make them unique but still overwrites.
  
  What am I missing?  
  username_0
  
  **Tags:** craft3, matrix, frontend-form
  
  
  ---
  
  ## 1 answers
  
  ### Answer by username_1 on 2020-04-09. Score: 2 | Accepted answer
  
  According to the craft cms docs
  
  > To show a “New Block” form, first come up with a temporary ID for the
  > block, prefixed with new:. For example, new:1, new:2, etc.
  
  so, you need to you use prefix `new:` with the colon is a must.
  
  > **Comments:**
  > **username_0**: Still no. Even made sure I upgraded from 3.4.0 to 3.4.14. Tried both [new:{{ currentUser.id }}] and [new:1]. Can you please link to craft docs? I can't find that page.  
  > **username_1**: This is the page of craft docs,  https://docs.craftcms.com/v3/matrix-fields.html#templating  
  > **username_0**: Classic case of RTFM.  
  
  ---
  
  