Form and order profiles
|
Incomplete documentation
This page needs a lot of work, and could do with a proper list of
profile checks and pragmas etc.
|
Interchange form profiles are used to validate form inputs and possibly trigger
additional actions.
Input field validation usually consists of requiring that a field is non-empty,
or matches a specific regular expression.
Actions can, for example, be used to signal the completion of an order process.
Profiles are not specific to an order checkout;
they are an integral part of all form processing in Interchange.
You will also see actions such as Interchange account creation,
login, logout and password change being at least partly handled using profiles.
Profiles can be defined in external files,
read and activated using the Profiles or
OrderProfile directive,
or in scratchpad variables.
External files are, by convention, kept in the "etc" directory, under
the website's home directory, and have filenames that begin with "profiles.".
Multiple profiles can be defined in each file.
The following is a very simple profile that requires that first and last name fields
("fname" and "fname", in this example) must both have a value:
__NAME__ example_1
fname=required
lname=required
__END__
|
|
Note
The __NAME__ and __END__ markers must start at the beginning of
a line.
The profile will be ignored if the __NAME__ and __END__ are not
present and correct.
|
Each profile check has its own default error message,
but it is possible to specify your own strings to override the default.
For example:
__NAME__ example_2
fname=required Please enter your first name
lname=required Please enter your last name
__END__
|
Profile checks are specified as follows:
|
variable_name = profile_check [error message]
|