Logics in Aliveforms
Logic units add extra level of interactivity in your forms. With logics user can instruct Aliveforms to perform extra actions based upon conditions. For example, you set a rating screen. you want that if visitor gives more than 3 stars, show a message saying thank you.
Types of logic units
In Aliveforms, there are two main types of logic units.
- Server Side
- Client Side
Client Side
These logic units are processed on visitor's device. They are useful to change flow, defining variables, doing calcualtions etc.
Server Side
These are processed on server. They are useful for response manipulation, redirecting after form submission etc.
Anatomy of a logic
A logic is composed of conditions.
Conditions
A condition can have 2 parts.
- logic setup: input, operator, values to match
- logic actions, if scripting is not input.
Logic Setup
Logic setup in condition has 3 items
- Input
- Operation
- Value to Match
Actions
Actions are performed when condition in setup is matched. Depending upon logic type, there are different actions. A some actions may not work on different types of forms.
A Note about Logic Setup
Input and Operations are different depending upon type of forms.
Input
It can be score of screen, input of screen or script etc. Read what Inputs are available for Client Side Logics and Server Side Logics
Operation
It is the operator performed on input. Read what Operations are available for Client Side Logics and Server Side Logics
Value to Match
The format of value to match
is very important.
- If the value to match is string, please put it between
Scripting
Aliveforms has input type for scripting. For client side, it supports JavaScript and for server side, it supports PHP.
Advanced Inputs
- Evaluate Expression
- JavaScript
- PHP
These allow user to enter JavaScript code.
Evaluate Expression
To use Evaluate, enter the boolean expression like
(inputs[0] == 1 && input == 'Hello')
and then add actions
the allowed varaible is input, that can be either
- number -> Screen is mcq with mulitple checks off
- array of numbers -> Screen is mcq with mulitple checks on
- string -> Screen is text
JavaScript
It can be used only on client. Select input JavaScript Read More about JavaScript API
PHP
It can be used only on server. Select input PHP Read More about PHP API