Hide, display and disable an interview screen element

Hide, display and disable an interview screen element

There are frequent situations where you will want to hide and make visible input controls (questions and reference relationships), input control values (for restricted input controls) and labels based on user data. You may also wish to control summary screen elements in the same way, presenting different options on the screen at different stages of the interview. 

You can do so by defining an attribute specifically to control the visibility of a screen element, and then writing rules to set the respective value of that attribute to control its state.

For example,

the maternity leave question should be displayed if

the applicant is female

In this example, we only want to show the maternity leave question if the applicant is female. If the applicant is male we do not want to ask about maternity leave.  

NOTE: Visibility can only be based on an attribute that is known before a screen is displayed in Oracle Web Determinations. It cannot be based on the value of another attribute on the same screen. This is because the input values on a screen are not submitted by Oracle Web Determinations to the engine immediately after each value is entered - only once the screen is submitted. If you are using a custom user interface, however, then it is possible to submit data after each question and have the screen behave dynamically as values are entered.

There are also times when you may want to make an input control read-only thereby preventing users from altering data on that control.

What do you want to do?

Control the visibility of questions, labels and relationships

Control the visibility of restricted input options

Control the visibility of summary screen elements

Make an input read-only

Control the visibility of questions, labels and relationships

Once you have written rules to control the logic of when a question, label or relationship should be displayed, you then need to connect it to the related input control. To do this:

  1. In your screens file, double click to open the screen containing the question, label or relationship input.
  2. Click on the question, label or relationship in the left hand pane to open it for editing in the right hand pane.
  3. In the Visibility section, click the browse button next to the Attribute field.
  4. In the Attribute Selector dialog, select the visibility attribute from the list.
  5. Click OK. Select the Default State for the input control (ie Visible or Hidden). This is the state that the attribute will appear in if the visibility control attribute is unknown or uncertain.



  6. Click OK.

TIP: You can use the Preview button in the Screen Editor, assuming you have a debug session running containing the requisite data, to quickly check if the visibility attribute is working as expected.

NOTES:

  1. The Visibility control attribute is expected to be boolean - a value of true means visible, false means not visible (ie hidden). Generally, you should use an existing rulebase attribute as the visibility attribute if possible. If there is more complexity in the logic then you should create a rule proving the attribute (eg "question xxx should be displayed") which will become the visibility attribute.
  2. A visibility attribute may be in the global entity, in the same entity as the control it is attached to, or if the control is for an entity collect it may be in the screen entity.
  3. The value of the visibility attribute can not be temporal.
  4. If all the relevant questions that need a value in order to continue through the investigation are hidden on the screen, then the interview will not be able to progress. This will be reported as a ScreenLoopingException in your logs.

Control the visibility of restricted input options

The method for controlling restricted input control values (ie members of a drop-down list, list box or radio button group) is identical to that for controlling individual screen controls. 

  1. Write a rule to control the visibility of the control value:
    the Long Service Leave option should be displayed if
    the employee has worked for the company for more than 10 years
  2. In your screens file, double click to open the screen containing the restricted input control.
  3. Click on the restricted input control in the left hand pane to open it for editing in the right hand pane.
  4. In the Values section, select the control value in the list, then click the browse button next to the Visibility Attribute field.
  5. In the Attribute Selector dialog, select the visibility attribute from the list, then click OK.



  6. Select the Default State for the input control (ie Visible or Hidden).
  7. Click OK.

Visibility of the value will depend on the truth value of the visibility attribute - visible if the value is true and hidden if the value is false.

NOTE: A visibility attribute may be in the global entity, in the same entity as the control it is attached to, or if the control is for an entity collect it may be in the screen entity. The value of the visibility attribute can not be temporal.

TIP: You can use the Preview button in the Screen Editor, assuming you have a debug session running containing the requisite data, to quickly check if the visibility attribute is working as expected.

Control the visibility of summary screen elements

Summary screen elements may be controlled using the same method as screen controls and list elements, however three states are available: hidden, enabled (actionable) and disabled (displayed but not actionable). The visibility attribute for summary screen elements can be either a boolean or a text attribute. Use boolean logic to switch between two of these states, or a text variable to switch between the three states (setting the text variable to "hidden", "enabled" and/or "disabled" as required).

  1. Write a rule to control the visibility of the summary screen element:
    the end of interview items should be displayed on the summary screen if
    the health interview is complete
  2. In your screens file, double click to open the summary screen.
  3. Click on the element in the left hand pane to open it for editing in the right hand pane.
  4. In the Visibility section, click the browse button next to the Attribute field.
  5. In the Attribute Selector dialog, select the visibility attribute from the list, then click OK.
  6. Select the Default State for the input control (ie Enabled, Disabled or Hidden). This is the state that the element will appear in if the visibility control attribute is unknown or uncertain.



  7. Click OK.

 

If you need to switch between the three states (enabled, disabled and hidden), create a text variable to control the visibility and write a rule (eg a rule table) accordingly.

NOTE: A summary screen visibility attribute may be in the global entity or in the same entity as the summary screen element it is attached to. The value of the visibility attribute can not be temporal.

TIP: You can use the Preview button in the Screen Editor, assuming you have a debug session running containing the requisite data, to quickly check if the visibility attribute is working as expected.

Make an input read-only

By making an attribute read-only, you can prevent users from altering data on the input control. During a Web Determinations interview, the control will be rendered read-only if the attribute that it is based on is known, or it will default to the user specified value (editable or read only) if the attribute is unknown or uncertain.

To make an input read-only:

  1. In your screens file, double click to open the screen containing the question.
  2. Click on the question in the left hand pane to open it for editing in the right hand pane.
  3. In the Read-Only section, click the browse button next to the Attribute field.
  4. In the Attribute Selector dialog, select the attribute to base the read-only status on, then click OK. TIP: The Read-only control attribute is expected to be boolean – a value of true means read-only, a value of false means not read-only (ie editable) so a wording for the control attribute such as "x should be read-only" is recommended.
  5. Select the Default State for the control (ie whether the control should be Editable or Read Only if the attribute that it is based on is unknown or uncertain).
  6. Click OK.

NOTE: A read-only control attribute may be in the global entity, in the same entity as the control it is attached to, or if the control is for an entity collect it may be in the screen entity. The value of the read-only attribute can not be temporal.

TIP: You can use the Preview button in the Screen Editor, assuming you have a debug session running containing the requisite data, to quickly check if the visibility attribute is working as expected.