Skip to content

Basics of Ruleset Development

Updated pdexter 2022-12-19

What is a Ruleset

A ruleset is a special document within the Formbird system that contains instructions to execute on a particular event.

A ruleset comprises a collection of rules, each of which is evaluated in turn, and executed, if the rule condition is met.

See Also: Rulesets - Basic Concepts

Why use Rulesets

A lot of functionality can already be performed and encapsulated within a Template, such as setting fields mandatory, enabled and so forth.

Often though, we may need more complex functionality that can't be configured in a Template.

Example:

When a checkbox field labeled "Requires Verification" is checked, then the fields labeled "Verification Details" and "To be verified by" should be enabled and made mandatory for saving the document.

When do Rulesets run

Rulesets are invoked by the Formbird system on particular events of a document*.

There are two types of events to consider: client-side events, and server-side events.

ClientSide Event Description
PreRender Before a document has loaded to the browser, and any template configuration has modified anything.
OnLoad When a document is read from the system and loaded to the browser.
OnFieldChange When a field is changed on a document in the browser.
PreSave When the user has clicked the save button, but before the saving has completed.
PostSaveClient After a document has saved completely.
ServerSide Event Description
PreSaveServer Before the document has been saved to the database.
PostSave After the document has been saved to the database.