Client Side Template

{*elseif logicalExpression}

Description

Evaluates if any additional javascript expressions are true/false after a {*if logicalExpression} command executes.

Templates can include conditional sections. Conditionals allow you to choose what to do when specific values, aka conditions, are met. logicalExpression is any Javascript expression that evaluates to a true/false value. The logicalExpression can refer to data in the current 'row' of data. For example, consider the following data:

{
    employees: [
        {firstname: 'Fred', lastname: 'Smith', state: 'MA'},
        {firstname: 'Laura', lastname: 'Linneker', state: 'CA'},
        {firstname: 'Junior', lastname: 'Programmer', state: 'MA'},
        {firstname: 'Bill', lastname: 'Lindsey', state: 'NY'}
    ]
}

When an employee's state is "MA" or "CA", we would like to print the text "Employee is based in MA" or "Employee is based in CA", respectively. Using conditional template commands, we can check the value of state to determine which text should be printed, as shown in the template below:

{employees}
    Employee name:{firstname} {lastname}<br>
    <div >
        {*if state=='MA'}
            Employee is based in MA
        {*elseif state=='CA'}
            Employee is based in CA
        {*endif}
    </div><br>
{/employees}
{*endif} closes a conditional command.

The result:

Employee name:Fred Smith
Employee is based in MA

Employee name:Laura Linneker
Employee is based in CA

Employee name:Junior Programmer
Employee is based in MA

Employee name:Bill Lindsey