Display hidden fields to assist testers in confirming and validating the form.
Many forms are designed to be short and simple for the citizen, but that simplicity may be because the form has complexity behind the scenes.
It can be difficult for Testers to do their work thoroughly form some long or complex forms that include things like:
You can help make testing faster and better by exposing this information to the Testers using a central visibility control. This can be referred to as a "testing layer", because it can exist between the Form Builder layer you work with and the production version of the form Citizens use.
The first step to setting up a testing layer is to create a 'switch' control that lets you toggle between a 'test' mode and a 'production' mode.
You can do this by:
Once your switch is set up, you can use it to control field visibility.
To see an example of how this switch works, see the following form:
You have flexibilty in designing your switch and have a number of options such as:
With the last option, you would create:
For this approach you could:
Once those two switches are set up, you can set the Visibility of your section to respond to your second switch, such as:
string($project) = 'test'
Your second switch acts as an override to the switch the Testers can change. When you select the prod option on your switch, the whole section becomes hidden and the default setting of "prod" for the test view takes effect.
For each field you want to appear in a 'test' mode, you set the visibility to respond to the switch. In our example, this would be:
string($status) = 'test'
If you are going to use that field to populate a PDF - either automatic or templated - you'll also want to include the PDF mode for the visibility:
string($status) = 'test' or fr:mode() = 'pdf'
This combination will make the field visible in 'test' or PDF mode, and hidden otherwise.
You can save testers some time in completing forms by pre-filling some fields for them in the 'test' mode.
Just about any field is a good candidate for this, especially very common or longer fields like:
You may not want to provide initial data for every field, however. You'll still want testers to actively test certain fields and interactions.
You can provide this content in the Initial Value section of the control's Formulas tab using a conditional phrase, such as:
if (string($status) = 'test') then 'John' else ''
This statement provides a value if the form is in 'test' mode, and no value (represented by a pair of single quotes) if it's not.
If you are using a "testing layer" in your form, you'll need to make a slight modification to your process.
A testing layer effectively means that you have 2 representations of the form, so you'll choose the correct representation at different points in your process.