| Here
are set of rules that you need to know before configuration. Templates
are all files except formprocessorpro.pl and config file.
NOTE: Remember to save the templates and the script in ASCII
or Plain Text mode.
::
All templates ::..
Template file names are arbitrary. Try to use names that you will
be able remember, e.g. "email.txt", "error.txt".
The file extension (.html, .txt) is irrelevant to the script.
Wherever you want the user to supply data, use a word inside square
brackets, e.g. [YourName], [age].
Example of the eMail template:
Dear [YourName],
...
Your age is [age]
You can have underscores in variables, as long as there is a switch
in front of it. You can specify one or more switches on the start
of the variables, e.g. [re_eMail-Address], [d_Age]. Switches allowed:
Required
field:
r - this value is 'required'- it must be filled in. If user
will forget to fill this field it will be reminded by the script
message.
Example:
<input type="text" name="r_Name">
Valid
eMail address:
e - this value must look like a valid email address. If
user mistaken it will be informed by the script.
Example:
<input type="text" name="e_eMail">
Digits
and decimal point:
d - this value may only contain digits (0-9) and decimal
point. If user mistaken it will be informed by the script.
Example:
<input type="text" name="d_Age">
Digits,
decimal point and leading dollar sign ($) only:
c- this value may only contain digits (0-9), decimal point
and leading dollar sign. If user mistaken it will be informed by
the script. Can be used in arithmetic calculations result will contain
dollar sign ($).
Example:
<input type="text" name="c_Tax">
Word
characters only:
w - this value may only contain "word" characters
(A-Za-z0-9). If user mistaken it will be informed by the script.
Example:
<input type="text" name="w_Login">
Leading
and trailing:
s - this values leading and trailing white space will be
removed.
Example:
<input type="text" name="s_Command">
Processing
new line characters:
n - this value remove all new line characters from text.
Example:
<textarea cols="20" rows="5" name="n_desc"></textarea>
Multiple
selections in list box and checkboxes:
m - used to process multiple selections such as list boxes
and checkboxes with one name and put all data into one string.
Example:
<input type="checkbox" name="m_fashion" value="classic">
<input type="checkbox" name="m_fashion" value="casual">
<input type="checkbox" name="m_fashion" value="urban">
if you select all checkboxes in form
Result:
classic,casual,urban
NOTE: You can use _multi_separator hidden field to define separator.
Refer to form configuration.
Combined
switches:
Example:
<input type="text" name="re_eMail">
Will require valid email address.
The field names in the HTML must match exactly with those in the
templates i.e. the same switches etc.
Fields in the templates such as [%HTTP_REFERER], [%REMOTE_HOST],
[%DATE_GMT] will be substituted with their counterpart environment
values. The must begin with a %. You cannot require an environment
setting- if it is not set it will be left blank.
Time
and Date:
Using [%DATE_GMT] you will be able to output date and time of submission
in your templates. Using variable in form configuration you will
be able to adjust the time using offset. See HTML [Form] configuration
for more details.
Syntax:
MM/DD/YYY HH:MM:SS
Example (inside template):
Date and Time of submission is: [%DATE_GMT]
Result (after processing):
Date and Time of submission is: 09/23/2001 23:14:43
Mathematical
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:
[< [d_age] / 2 >]
Will be given the value of the value of [d_age] divided by 2.
[< ([item1] + [item2] + [item3]) * [tax] >]
Will add up the items and multiply them by the tax rate.
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 HTML [Form] configuration for more details] then
function can be "round (value)".
Example:
[<round ([Number], [Digits])>]
If Number = 123.4846 and Digits = 3 then
Result:
123.485
Second example:
In form:
<input type="hidden" name="_round " value="2">
In templates:
[<round ([Number] >]
If Number = 123.4846
Result:
123.48
Unique
reference number:
[unique_reference_number] - will include unique reference number
generated on the form submission. Is used to determine and mark
transaction; useful in shopping carts etc.
Use <input type="hidden" name=" unique_reference_number">
in forms to generate it.
Example:
Your unique reference number is [unique_reference_number]
Result:
Your unique reference number is 20010909-1013-4109
IF condition:
ifcond ((expr1),(expr2),(expr3)) - this expression evaluates and
print result to expr2 if expr1 evaluates to TRUE, and expr3 if expr1
evaluates to FALSE
Example:
[<ifcond (([Number1] > [Number2]), ([Number3+10]),([Number3]))>]
Number1 = 125
Number2 = 100
Number3 = 50
Result:
60
NOTE: 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.
::
eMail templates ::..
For the email templates, make sure the To: and From: line will
have a valid email address in it (by using the e switch). If you
let the user put in any old information into the To: line, your
email program will create an error.
Make sure for email templates there is a blank line between the
headers and the content.
Example:
To: info@MitriDAT.com
From: <[re_eMail]>
Subject: Simple Contact Form with Preview - Demo
Dear [r_Name],
::
Logging templates [DB, CVS etc] ::..
Logging templates must have the filename to write to as the first
line. Everything after the first line will be appended (tacked onto
the bottom of) the file specified.
Example of the content for logging template (DB or CVS file):
simple.log
[re_eMail];[Name]
Result (simple.log file will contain such lines):
one@email.com;name1
two@email.com;name2
Second example (free form):
simple.log
eMail: [re_eMail]
Name: [Name]
Date and Time: [%DATE_GMT]
Result (simple.log file will contain such lines):
eMail: one1@email.com
Name: name1
Date and Time: 09/23/2001 23:14:43
eMail: two@email.com
Name: name2
Date and Time: 09/24/2001 22:344:55
::
Error templates ::..
In error templates, the error title is specified as [%OUT_TITLE],
and the error message is specified by [%OUT_MSG].
|