With the Conditional Fields macro, you can specify different conditions that allow you to customize the form. This is useful for creating dynamic forms that react to user input.

Hide and Show Conditions

These two conditions allow you to dynamically hide or show some fields within a form. In this example, we want to collect information about the user regarding a training day that is pending. The organizer needs to know if there are some dietary restrictions, if there are, then Forms for Confluence needs to show the dietary preference.

Instructions

  1. Create your form using the Forms for Confluence macro.
  2. Add the Dietary Restrictions radio button group and the Dietary Preferences checkbox group.
  3. For this example, only show the preferences if the choice for the restrictions is "yes".
  4. Now add a Conditional Fields macro. 

    Only fields that are visible are submitted. Conditional Fields work with all type of fields, except the Hidden Field macro since it is always hidden.

  5. Under Field, we choose Restrictions. If the Field Value is No then we choose the Hide action for the Preferences Target Field.
    Field: the macro name where the decision takes place
    Field Value: the specific value to cause the trigger
    Action: the result is to show or hide a macro

    If the action is Show then the target macro remains hidden as its default state. It is possible to assign both the Hide and Show actions to the same target macro, however since these are conflicting actions only the last triggered condition will be actioned.

    Target Field: the macro to be shown or hidden 

  6. As a result, when choosing No the preference field is hidden, but if you choose anything else (in this case, the Yes option) it will show:

The Conditional Field macro does not support the use of single or double quotes (' or ") in the Field Value input box or in field names selected for the Field or Target parameter for conditions.

Go to Page Condition

The Go to Page and Finish actions can be used only within a form with multiple pages. These two actions don't appear if the form doesn't contain additional pages.

The Go to Page action skips to a particular form page if the condition is matched. This is useful when the user does not need to fill the details of particular pages during the process. In the following example we want the user to skip the Company Details section if he's a freelancer:

For that example, you would input the following condition:

If a user is a freelance worker, he doesn't need to fill in the fields of the Company Details section.

When they reply Yes to the question Are you a freelance worker? and click the Next button to move on, the user is jumped directly to Event Details page without the need to fill in the Company Details page.

Finish Condition

The Finish action permits the submission of data without the need to complete all the pages of a form. This is useful if users do not need to go through the whole process of a form submission. In the following example, we don't want the user to have to continue to fill all the pages and submit the data when he's not going to attend the event:

For that example, you would input the following condition:

When the user replies No to the question 'Are you going to attend the event required', the Next button is transformed into a Submit button and by clicking it, all the details get submitted.

If the user replies Yes, the Next button remains and they continue the process.