[comment memo="Adding Conditions" memo_size="large" memo_style="bold"]
This powerful feature involves an opening and a closing Conditional Tag - both are needed for it to work.
You can set conditions for showing or hiding of form elements. If the condition is met, everything between the opening and closing Conditional Tags will be shown. If it is not met, it will not be displayed on the form and will be ignored in the output.
An optional (but strongly recommended) parameter is "field". This is used to identify the variables you are going to be setting up to a condition. These forms will work if you don't identify a variable (or variables) with the "field" parameter, but they may go quite a bit more slowly. To identify multiple variables, separate the variable names with pipes "|".
Operators are required to evaluate the condition.
These are operators within an individual comparison:
These are operators for combining multiple comparisons
&& is the "AND" operator
|| is the "OR" operator
Note for example below: To switch views between the Active Form and Markup Code, click on "View" in the upper right of this page. Then choose "Form" to see the Active Form or choose "Markup" to reveal the Markup Code.
Employment type: [radio name="job" value="Full Time|Part Time|Unemployed"]
[conditional field="job" condition="(job).is('Full Time')||(job).is('Part Time')"]Job title: [text name="job_title"][/conditional]
Another good example is [link url="//www.soapnote.org/sample/conditional-comparison/" memo="at this page"].
Please note that with these comparison operators, blank/empty fields would be considered as 0, so
(field1).isLess(5) will always be true if "field1" is blank. (Because 0 is less than 5)
There are 6 form elements.
Result - Copy and paste this output: