A conditional expression compares two values and returns true if the condition is met, and false if the condition is not met. The values are compared using one of the comparison operators from the table below.
Table 1. conditional expressions and their comparison operations
|<=||less than or equal to|
|>=||greater than or equal to|
|!=||not equal to|
The conditional expression is in three parts. The three parts are the comparison, the true part, and the false part as follows:
comparison ? true part : false part
An example of a conditional expression is shown in the action below. Suppose that the action is in the bgcolor option of FIELD1. In this case, the background color of the field is set to gray when it has the focus, and blue when the focus is on another part of the form.
FIELD1.focused == 'on' ? 'gray' : 'blue'
The above action reads as follows: Is the focused option of FIELD1 equal to 'on'? If true, set the value of the bgcolor option to 'gray'. If not true, set the value of the bgcolor option to 'blue'. In other words, if FIELD1 has the focus, then the background color is gray, else the background color is blue.
Parent topic: Action operator overview