MaestroThe UI design product. | Form Builder | 21.05 This feature was updated in 21.05.
The Maestro editor comes with the Code View functionality, which allows you to view, create, remove and modify the code, such as business rules, embedded within a Maestro design.
To view the code associated to form's components in the Code View pane:
You can use the following resources from the Code View to create rules:
To access this mode, click the Code button in the toolbar.
In this mode, the interface has three sections:
The toolbar contains the following options:
Icon | Label | Description |
---|---|---|
Display Left Panel | Enable to display the left panel. Disable to gain more space for the code editor. | |
Design | Switch to Design mode. | |
Code | Switch to Code mode. | |
Preview | Switch to Preview mode. | |
Save Code | Save changes to the open rule. | |
Revert Code | Undo all changes made to the currently open rule since it was last opened. | |
Move Rules to JS File | Open the Move Rules to JavaScript Library Resource dialog. |
The left panel contains two panes:
The Structure pane displays a tree view of the components in a form. Unlike the View pane in Design Mode, the hierarchy also displays any rules attached to components.
For example, this Block component has a Visibility rule attached to it:
At the top of the Structure pane, there's a search box for searching the tree view based on component labels and rule types, and two checkboxes for additional filtering:
Label | Description |
---|---|
Only show items with rules | If enabled, only components with rules attached to them will appear in the Structure pane. |
Include Inherited |
If you right-click a component in the Structure pane, a context menu will appear with the following options:
Label | Description |
---|---|
Insert Property Value | Insert the value of a property of the selected component into the code editor using the Form.getItemProperty method. |
Scroll To | Insert a Scroll.scrollTo method into the code editor with the selected component ID set as the first argument. |
Click | Insert a Form.fireRule method into the code editor. |
Is Blank | Insert a Util.isBlank method into the code editor. |
Validate Item | Insert a Util.validate method into the code editor with the selected component ID set as the first argument. |
Add New Rule | Attach a rule to the selected component. |
If you attach a rule to the Form component, it will appear in the Form Options category. It will also appear in the Form Options dialog, under Basic Options > Form Rules.
The Search pane is for searching the content of the rules.
It provides three options for additional filtering:
Label | Description |
---|---|
Match Case | Enable to perform a case-sensitive search. |
Regular Expression | Enable to search using a regular expression. |
Include Inherited |
If you select a rule in the Structure pane, the code for that rule will appear in the code editor. This is the same code editor found elsewhere in Maestro, so syntax highlighting and linting are provided.
Above the code editor, a toolbar is shown with the following details:
The function signature displays the three parameters that are available to all rules:
data
item
info
If you click the function signature, you'll be taken to the Maestro API Guide.
Next, learn how to add a new rule.