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.
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.
$queryparam=titleentered 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
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.