Field Types
1. General Description
Form Processor Pro 4.1 allows you to create customized data fields, using Form Processor Pro pre-defined field types and calculation fields.
- To insert a field into form, simply place chosen name using standard form elements, e.g.:
- Wherever you want to output field data, simply put in into square brackets, e.g.:
2. Field types
You can use field type switches as a prefix for field name, separated by underscore "_". No other underscores allowed in field names.
In Form Processor Pro 4.0 field types can take the following values:
r |
Required field |
e |
Valid E-mail address |
d |
Digits and decimal point |
c |
Digits, decimal point and leading dollar sign ($) only. (currency) |
w |
Word characters only (A-Z, a-z, 0-9) |
s |
Leading and trailing spaces are removed |
n |
New line characters are removed |
m |
Multiple selections (for checkboxes and radio buttons) |
Detailed description of the types:
r
The field must be filled in. If user will forget to fill this field it will be reminded by the script message.
Example:
e
The value must look like a valid email address, otherwise user will be informed by the script.
Example:
d
The value may only contain digits (0-9) and decimal point, otherwise, user will be informed by the script.
Example:
c
The value may only contain digits (0-9), decimal point and leading dollar sign (this type is often called currency type). If user mistaken it will be informed by the script. Can be used in arithmetic calculations; result will contain dollar sign ($).
Example:
w
The value may only contain "word" characters (range of A-Z, a-z, 0-9), otherwise user will be informed by the script.
Example:
s
The value's leading and trailing white space will be removed.
Example:
n
All new line characters are removed from the value.
Example:
m
Used in list box and checkboxes to process multiple selections with one name and put all data into one string.
Example:
If you select all checkboxes in form result is: classic,casual,urban
when using PHP version of the script, put the empty square brackets after the multiple selections field name,
for example "m_fashion[]"
Please refer to FPP Learning / Working with Multiple Select Fields for more details.
You can combine the switches to take more effect on field values.
Example:
will generate required field (r) with valid e-mail address (e); leading and trailing spaces are removed (s).
3. CAPTCHA feature
If you want to use a CAPTCHA feature on your form to prevent it from scripted submissions and spam, you need to place a special image tag on your form and a special text field named "r_captcha" for user input. You are free with allocating these elements on your form, but make sure you provide your users with a message that they should type the alphanumeric combination from the image into the text field, in order to proceed.
Examples:
Make sure you link the "formprocessorpro.php" file location correctly. Please note that this feature would work with PHP version of the product only.
4. Arithmetical calculations
To do arithmetic, place the calculation in brackets like [< ... >]. Variables will be filled out before being calculated. Supported operators: "+" - sum, "-" minus, "/" - division and "*" - multiplication.
Examples:
Will be given the value of [d_age] divided by 2.
Will add up the items and multiply them by the tax rate.
5. Round function
round (value, precision) - will round value to precision decimal point. If default value is set from the _round variable in the form (see Local Form Configuration File for more details) then function can be round (value).
Example:
If Number = 123.4846 and Digits = 3 then result is: 123.485
6. IF condition
Example:
Number1 = 125
Number2 = 100
Number3 = 50
Result: 60
you can use this function for more sophisticated conditions. For example: if value payment = cc then _browser_out = credit-card-processing.html if not then another condition etc.
7. Read-only fields
Fields in the templates such as [%HTTP_REFERER], [%REMOTE_HOST], [%DATE_GMT] will be substituted with their counterpart environment values. They must begin with a % (percent) sign. You cannot require an environment setting- if it is not set it will be left blank.
See section FPP Learning / Server Variables for more details.
[unique_reference_number] is field that contains unique reference number generated by Form Processor Pro on the form submission. It is used to determine and mark transaction; useful in shopping carts etc. The field contains value kind of 20030409-1013-4109, which is never repeated.