0

When I want to save an new Matrix block with an form to an existing Entry:

<form method="post" accept-charset="UTF-8">
  {{ csrfInput() }}
  <input type="hidden" name="action" value="entries/save-entry">
  <input type="hidden" name="entryId" value="{{ userentry.id }}">
  <input type="hidden" name="enabled" value="1">
  <input type="hidden" name="fields[matrixhandle][new1][type]" value="antworten">
  <input type="hidden" name="fields[matrixhandle][new1][enabled]" value="1">
  <input type="hidden" name="fields[matrixhandle][new1][fields][teilnehmer]" value="{{currentUser.username}}">
  <textarea id="antwort" name="fields[matrixhandle][new1][fields][antwort]">
  <input type="submit" value="Antwort speichern">
</form>

The Problem is the Entry gets completely overwritten. The new Matrix block is saved correctly, but old blocks of the entry are discarded.

I see the possibility to read the old entry and add the old Matrix blocks as new ones, but this would not scale good and doesn't feel right.

How can I add new Matrix blocks to an existing entry with a front-end form?

2

0

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.