Home > The Template System > Process Templates > The Form Processor Template

Table of Contents

DotAdmin User Guide

The Form Processor Template

The dotAdmin form processor can be configured to output any site page after processing form data (see the “Forms” page elsewhere in this documentation for details). However, by default, the form processor will use it's own process template form to dynamically generate its output.

Form processor failed form submission - “error” output
Form processor failed form submission - “error” output.

Form processor successful “thankyou” output
Form processor successful form submission - “thankyou” output.

The form template is broken into two main blocks

BLOCK {thankyou}

Successful form submissions will cause the form processor to display this block. This block should contain your default “thankyou” message:

<!--BLOCK {thankyou}-->
<p>Thankyou for your message.
We will deal with your information as quickly as possible.</p>
<!--/BLOCK {thankyou}-->

Form template “thankyou” message.

BLOCK {error}

This block will be displayed if a form submission fails. A form submission can fail for one or more of two reasons:

Missing required fields
If one or more of the specified required fields is not filled in, the form processor will generate an error. The form processor will add another row to BLOCK {missing_fields} for each missing required field.
Badly formed email address
If the email field in the form is set as required, and the content of the email field is not a properly formatted email address, the form processor will generate an error. The form processor will display the {bad_email} element.

To simply display the two main errors, we could use the following code:

<!--BLOCK {error}-->
<p><b>Error</b>
<!--IF {bad_email}-->
<br />The email address that you entered was not valid.
<!--/IF {bad_email}-->
<!--IF {missing_fields}-->
<br />You did not fill in all of the required form fields.
<!--/IF {missing_fields}-->
<br />Please <a href="javascript:history.go(-1)"
 title="Return to the form">Go Back</a> and try again.</p>
<!--/BLOCK {error}-->

Basic error output.

If a form submission fails on 1 or more missing fields and a bad email address, the above example would create the following output:

Error
The email address that you entered was not valid.
You did not fill in all of the required form fields:
Please Go Back and try again.

We can use BLOCK {missing_fields} to display details of which fields were not filled in:

<!--BLOCK {error}-->
<p><b>Error</b>
<!--IF {bad_email}-->
<br />The email address that you entered was not valid.
<!--/IF {bad_email}-->
<!--IF {missing_fields}-->
<br />You did not fill in the following required form fields:
<!--BLOCK {missing_fields}-->
<br />
<b>{name}</b>
<!--/BLOCK {missing_fields}-->
<!--/IF {missing_fields}-->
<br />Please <a href="javascript:history.go(-1)"
 title="Return to the form">Go Back</a> and try again.</p>
<!--/BLOCK {error}-->

Extended error output, detailing which fields were missing from the form submission.

If a form submission fails on two missing fields and a bad email address, the above example would create the following output:

Error
The email address that you entered was not valid.
You did not fill in the following required form fields:
name
postcode
Please Go Back and try again.

Template Elements

Below is a list of all placeholders used in the Form template:

Placeholder Output
BLOCK {thankyou} This block is displayed if a form has been sucessfully submitted using the form processor. This block should contain a “Thankyou” message.
BLOCK {error} This block is displayed if there are problems with the submitted form, i.e. required fields which are missing and/or a badly formatted email address.
IF {bad_email} Inside BLOCK {error}, this will be displayed if the email address entered in the form is not properly formatted.
BLOCK {missing_fields} Inside BLOCK {error}, A repeating block containing the name of each missing required field in the submitted form.
{name} Inside BLOCK {missing_fields}, the name of the required field which is missing.