Conditional script dialog
Conditional scripts can show or hide elements on the page depending on certain conditions and values. They can be added by right-clicking any element in a template and clicking Make Conditional. If the current element has neither an ID nor a class, an ID will be automatically generated. See Showing content conditionally.
The options in the Conditional Script wizard are:
- Name: The name of the script, making it easier to identify it.
- Selector: The Selector or Text to apply the result of the script to.
- Selector: Uses CSS selectors to find the element to which the script applies.
- Text: Uses text as a trigger for the script. The script applies to all instances of the text found in the template.
- Selector and Text: Uses text as a trigger for the script but only applies to text within the specified Selector.
- Action: Use the drop-down to select whether to Show or Hide the element when the condition below is true.
- Data Field: Use the drop-down to select which data field in the record the condition will be based on.
- Condition: Select which kind of condition is applied. Possible options are: Equal to, Not equal to, Contains, Does not contain, Begins with, Ends with.
- Value: The value(s) used for
the conditional check. Each additional value should go on a new line. The action is performed if the condition evaluates to true with one of the given values.
Values are case sensitive, unless the option Case insensitive is checked.
Dates should be entered in ISO standard notation (yyyy-mm-dd). - Case insensitive: With this option checked, upper- and lowercase letters are treated as being the same.
For more information about Selectors see Selectors in Connect.
For example, you could check whether the value in the data field "Gender"
is "Equal To" the value Mr
, in order to show a paragraph
or an image applying only to male customers.