Example 1 - Simple boolean check
This example demonstrates a simple scenario:
I want to enable/disable a control property based on the status of another.
Let's imagine an example of this:
My item form has controls for a Yes/No attribute named "Dangerous?" and a Text attribute named "Description".
If a user enables Dangerous? I want Description to be required. So I'll create an expression to make the Value property of the Dangerous? control available to the form. I can then set the Required property of the Description control to target the expression.
Create and name the expression
-
In the Item Form Builder, select Expressions in the toolbar to show the form's expressions on the left. Select to create a new expression.
-
In the Item Form Expression Builder, select Edit at the top. Enter a name that clearly describes the expression and then select Save.
Add a global Boolean node
-
Select Global in the toolbar and choose Boolean to add a node to the canvas.
-
Select on the node, select Global value and then choose Dangerous? Value.
Add a final Boolean node
-
Select Final in the toolbar and choose Boolean to add a node to the canvas.
Link them together!
-
Select the right circle of the global Boolean node and the left circle of the final Boolean node to link them together.
Save and target
-
Select Save (bottom-left) to finish.
-
Back in the Item Form Builder, select the Description control, select beside its Required property and choose your new expression.
NoteDon't forget to save the item form too!