I have used the following code to allow our users to update their own profile. Everything works fine apart from not being able to update existing Matrix entries.

New Matrix field entries work fine. Can anyone spot the mistake I've made?

          <form method="post" accept-charset="UTF-8">
          {{ getCsrfInput() }}
          <input type="hidden" name="action" value="users/saveUser">
          <input type="hidden" name="redirect" value="/account/profile">
          <input type="hidden" name="userId" value="{{ currentUser.id }}">

          <label for="firstName">First Name</label>
          <input type="text" id="firstName" name="firstName" value="{{ currentUser.firstName }}">

          <label for="lastName">Last Name</label>
          <input type="text" id="lastName" name="lastName" value="{{ currentUser.lastName }}">

          <label for="telephone">Telephone</label>
          <input type="text" id="telephone" name="fields[telephone]" value="{{ currentUser.telephone }}">

          <h3>Additional Contacts</h3>

          <input type="hidden" name="fields[alternativeContacts]" value="">

          {% for block in currentUser.alternativeContacts.type('contact') %}
          <div class="row">
            <input type="hidden" name="fields[alternativeContacts][{{ block.id }}][type]" value="contact">
            <input type="hidden" name="fields[alternativeContacts][{{ block.id }}][enabled]" value="1">

            <input type="text" name="fields[alternativeContacts][{{ block.id }}][fields][firstName]" value="{{ block.firstName }}">
            <input type="text" name="fields[alternativeContacts][{{ block.id }}][fields][lastName]" value="{{ block.lastName }}">
            <input type="text" name="fields[alternativeContacts][{{ block.id }}][fields][telephone]" value="{{ block.telephone }}">
            <input type="email" name="fields[alternativeContacts][{{ block.id }}][fields][email]" value="{{ block.email }}">

            <button class="btn btn-xs btn-danger" data-action="delete-contact"><i class="fa fa-times"></i></button>
          {% endfor %}

          <div class="row">
            <h6>New Contact</h6>

            <input type="hidden" name="fields[alternativeContacts][new1][type]" value="contact">
            <input type="hidden" name="fields[alternativeContacts][new1][enabled]" value="1">

            <input type="text" name="fields[alternativeContacts][new1][fields][firstName]">
            <input type="text" name="fields[alternativeContacts][new1][fields][lastName]">
            <input type="text" name="fields[alternativeContacts][new1][fields][telephone]">
            <input type="email" name="fields[alternativeContacts][new1][fields][email]">

          <input type="submit" value="Save Profile">
  • 1
    Weirdly, if I remove the new entry field it works fine. Perhaps I'm hitting some validation issues and nothing's updating... hmmmm
    – GlennJ
    Commented Jan 10, 2015 at 10:43

1 Answer 1


Turns out it was a validation issue, it works fine when you make the new contact's first+last name mandatory.

Your Answer

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

Not the answer you're looking for? Browse other questions tagged or ask your own question.