Dynamically Disabling Content

The Enable Expression attribute can be attached to a question and will grey it out depending on the result of its expression. If the expression returns True (1), the question it is attached to will appear as it normally would, but if the expression returns False (0), the question will still be visible but the end user will not be able to interact with it.

Example of a disabled question.

Enable expressions are evaluated whenever there is a postback to the server, for example when a button is clicked.

Implementation:

  1. Switch to the Definition tab.
  2. Add the target content, i.e. a question or response.
  3. Plan conditions under which target content should be disabled. If they do not already exist, create methods of making these conditions possible (e.g. assignment expressions).
  4. Create any design-time variables needed to support the enable conditions.
  5. Within the Definition tab, right-click the target item.
  6. Select Attributes.
  7. Add a new attribute with the type Enable Expression.
  8. Switch to the new attribute's Value panel.
  9. Use the Attribute Expression field to write an expression that, if your planned conditions occur, will return one of the trigger values mentioned at the top of this topic, causing the target content to appear disabled until a certain condition has been met.
  10. Click OK.

Enable expressions can be used on any question type that is visible on the front end.