Using advanced visibility conditions

  • Published by Viedoc System 2021-11-24
  • Print

This section provides examples of using JavaScript for setting visibility conditions.


How to set a field’s visibility based on more than one condition

In this example, we set the visibility of an item in the Adverse Events form based on more than one condition.

The Adverse Events form is configured as illustrated in the image.

We want to make the End Date item visible only if the Outcome is equal to the options (3) Resolved or (4) Resolved with sequelae. To achieve this, we write the following code under the Visibility tab of the End Date item settings:

AEOUT == 3 || AEOUT == 4

How to display a question for a male or female subject only

In this example, we set an item, a gender-related question, in the Eligibility form to be displayed for the relevant gender only, in this case male subjects.

The gender question (DMSEX) is collected in the Demographics (DM) form, and is "1" for "male". The DM form is located in the study start event, which has event ID "START". To set the question (item IEIC03 in the Eligibility form) to be visible only for male subjects (i.e., only if gender = male = 1), we write the following code on the Visibility tab of the IEIC03 item settings:

START.DM.DMSEX==1

For more details about functions and how to use JavaScript in Viedoc see lesson Using JavaScript in Viedoc.