Form Fields

For each form field the script will automatically create a placeholder with the same name as the form field. That comes in handy If an error occurs (i.e. the user forgot to fill in a required field) and the form appears again, the script can pre-populate the form fields so the user doesn't have to fill in all fields again. For example:

<input type="text" name="lastname" value="{lastname}">

The script will replace {lastname} with the value that the user entered before he submitted the form.

You can add as many fields to a form or change the fields of the example forms that come with the script. Please make sure that the field names and the placeholder names do not contain white spaces, or special characters. They may have underscores (first_name), though.

Select Menus

The script can process select menus like following:

<select name="" size="">
  <option value=""></option>
  <option value=""></option>
</select>

The script can also process multiple select fields. You can find an example in the HTML template /templates/example_multiples/form.tpl.html.

In order to make sure that the user's selection appears after submitting the form for preview, you can use a special placeholder.

<select name="Salutation" size="2">
  <option value="Mr" {select:Salutation=Mr}>Mr</option>
  <option value="Ms" {select:Salutation=Ms}>Ms</option>
</select>

The placeholder {select:Salutation=Ms} consists of the following elements. In the first position is the type of form field you are using. In this case it is a select menu (= select). After that follows a colon (:). In the second position is the name of the form field. In the example above that is Salutation. After that an equal sign (=) follows. At the last position comes the value of the option tag (value="").

To make the selected value appear within the mail template, you need to enter the field name surrounded by curly brackets { } in the mail template, i.e. {Salutation}

In case a user did not select one of the options the script removes the placeholder from the mail template.

If you want a select field to be a required field and you have listed it in the required_fields form field, the first option of the list has to have an empty value. Otherwise the script will not show an error.

<select name="Salutation" size="2">
  <option value="">Please select</option>
  <option value="Mr" {select:Salutation=Mr}>Mr</option>
  <option value="Ms" {select:Salutation=Ms}>Ms</option>
</select>

You can find more examples in the template /examples/advanced_form.tpl.html.

Checkboxes

The script can process checkbox fields like following:

<input type="checkbox" name="" value="" />

The script can also process multiple checkbox fields. You can find an example in the HTML template /templates/example_multiples/form.tpl.html.

In order to make sure that the user's selection appears after submitting the form for preview, you can use a special placeholder.

<input type="checkbox" name="Newsletter" value="Yes" {checkbox:Newsletter=Yes} />

The placeholder {checkbox:Newsletter=Yes} consists of following elements. In the first position is the type of form field you are using. In this case it is a checkbox field (= checkbox). After that a colon (:) follows. In the second position is the name of the form field. In the example above that is Newsletter After that follows an equal sign (=). In the last position is the value of the option tag (value="").

In order for the selected value to appear in the mail template, you need to enter the name surrounded by curly brackets { } in the mail template, i.e. {checkbox:Newsletter}.

You can find more examples in the template /examples/advanced_form.tpl.html.

Radio Buttons

The script can process radio button fields like following:

<input type="radio" name=" " value="" />

In order to make sure that the user's selection appears after submitting the form for preview, you can use a special placeholder.

<input type="radio" name="Salutation" value="Mr" {radiobutton:Salutation=Ms} />

The placeholder {radiobutton:Salutation=Ms} consists of the following elements. In the first position is the type of form field you are using. In this case it is a radio button field (= radiobutton). After that follows a colon (:). In the second position is the name of the form field. In the example above that is Salutation. After that follows an equal sign (=). In the last position is the value of the option tag (value="").

In order to make the selected value appear in the mail template, you need to enter the name surrounded by curly brackets - { } - in the mail template, i.e. {Salutation}.

You can find more examples in the template /examples/advanced_form.tpl.html.

Required Form Fields

Every form field can be marked as a required field. This means that the e-mail will not be sent until these fields are filled in. Enter a comma separated list of field names that you want to be required into a hidden form field with the name required_fields. For example:

<input type="hidden" name="required_fields" value="lastname, email, subject" />

This will make the form fields lastname, email and subject required fields.

E-mail Syntax

Like the required fields you can define fields that you want to be checked for correct e-mail syntax. Enter a comma separated list of field names that you want to be checked in a hidden form with the name email_fields. For example:

<input type="hidden" name="email_fields" value="email_1, email_2" />

Compare Two or More Fields

The script allows you to compare the content of two or more fields. An error message will be displayed if the content is not identical. Possible use would be for confirming an e-mail address or password. Put following hidden field to your form:

<input type="hidden" name="compare_fields[]" value="email, confirm_email" />

The line above would tell the script to test whether the fields email and confirm_email contain the same value.

The number of different sets of fields the script can check is not limited.

<input type="hidden" name="compare_fields[]" value="email, confirm_email" />

<input type="hidden" name="compare_fields[]" value="password, confirm_password" />

Thank You Page

After the form has been submitted the user will be presented with a confirmation message and the data he just entered in the form. You can change this and let the user be redirected to a special thanks page. You can define the URL of that page in a hidden form field with the name thanks. For example:

<input type="hidden" name="thanks" value="http://www.example.com/thanks.html" />

Please enter the whole URL including http:// and the domain name (i.e.: http://www.example.com/).

If you don't define this field or leave it empty the script displays the data entered by the user.

Error Page

If a form is being submitted and a required field wasn't filled in, the script shows an error message above the form. Alternatively you can tell the script to redirect to an error page that tells the user about the error. The user then has to go back to the form page and fill out the rest of the fields.

You can define the URL of that page in a hidden form field with the name thanks. For example:

<input type="hidden" name="error_page" value="http://www.example.com/error.html" />

Please enter the whole URL including http:// and the domain name (i.e.: http://www.example.com/).

Define HTML Template

If you are calling the script from an existing form in a HTML page and you do not want to use the default HTML file, you can define a different HTML file in a hidden form field with the name html_template. For example:

<input type="hidden" name="html_template" value="form.tpl.html" />

Define Mail Template

The mail template can be defined the same way. You have the option to define a single mail template. For example:

<input type="hidden" name="mail_template" value="mail.tpl.txt" />

You can also define more than one mail template. Each of these templates can contain different recipients and content. For example:

<input type="hidden" name="mail_template" value="mail.tpl.txt, mail2.tpl.txt" />