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 when you want to make forms simple and quick to fill out. We've limited the values you can obtain from velocity for security reasons, however, you can obtain 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 automatically capture a user name in an input field.
$user.fullName- use this call to automatically capture a complete user name in an input field.
$user.email- use this call to automatically capture the email address of the user.
$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
Action: Create a Call Back Request using velocity values for a full name.
In this example, a form is created that includes an Input Field macro using
$user.Fullname in the Value field. The form automatically populates the Your Name field with the user name.
Action: Request for 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
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 then 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.