Spaces/Official ESi/Scriptaculous & Adv. Tags

if tag (Conditional Tests)

Andrew Donnan
posted this on November 25, 2008 12:24

<if test="@overdue='yes'">This task is overdue</if>

Use the if tag to evaluate boolean expressions and alter presentation based on the result.
If the test is true, the contents of the tag are displayed. If they are false, the contents are omitted.

  • Preface field names with @ symbol.
  • Enclose string literals in single quotes (apostrophes).
  • Any WebEOC field referenced in the if statement must have a corresponding eocfield tag somewhere on the view.

Tips:

You may also use 'and' and 'or' in for the if test like the example below which is testing to see if the field 'priority' is present or has a value.

<if test="@priority and @priority != ''">No Priority is set</if>

Use this example to test the value of an input field called status to show a message if it is "Open":

<if test="/data/node()/@status='Open'">This shelter is OPEN</if>

Use this example to suppress the output of a field, but still have it available for if test statements.

<if test="1=0"><eocfield name="overdue" /></if>
 
Topic is closed for comments