Epi Info™ User Guide

Command Reference


Check Commands: HIDE / UNHIDE

Description
HIDE – This command hides a field from the form and prevents data entry.
UNHIDE – This command makes a field visible and returns it to the status before it was hidden.

Syntax
HIDE [<field(s)>]
UNHIDE [<field(s)>]

  • The <field(s)> represents one or more valid field names.

Comments
If no field name is specified, the current field (the one to which the Check Code block pertains) is assumed. Text fields can be hidden or unhidden to position messages on the screen, and the display of alternate messages.

Examples
Example 1: Questions relating to pregnancy will not be displayed if the patient is male. The ELSE section of the IF command allows the fields to be unhidden if you go back and change your answer in the Sex field. The example assumes a form exists with the following fields: Sex (Text), Pregnant (Yes/No), and ChildBirth (Yes/No). The code below would appear in the AFTER section of the Sex field.

IF Sex = "M" THEN 
    HIDE Pregnant
    HIDE ChildBirth 
ELSE
    UNHIDE Pregnant
    UNHIDE ChildBirth 
END-IF

Example 2: The field that has the HIDE command will be hidden. The example assumes a form exists with two pages and the following fields: LungDisease (Yes/No) and LungDiseaseAgent (Text). The code below would appear in the AFTER section of the LungDisease field.

IF LungDisease = (-) THEN 
   HIDE LungDiseaseAgent
END-IF

Example 3: Questions relating to pregnancy will not be displayed if the patient is a male. The example assumes a form exists with the following fields: Sex (Text), Pregnant (Yes/No), Complications (Yes/No), and ChildBirth (Yes/No). The code below would appear in the AFTER section of the Sex field.

IF Sex = "M" THEN 
   HIDE Pregnant ChildBirth Complications 
END-IF

Note: When hiding a field, it is important that it be unhidden (with an If…Then…Else…) if the value entered is changed.