I'm looking for a way to keep matrix inputs populated with their original value after submitting a form containing errors. I'm already aware of the method of doing this for general inputs as shown here but I can't find an example of doing the same thing with a matrix field input. Here is my form currently without such functionality.
<form method="post" accept-charset="UTF-8">
{{ getCsrfInput() }}
<input type="hidden" name="action" value="entries/saveEntry">
<input type="hidden" name="redirect" value="/">
<input type="hidden" name="sectionId" value="5">
<input type="hidden" name="enabled" value="1">
// First goal
<input type="hidden" name="fields[year][new1][type]" value="goal">
<input type="hidden" name="fields[year][new1][enabled]" value="1">
<input type="text" id="descriptionMeasurement" rows="4" name="fields[year][new1][fields][descriptionMeasurement]">
<input class="dueDate" name="fields[year][new1][fields][dueDate][date]" type="text" placeholder="mm/dd/yyyy">
<input id="weight" type="number" min="1" max="100" name="fields[year][new1][fields][weight]">
// Second Goal
<input type="hidden" name="fields[year][new2][type]" value="goal">
<input type="hidden" name="fields[year][new2][enabled]" value="1">
<input type="text" id="descriptionMeasurement" rows="4" name="fields[year][new2][fields][descriptionMeasurement]">
<input class="dueDate" name="fields[year][new2][fields][dueDate][date]" type="text" placeholder="mm/dd/yyyy">
<input id="weight" type="number" min="1" max="100" name="fields[year][new2][fields][weight]">
<input type="submit" value="Save Goals">
</form>