<p>Yep, that's totally do-able. Check out <a href="https://craftcms.com/docs/templating/user-registration-form" rel="nofollow noreferrer">this article</a> to see how to create a registration form. </p>

<p>Then check out <a href="https://craftcms.com/docs/templating/user-profile-form" rel="nofollow noreferrer">this article</a> to see how to create the update profile form.</p>

<p>The thing to note is that any custom fields like <code>address</code> or <code>city</code> need to be pre-pended with <code>fields</code>. </p>

<p>So, let's say you want the user to enter their city. On your front-end form the markup looks like this:</p>

<pre><code>&lt;h3&gt;&lt;label for="city"&gt;City&lt;/label&gt;&lt;/h3&gt;
&lt;input id="city" type="text" name="fields[city]"
{%- if currentUser is defined %} value="{{ currentUser.city }}"{% endif %}&gt;
    {% if currentUser is defined %}
        {{ errorList(currentUser.getErrors('city')) }}
    {% endif %}
</code></pre>

<p>... and so on.</p>

<p>Make sure that your field handle(s) in the CP align with what you call them on your front-end form.</p>

<p><a href="https://craftcms.stackexchange.com/questions/351/how-can-i-determine-if-a-user-is-logged-in-and-who-that-user-is">Here</a> is how you can check for the current user.</p>

<p><a href="https://craftcms.stackexchange.com/questions/4332/how-to-add-custom-user-fields-to-the-front-end-registration-page">Here</a> is another great example of how to populate custom fields in your profile/registration form.</p>

<p>Hope this helps!</p>

CC BY-SA 3.0
2015-12-04T15:16:35.763Z
Thanks - I have created users account forms etc all before - all fairly straight forward;
Then when a user is logged in to Order a repeat prescription - that User Profile Data would auto-complete the Order Form - I was thinking of using the a&m forms plugin for that - so each Order is stored in the CMS and an email sent. I was wondering when that order form is submitted could that also update their user profile if there was any differences in it?
mmc501
CC BY-SA 3.0
2015-12-04T18:11:03.967Z
I'm sure there is a way. My guess is that you would need to create some sort of plugin that listens to the order form submit, then updates the user profile within craft.
Damon
CC BY-SA 3.0
2015-12-04T12:42:29.860Z
2015-12-04T12:42:29.860Z
2017-04-13T12:51:00.303Z
Damon
<p>Checking the best way to achieve this or if it can be done without a plugin.
I need to allow people to register and create user accounts on my site with various profile information.</p>

<p>Then I will have a form on the site available to users to submit which saves it in the backend and alerts by email. (A&amp;M forms looks like it has this functionality). When a user logs in this form should be prepopulated with data from their user profile.</p>

<p>When the form is submitted - can it update their user profile also?</p>

<p>It is basically a form for users to order repeat prescriptions - so I'm thinking user profile to save the standard date then use that to prepopulate the a&amp;m form. Is what I'm suggesting the best way to achieve this?</p>

<users><form><user-profile>
Using Form to update User Profile and submit form
# Using Form to update User Profile and submit form

(Asked by: username_0 on 2015-12-04)

Checking the best way to achieve this or if it can be done without a plugin.
I need to allow people to register and create user accounts on my site with various profile information.

Then I will have a form on the site available to users to submit which saves it in the backend and alerts by email. (A&M forms looks like it has this functionality). When a user logs in this form should be prepopulated with data from their user profile.

When the form is submitted - can it update their user profile also?

It is basically a form for users to order repeat prescriptions - so I'm thinking user profile to save the standard date then use that to prepopulate the a&m form. Is what I'm suggesting the best way to achieve this?

**Tags:** users, form, user-profile

---

## 1 answers

### Answer by username_1 on 2015-12-04. Score: 3

Yep, that's totally do-able. Check out this article to see how to create a registration form. 
Then check out this article to see how to create the update profile form.
The thing to note is that any custom fields like address or city need to be pre-pended with fields. 
So, let's say you want the user to enter their city. On your front-end form the markup looks like this:
City

    {% if currentUser is defined %}
        {{ errorList(currentUser.getErrors('city')) }}
    {% endif %}

... and so on.
Make sure that your field handle(s) in the CP align with what you call them on your front-end form.
Here is how you can check for the current user.
Here is another great example of how to populate custom fields in your profile/registration form.
Hope this helps!

> **Comments:**
> **username_0**: Thanks - I have created users account forms etc all before - all fairly straight forward; Then when a user is logged in to Order a repeat prescription - that User Profile Data would auto-complete the Order Form - I was thinking of using the a&m forms plugin for that - so each Order is stored in the CMS and an email sent. I was wondering when that order form is submitted could that also update their user profile if there was any differences in it?  
> **username_1**: I'm sure there is a way. My guess is that you would need to create some sort of plugin that listens to the order form submit, then updates the user profile within craft.  

---

