You can customize the citizen experience using things like Visibility.
Visibility is the most common way to customize the form-filling experience for citizens. It allows you to simultaneously:
All controls are visible by default, but you can set their visibility to:
Visibility can be applied to:
Visibility settings are found in the control's settings in:
Finally, you can also apply visibility based on the 'media' of the form, such as making something visible only on the PDF. This is described in below in Other visibility options.
A read-only control only displays information and doesn't collect it from the user, at least not directly. Read-only controls are most often used to display the results of calculations or other data in a form with a testing layer.
Since this works just like Visibility and is an alternative design option, it's included in our scenario below.
If you've been tasked with modernizing your ministry's forms, you'll likely spend a lot of time transitioning paper and PDF forms to the web. The new web forms are rarely a direct copy of the original form.
By necessity, paper and PDF forms had to be designed to accommodate all possible options for a process. Things like making sure the form was complete and correct was difficult or impossible to accomplish.
CMS Forms gives you the options and capability to improve on the experience and quality of submitted data.
Here's a section of a business-related form that illustrates 4 questions, not all of which need to be answered in all cases.
The questions ask:
The design and text of this form suggests that there is intended logic.
There are implied conditions under which each question must be answered, and an order to those conditions. This is referred to as the "logic" of the form.
Looking at the original form, you can determine that question:
There are 2 conditions that apply to question 3 on jurisdiction. Depending on the design option you choose, you may have to account for one or both in creating your formulas.
There are several design options to treat this logic in your form. For questions 2 and 3, you can:
Option 1 is the most common and referred to as "progressive disclosure". New forms are shorter and extra questions only appear when needed. Forms appear less intimidating or complex to start, but if disclosure is excessive in a long form, it could be disappointing or frustrating to some users.
Option 2 is much less common and exposes all fields to the user to start, potentially setting a baseline for expectations. As they progress through the form, it becomes shorter and can inspire a feeling of rapid progression or acceleration. This is a good alternative to progressive dislosure for the long and complex forms that could annoy users.
Options 3 and 4 are rare, but can be a good option if you're setting up your form to autogenerate a PDF. This method allows you to create consistent form output without having to additionally set visibilty based on "mode".
To see what these different options look like, see:
Regardless of the option you choose, you'll need to set up your controls first.
For this example, we'll set them up this way:
For additional information, see:
Now that the fields are set up, you can apply the appropriate Visibility or Read-only settings based on your chosen design option.
The option settings below are based on the controls we set up earlier. You can follow the same format with your own control names.
This option is the most common and easiest to set up. Questions 2 and 3 will display in sequence, if needed. The formulas below are entered into the Visibility section.
For the isForeign control, enter the following formula:
string($orgType) = 'corp'
This tells Orbeon to display the control if the user selected "Corporation" for organization type.
For the jurisdiction control, enter the following formula:
string($isForeign) = 'true'
This tells Orbeon to display the control if the answer to the foreign entity question is "Yes".
This option will display questions 2 and 3, and then hide them if they're no longer needed. This is more complex because:
The formulas below are entered into the Visibility section.
For the isForeign control, enter the following formula:
xxf:is-blank($orgType) or string($orgType) = 'corp'
This tells Orbeon to display the control:
For the jurisdiction control, enter the following formula:
(xxf:is-blank($orgType) or string($orgType) = 'corp') and string($isForeign) != 'false'
This tells Orbeon to display the control:
Unanswered questions
You may have noticed that the formula used in the jurisdiction control above used two different ways to check if another control is unanswered. There are actually 3 ways to do this. Questions that haven't been answered are blank and have no value. You can use a pair of single quotes ('') to represent this in formulas.
Using the control orgType as an example, each of the following formulas would resolve to 'true' if the question hasn't been answered:
Formulas 1 and 2 are only 'true' while the question is unanswered. Formula 3 remains 'true' if the answer is something other than "Corporation". Depending on the context of your formula and what you want to do, you can choose the most appropriate option for your needs.
Oh, and for information, you can use xxf:non-blank() for the opposite, checking if the question has been answered. The following formulas have the same result:
Note that the operators - "or" and "and" - where changed. In the first formula, one of the statements needs to be 'true'; in the second, both need to be 'true'. You can see this approach in option 4, below.
For additional information, see:
This option locks the fields until they are needed. This works just like pregressive disclosure (option 1), but since 'true' activates read-only mode, we use the 'not' operator. The formulas below are entered into the Read-Only section.
For the isForeign control, enter the following formula:
string($orgType) != 'corp'
This tells Orbeon to keep the control locked unless the user selects "Corporation" as the organization type.
For the jurisdiction control, enter the following formula:
string($isForeign) != 'true'
This tells Orbeon to keep the control locked unless the answer to the foreign entity question is "Yes".
This option locks fields that are not needed, once that can be determined. Like option 2, this is more complex because:
The following formulas are entered into the Read-Only section.
For the isForeign control, enter the following formula:
xxf:non-blank($orgType) and string($orgType) != 'corp'
This tells Orbeon to keep the control open unless the user makes an organization type selection that is not "Corporation".
For the jurisdiction control, enter the following formula:
(xxf:non-blank($orgType) and string($orgType) != 'corp') or string($isForeign) = 'false'
This tells Orbeon to keep the control open until one of the following occurs:
If you don't add this extra condition, the control will remain open when the user selects something other than "Corporation" because the entity question will be locked and never answered.
Sometimes you want something to appear on the web form but not on the PDF or in the email, or the other way around. You can use the fr:mode() function to accomplish this. It allows you to check the 'mode' the form is in.
Most of the options for this function are for parts of the application not available to you or citizens, but the two you can use are:
The PDF option is most common, so we'll use that one as an example.
You can combine fr:mode() with any other conditions, like the ones used above.
For additional information, see: