About this article
This article will explain how to adjust the visibility of smart fields based on specific conditions so they can be visible, hidden or deleted when generating the template.
- How to adjust the visibility of smart fields
- Create a visibility binding with the Expression builder
- Create a visibility binding manually with Custom visibility
- Visibility expression examples
Prerequisites
|
|
How to adjust the visibility of smart fields
Often, when building smart templates some elements might require to be visible, hidden, or deleted based on specific conditions. The Visibility
option on the smart field level can be utilized for that purpose and requires the use of the binding syntax. Adding a Visibility expression
can be achieved following the steps below.
Create a visibility binding with the Expression builder
- Create the necessary smart field.
- Open the
Advanced
section.
- Select
Expression builder
in theVisibility
dropdown.
- Create the desired binding in the
Visibility condition
field to adjust the smart field visibility, by adding values to theIF
,THEN
andELSE
fields:
- In the
IF
field you can type a binding likeForm.Title
or{{Form.Title}}
(if you type curly brackets they will be removed when the field is saved), or you can type a string like "Introduction" in the example. - In case of a string you need to include the double quotes.
- Field of type
Checkbox
is not supported in the Expression builder. - The
Expression builder
can be used to quickly create a simple binding. After the binding is created you (optionally) can switch the view toCustom visibility
and manually create a more advanced binding by modifying the binding that is shown in theVisibility expression
field.
- In the
Create a visibility binding manually with Custom visibility
- Create the necessary smart field.
- Open the
Advanced
section.
- Select
Custom visibility
in theVisibility
dropdown.
- Type in the desired binding in the
Visibility expression
to adjust the smart field visibility.
|
|
Visibility expression examples
Show or hide the smart field based on the value of a checkbox in the response form
Using the IfElse() function with checkbox to determine visibility of a binding based on the value of Form.Introduction.
Binding | {{IfElse(Form.Introduction, VisibilityType.Visible,VisibilityType.Hidden)}} | |
Input | Checkbox is checked | Checkbox is not checked |
Condition | True | False |
Output | VisibilityType.Visible | VisibilityType.Hidden |
Show or hide the smart field based on the value of a question in the response form
Using the IfElse() function to set visibility of a binding based on the value of Form.Subject.
Binding | {{IfElse(Equals(Form.Subject, "Introduction"), VisibilityType.Visible, VisibilityType.Hidden)}} | |
Input | Form.Subject = "Introduction" | Form.Subject = "Product" |
Condition | True | False |
Output | VisibilityType.Visible | VisibilityType.Hidden |
Show or hide the smart field based on the value of a dropdown question in the response form
Using the IfElse() function to set visibility of a binding based on a dropdown.
Binding | {{IfElse(Equals(Form.Confidentiality.Name, "Public"), VisibilityType.Visible, VisibilityType.Hidden)}} | |
Input | Form.Confidentiality.Name = "Public" | Form.Confidentiality.Name = "Confidential" |
Condition | True | False |
Output | VisibilityType.Visible | VisibilityType.Hidden |
Show or delete the smart field based on the value of a dropdown question in the response form
Using the IfElse() function to set visibility of a binding based on a dropdown.
Binding | {{IfElse(Equals(Form.Confidentiality.Name, "Public"), VisibilityType.Visible, VisibilityType.Delete)}} | |
Input | Form.Confidentiality.Name = "Public" | Form.Confidentiality.Name = "Confidential" |
Condition | True | False |
Output | VisibilityType.Visible | VisibilityType.Delete |
Show or hide the smart field based on the value of a dropdown question originating from the user profile
Using the IfElse() function together with Contains() to display or hide some text based on the value of the "Office.Name" originating from the user profile.
- If the "Office.Name" is "Copenhagen" or "Berlin", the text should be hidden.
- If the "Office.Name" is anything else, the text should be shown.
Binding | {{IfElse(Contains("Copenhagen, Berlin", UserProfile.Office.Name), VisibilityType.Hidden, VisibilityType.Visible)}} | ||
Input |
UserProfile.Office.Name = "Berlin" |
UserProfile.Office.Name = "Copenhagen" | UserProfile.Office.Name = "Eindhoven" |
Output | Hidden text | Hidden text | Visible text |
Comments
0 comments
Article is closed for comments.