Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

...

Expand
titleClick here for Example 3

Let's take a look at a simple example. Imagine a form with 3 fields named Name, Status and Money.

Rule Requirement: If the Name field contains "John" and the Status field contains "satisfied" then prepopulate populate the Money field with 50000.00 else populate the Money field with 1000.00.

One way to write this rule in JavaScript is to use nested if statememtsstatements:

Code Block
languagejs
if(Name.value=='John')
{
	if(Status.value=='satisfied')
	{
		Money.value=50000;
	}
}
else
{
Money.value=1000;
} 

If you are using the Visual Rule Builder to achieve the same result, you will have to add two rules:

  • Rule 1 - ) When the value of Name is equal to "John" and the value of Status is 'satisfied', populate the Money field with 50000.00
  • Rule 2 - ) When the value of Name is equal to "John" and the value of Status is not 'satisfied', populate the Money field with 1000.00

    Image Added