Skip to main content

Example 1 - Simple boolean check

Introduction

This example demonstrates a simple scenario:

I want to enable/disable a control property based on a Checkbox control.

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 Dangerous is enabled, Description should be required. I can create an expression that exposes the Value property of the Dangerous control to other controls. I can then set the Required property of the Description control to target the expression.

1 Create the expression

When editing an item form, select Expressions in the app bar. On the left, select Add to create an expression.

The Expressions box

In the Item Form Expression Builder, select Edit at the top. Enter a descriptive name and select Save.

The edited name of the new expression

2 Add a global Boolean

Select Globals in the app bar and choose Boolean to add a node to the canvas.

Select the node's Edit button. Select Global value, choose Dangerous Value and then select Save.

The global node appears on the canvas
A list of available values for the global node

3 Add a final Boolean

Select Finals in the app bar and choose Boolean to add a node to the canvas.

The final node appears on the canvas

Select the right circle of the global Boolean node and the left circle of the final Boolean node. This links them together.

Select Save to finish.

Two nodes linked together

5 Target the expression

Back in the Item Form Builder, select the Description control. For its Required property, select Target and choose your saved expression.

Select Save to finish.

The Required property of the Description control showing as targeted to the expression