Use 'Formulas' and 'Validation' on my Forms?A 'formula' allows you to calculate a number. For example, you would use a 'formula' to calculate the total on an order form. In essence, the output of a 'formula' is a number.
A 'validation' allows you to verify that the data on a form is valid. For example, if you have a form where the user is supposed to choose and check 3 checkboxes out of 5, a 'validation' could ensure that they checked exactly three. In essence, the output of a 'validation' is an error message--or no error message, if all is well.
You build formulae and validations in much the same way. You use the same arithmetic operations for both:
| + |
Addition |
| - |
Subtraction |
| * |
Multiplication |
| / |
Division |
| % |
Modular arithmetic |
| ( ) |
Parentheses (for grouping) |
| == |
Is equal? |
| != |
Is not equal? |
| > |
Is greater than? |
| < |
Is less than? |
| >= |
Is greater than or equal? |
| <= |
Is less than or equal? |
You build formulae and validations using Numbers and Checkboxes from your form. (For checkboxes,
SET = 1 and UNSET = 0.)
Example 1: A Simple Formula
Suppose your form looks like this:
|
Check the options that you want:
Option 1 ($25):
Option 2 ($30): |
If your User Datums for the checkboxes are {Option1} and {Option2}, the formula for the total would be:
{Option1}*25 + {Option2}*30
Suppose they check {Option1} but not {Option2}. Then {Option1} evaluates to '1' and {Option2} evaluates to 0:
(1)*25 + (0)*30
= 25 + 0
= 25
Example 2: A Simple Validation
Using the same form above (Example 1), if you'd like to verity that they checked at
least one checkbox, the validation could be:
{Option1} + {Option2} > 0
Suppose they check {Option1} but not {Option2}. Then {Option1} evaluates to '1' and {Option2} evaluates to 0:
(1) + (0) > 0
1 > 0
which is TRUE, meaning that the form data is valid.
Suppose they don't check either checkbox. Then both {Option1} and {Option2} evaluate to 0:
(0) + (0) > 0
0 > 0
which is FALSE, meaning that the form data is NOT valid, and ProPageManager™ will display your error message.
|