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?
Amanda