Form rules – A new approach to JavaScript

Applies to version 2017.1.x; Author: Przemysław Sierant


Form rules are a new feature introduced in WEBCON BPS 2017. They help create advanced JavaScript functions in an easier, more intuitive way. New rules are created in a graphical editor similar to the business rules. Rules can be constructed by dragging and dropping pieces from the right-side panel into the definition area, or by typing directly in the definition area – the editor will suggest elements based on what characters you type.


The Form rule editor has access to constants, global constants, form fields, global form fields and other form rules available to the given process. It can also utilize global form rules which are used to create advanced formulas operating on all of the aforementioned values.

If the user prefers to use basic JavaScript functions to control the behavior and appearance of the form (i.e. like in WEBCON BPS 2016), it is possible to switch to JavaScript mode and create JS scripts in the traditional way.


Once defined, Form rules can be set to trigger on:

  • Form field value change
  • On page load
  • On page load and postback

They can be used for:

  • Standard form behavior
  • Mobile form behavior
  • Additional validation on paths

Available functions and operations

In order to make creating new Form rules easier, there are already predefined operations and functions. One on these functions is described below. There also is an example of how the given solution works both in the new form rules mode and in the old JavaScript mode which was used in the previous versions of BPS.


Form rules include: arithmetical operations such as addition, subtraction, multiplication and division; logical operations like: AND, OR, NOT; comparison operations: lesser than (<), lesser or equal to (<=), greater than (>), greater or equal to (>=), equal (=), different than (<>) and empty (EMPTY).

Adding, subtracting, multiplying and dividing two numerical values will return a numerical result. Adding text values returns a combined character string as a text. Attempting to subtract, multiply or divide anything else than numerical values will return an error.

Operations of comparison (=) or differentiation (<>) will return TRUE when the numerical values will be equal or different. It is possible to compare two text values without taking character case into account in “InvariantCulture”. If the values are identical, equality (=) will return TRUE and difference (<>) will return FALSE.

Other comparison operations can be used for numbers and dates with the time precision of milliseconds. If the conditions are met it will return TRUE value, if not – FALSE. An attempt to compare textual value will return an error.

Functions – Behavior

SET – one of the most basic functions which enters a specified value into a form field.


The form field „Floating point number” named “Gross amount” will be set to a numerical value of “123.45”. The biggest improvement brought about by Form rules can be observed here – To create this rule the user only needs to know the name of the form field that they wish to initialize (or any other element they wish to affect e.g.: the names of paths, steps, constants, other form rules etc.).

In JavaScript mode, it is necessary to know the name of the field that is saved in the database.

The user also doesn’t need to concern themselves with the syntax of the function. In this example, the SET function only has two available input fields. Every function and operation has a prompt which suggests an example when you mouse-over it. In order for a function or operation to work correctly, one only need to fill out the input fields.


In JavaScript, missing a character or entering an incorrect amount of function parameters would result in an error on the site.

Leave a Reply

Your email address will not be published. Required fields are marked *