List of Maestro Rules

   MaestroThe UI design product.  |   Form Builder |  All versions This feature is related to all versions.

Maestro comes with several pre-configured business rules types, which can be divided in the following groups:

  • Action
  • Calculation
  • Editability
  • Mandatory
  • Style
  • Validation
  • Visibility

Every rule, which you configure in components that a Maestro form makes use of, has a corresponding JavaScript function defined in the app.js file. The app.jsApp. js is the root bootstrapping file for an AngularJS project. It's built to serve makers of static single-page apps, so it keeps all page navigation within the session of the webpage. It defines "pages" as DOM nodes that can be instantiated. Pages are HTML elements that have certain generic components like a topbar and content area. file is the root bootstrapping file for an AngularJS project. The name of a function is generated based on a standard naming convention that consists of a rule type code and the field ID with an underscore separator, such as <rule-type-code>_<field-id>. This allows you to quickly identify a business rule in the app.js file, which is especially handy in debugging a form or a rule.

Let's look at each group of the rules and their corresponding codes. Click a rule name to learn how to use it.

Action

Action rules are triggered at various points in the live cycle of a form.

Rule Type Code Name Description
blur Blur Run a script when a component loses focus.
change Change Run a script when the value of a component changes.
chok Change

Short for "change OK". This is the code for a validate after change rule that augments the standard validation rule to provide support for dynamic data validations. The result of this rule can contain the error message (like the standard validation rule) or a promise.

click Click Run a script when a component is clicked. A component must be a clickable UI item.
focus Focus Run a script when a component gains focus in the browser window.

Calculation

Rule Type Code Name Description
eq Script

Return the result of a calculation. eq stands for equals.

Note

Calculation rules are not triggered, if the field they are added to is not visible.

Editability

Rule Type Code Name Description
us Editable If Allow the user to edit a component's value if a condition is true. us stands for usable.
us Read-Only Prevent the user from editing a component's value if a condition is true.

Mandatory

Rule Type Code Name Description
md Mandatory If Require a component to contain a value if a condition is true, otherwise, it's optional. md stands for mandatory.

Style

Rule Type Code Name Description
dc Dynamic Class Apply one or more CSS classes to a component, dynamically based on some logic, if a condition is true. dc stands for dynamic class.

Validation

Rule Type Code Name Description
ok Regular Expression Validate a component's value against a regular expression.
ok Valid After Change If

Interpreted as OK, this is the code for a validation rule that controls the error state of the field. The result of this rule should be a string that is either blank (for valid values) or contains the error message (for invalid values).

ok Valid If Validate a component's value against an arbitrary condition.

Visibility

Rule Type Code Name Description
sh Hidden Hide a component if a condition is true. sh stands for show, this is the code for a visibility rule that controls whether the field is presented on screen. The result of this rule should be a boolean value where true = visible, false = read-only.
sh Hide on Receipt Hide a component on a receipt if a condition is true.
sh Show If Show a component if a condition is true.
sh Show on Receipt Show a component on a receipt if a condition is true.

Form

The following rules only exist on the form component:

Rule Type Code Name Description
load   Execute a rule when a form is loaded.
presuit   Execute a rule before a form is submitted.
postsubmit   Execute a rule after a form is submitted.
onSuccess   Execute a rule upon successful completion of the dynamic data function. This rule type is specific to the Dynamic Data Button.
onFailure   Execute a rule upon failure from a dynamic data call. This rule type is specific to the Dynamic Data Button

Here are a few examples of functions names with explanation what rules they use:

Function Name Rule Description
sh_previousAddress A visibility rule on the previousAddress block
eq_totalIncome A calculation rule on the totalIncome currency field
ok_emailAddress A validation rule on the emailAddress field
click_verifyIdentity A click rule on the verifyIdentity button
load_AvokaSmartForm A load rule on the form

These function names are guaranteed to be unique, so they're a handy way to find specific rules in the app.js file.

Note

Component developers can create additional rule types for their widgets as needed.

Next, learn how to create a rule.