Team Forms automatically tracks the user who submits each response, however in some situations it may be helpful to display the users details inside the form itself. There are several way to achieve this which are outlined in this article
User Component
The easiest way to display the current user in your form is using the user component and configuring the default value to the current user. This can be done by following the steps below:
Drag and drop a user component into your form
Disable the component to prevent modifying it value
under the data tab set the default value to "current user"
Calculated Value
You can use Team Forms calculated values feature in conjunction with JavaScript to automatically populate a component with the logged in users details. To do this Team Forms provides a special function called TF_USER()
which will return the users details including there name, email and id. Lets use this function in the example below to populate a text field with the users email.
Drag an drop a text field into your form
In the components setting navigate to the data tab and expand the "calculated value" section. This will expand a code block allowing you to write your own Javascript.
Paste the one of the javascript expressions below in the code block to automatically set the text field value.
To populate email:value = TF_USER().email
To populate the name:
value = TF_USER().name
Name
In the display tab scroll down and check the "disable" option to prevent users from changing the value.