Answers.Body: <p>A User's first and last name fields don't need the <code>fields[]</code> prefix as they aren't custom fields added to the user field group.</p>
  
  <p>So using the following should work:</p>
  
  <pre><code>&lt;label for="voornaam"&gt;{{"voornaam"|title}}&lt;/label&gt;
  &lt;input type="text" id="voornaam" name="firstName"
  {% if currentUser.firstName %}value="{{ currentUser.firstName }}"{% endif %}&gt;
  
  &lt;label for="achternaam"&gt;{{"achternaam"|title}}&lt;/label&gt;
  &lt;input type="text" id="achternaam" name="lastName"
  {% if currentUser.lastName %}value="{{ currentUser.lastName }}"{% endif %}&gt;
  </code></pre>
  
Answers.ContentLicense: CC BY-SA 3.0
Answers.CreationDate: 2016-09-16T11:16:38.293Z
Answers.LastActivityDate: 2016-09-16T11:16:38.293Z
Answers.UserDisplayName: Luke Pearce
Body: <p>I have added a form to my front-end to edit the user's first and last name. Editing all the other fields is not a problem but when I try to edit the first or last name it doesn't work.</p>
  
  <p>I think I might need to change <code>name="fields[firstName]"</code> to something else, but I don't know to what I should change it to.</p>
  
  <pre><code>&lt;form method="post" id="loginForm" accept-charset="UTF-8" enctype="multipart/form-data"&gt;
      {{ getCsrfInput() }}
      &lt;h1 class="login-text"&gt;{{'Profiel bewerken'|upper}}&lt;/h1&gt;
      &lt;input type="hidden" name="action" value="users/saveUser"&gt;
      &lt;input type="hidden" name="redirect" value="profile"&gt;
      &lt;input type="hidden" name="userId" value="{{ currentUser.id }}"&gt;  
  
      &lt;label for="voornaam"&gt;{{"voornaam"|title}}&lt;/label&gt;
      &lt;input type="text" id="voornaam" name="fields[firstName]"
      {% if currentUser.firstName %}value="{{ currentUser.firstName }}"{% endif %}&gt;
  
      &lt;label for="achternaam"&gt;{{"achternaam"|title}}&lt;/label&gt;
      &lt;input type="text" id="achternaam" name="fields[lastName]"
      {% if currentUser.lastName %}value="{{ currentUser.lastName }}"{% endif %}&gt;
  
      &lt;label for="woonplaats"&gt;{{"woonplaats"|title}}&lt;/label&gt;
      &lt;input type="text" id="woonplaats" name="fields[woonplaats]"
      {% if currentUser.woonplaats %}value="{{ currentUser.woonplaats }}"{% endif %}&gt;
  
      &lt;label for="postcode"&gt;{{"postcode"|title}}&lt;/label&gt;
      &lt;input type="text" id="postcode" name="fields[postcode]"
      {% if currentUser.postcode %}value="{{ currentUser.postcode }}"{% endif %}&gt;
  
      &lt;label for="adres"&gt;{{"adres"|title}}&lt;/label&gt;
      &lt;input type="text" id="adres" name="fields[adres]"
      {% if currentUser.adres %}value="{{ currentUser.adres }}"{% endif %}&gt;
  
      {# Check to see if the user has a photo  #}
      &lt;label&gt;Profielfoto&lt;/label&gt;&lt;br /&gt;
      {% if currentUser.photoUrl %}
          &lt;img src="{{ currentUser.photoUrl }}" alt="{{ currentUser.title }}"&gt;&lt;br /&gt;
          &lt;input type="file" name="userPhoto" value="Change Photo"&gt;
      {% else %}
          {# If no photo exists, give the option to upload a new one #}
          &lt;input type="file" name="userPhoto" value="Upload"&gt;
      {% endif %}
  
      {# &lt;input type="file" name="userPhoto" value="{{ (currentUser.photoUrl ? 'Change Photo' : 'Upload') }}"&gt; #}
  
      &lt;br /&gt;&lt;button type="submit"&gt;Opslaan&lt;/button&gt;
  
      &lt;div class="clear"&gt;&lt;/div&gt;
  &lt;/form&gt;
  </code></pre>
  
Tags: <templating><form><user-profile>
Title: Edit user's first and last name
ThreadText: # Edit user's first and last name
  
  (Asked by: username_0 on 2016-09-16)
  
  I have added a form to my front-end to edit the user's first and last name. Editing all the other fields is not a problem but when I try to edit the first or last name it doesn't work.
  
  I think I might need to change `name="fields[firstName]"` to something else, but I don't know to what I should change it to.
  
  ```
  <form method="post" id="loginForm" accept-charset="UTF-8" enctype="multipart/form-data">
      {{ getCsrfInput() }}
      <h1 class="login-text">{{'Profiel bewerken'|upper}}</h1>
      <input type="hidden" name="action" value="users/saveUser">
      <input type="hidden" name="redirect" value="profile">
      <input type="hidden" name="userId" value="{{ currentUser.id }}">  
  
      <label for="voornaam">{{"voornaam"|title}}</label>
      <input type="text" id="voornaam" name="fields[firstName]"
      {% if currentUser.firstName %}value="{{ currentUser.firstName }}"{% endif %}>
  
      <label for="achternaam">{{"achternaam"|title}}</label>
      <input type="text" id="achternaam" name="fields[lastName]"
      {% if currentUser.lastName %}value="{{ currentUser.lastName }}"{% endif %}>
  
      <label for="woonplaats">{{"woonplaats"|title}}</label>
      <input type="text" id="woonplaats" name="fields[woonplaats]"
      {% if currentUser.woonplaats %}value="{{ currentUser.woonplaats }}"{% endif %}>
  
      <label for="postcode">{{"postcode"|title}}</label>
      <input type="text" id="postcode" name="fields[postcode]"
      {% if currentUser.postcode %}value="{{ currentUser.postcode }}"{% endif %}>
  
      <label for="adres">{{"adres"|title}}</label>
      <input type="text" id="adres" name="fields[adres]"
      {% if currentUser.adres %}value="{{ currentUser.adres }}"{% endif %}>
  
      {# Check to see if the user has a photo  #}
      <label>Profielfoto</label><br />
      {% if currentUser.photoUrl %}
          <img src="{{ currentUser.photoUrl }}" alt="{{ currentUser.title }}"><br />
          <input type="file" name="userPhoto" value="Change Photo">
      {% else %}
          {# If no photo exists, give the option to upload a new one #}
          <input type="file" name="userPhoto" value="Upload">
      {% endif %}
  
      {# <input type="file" name="userPhoto" value="{{ (currentUser.photoUrl ? 'Change Photo' : 'Upload') }}"> #}
  
      <br /><button type="submit">Opslaan</button>
  
      <div class="clear"></div>
  </form>
  
  ```
  
  **Tags:** templating, form, user-profile
  
  
  ---
  
  ## 1 answers
  
  ### Answer by username_1 on 2016-09-16. Score: 3 | Accepted answer
  
  A User's first and last name fields don't need the `fields[]` prefix as they aren't custom fields added to the user field group.
  
  So using the following should work:
  
  ```
  <label for="voornaam">{{"voornaam"|title}}</label>
  <input type="text" id="voornaam" name="firstName"
  {% if currentUser.firstName %}value="{{ currentUser.firstName }}"{% endif %}>
  
  <label for="achternaam">{{"achternaam"|title}}</label>
  <input type="text" id="achternaam" name="lastName"
  {% if currentUser.lastName %}value="{{ currentUser.lastName }}"{% endif %}>
  
  ```
  
  
  ---
  
  