Populate a form with Current User Data
The following example populates a form with some User account values from the currently logged in user.
You can't see this page correctly until...
In order to view this page live, you'll need to make some adjustments to this template or your test form:
- Rename your test form handle to
freeformCurrentUserData
or adjust the form handle name inside this template to match your test form.
-
Make sure your test form includes the following fields at minimum, or adjust the overrides inside this template:
- First Name text field with handle of
firstName
.
- Last Name text field with handle of
lastName
.
- USA State select field with handle of
state
, and option values that use 2-letter codes (e.g. CA
).
- Email address field with handle of
email
.
- The person viewing this form is logged into their Craft account to see this working.
- The person viewing this form have a first and last name set in their User account.