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

CC BY-SA 3.0
2016-09-16T11:16:38.293Z
2016-09-16T11:16:38.293Z
Luke Pearce
<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>

<templating><form><user-profile>
Edit user's first and last name
# 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.

    {{ getCsrfInput() }}
    {{'Profiel bewerken'|upper}}
    
    
      

    {{"voornaam"|title}}
    

    {{"achternaam"|title}}
    

    {{"woonplaats"|title}}
    

    {{"postcode"|title}}
    

    {{"adres"|title}}
    

    {# Check to see if the user has a photo  #}
    Profielfoto
    {% if currentUser.photoUrl %}
        
        
    {% else %}
        {# If no photo exists, give the option to upload a new one #}
        
    {% endif %}

    {#  #}

    Opslaan

**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:
{{"voornaam"|title}}


{{"achternaam"|title}}


---

