Hooks allow you to add expression based logic in various places places in Rhythm. The most common place for hooks are in web forms, which are configurable multi-step forms that are used throughout the Rhythm platform. Expressions can be used to represent complex logic, often more complicated than can be represented using the rules editor. Underneath the covers, the expr-eval library is used for security expression evaluation, and full documentation can be seen here:
https://github.com/silentmatt/expr-eval
For hooks, the following objects are available during expression parsing:
{
webHookResponse, // if a web hook response is availalable,
context: {
definition, // the form definition
}
};
Functions
In addition to the common functions that are available across all expression, form-based hooks have special functions that allow you to perform operations and modify values.
setFormValue( property ,newValue)
This allows you to change an underlying form value using expressions.
setFormValue( 'name','We successfully modified the form via the hook');
setDestinationPageId( id)
Used in transition hooks, allows you to redirect a user to a specific page by that page's ID.
setDetinationPageId( 'confirmation');
setDestinationPageIndex( id)
Used in transition hooks, allows you to redirect a user to a specific page by that page's index.
setDetinationPageIndex( 2);
setDestinationPageOffset( id)
Used in transition hooks, allows you to redirect a user to a specific page by that page's offset from the current page. Negative values move the user backwards.
setDetinationPageOffset( 2);
Comments
0 comments
Article is closed for comments.