Confluence Values
Forms for Confluence provides access to velocity to capture logged-in users' information and automatically adds this as the value for the field. This is particularly useful for making forms quick and straightforward to fill out. We've limited the values you can obtain from velocity for security reasons. However, you can get velocity values using the following calls in the Velocity Value field in some of our macros, for example, the Hidden Field or Input Field macros:
$user.name
- use this call to capture a user name in an input field automatically.$user.fullName
- use this call to capture a complete user name in an input field automatically.$user.email
- use this call to capture the user's email address automatically.$queryparam=SOME_PARAMETER
- use this call as a dynamic way to retrieve data such as a page title or space key. You can also use it to retrieve an appended parameter on a URL using the Hidden Field macro. This is useful if you want to view anonymous results of a shared form by splitting results into groups.
Confluence Values in action
$user.fullName
Activity: Create a Call Back Request using velocity values for a full name.
In this example, a form includes an Input Field macro using $user.Fullname
in the Value field. The form automatically populates the Your Name field with the user name.
$queryparam=title
Action: Request feedback using the velocity value as a page title.
In this example, a feedback form includes a Hidden Field macro with $queryparam=title
entered in the Velocity Value field. This will retrieve the page title when the form is submitted. When rendered, the field does not appear in the form. You can also retrieve a space by adding a Hidden Field macro with $queryparam=spaceKey.
$queryparam=group
Action: Use the value to create an anonymous survey shared between groups.
In this example, we want to distinguish results according to which group completed the same survey. A group parameter is appended to the page URL for each group, e.g. ?group=1, ?group=2, etc. A Hidden Field macro is added to the form with $queryparam=group
entered in the Velocity Value field. The URL can then be shared with the users in the appropriate groups.