Form Decode: Form Decode and Template File

Relationship of Form Decode and template file

The function of template file is to replace the special characters in the template according to the details entered through Form Decode.

Example

Enter “Asahi, Taro” in the text area of Form Decode and send.

How Form Decode is shown
Name
Form Decode tag Name<input type="text" NAME="NAME">

The $VAL{variable name} of the template file reads the details entered in the form which has the same NAME attribute with the variable name.

Character string of template Name:$VAL{NAME}

Result

How it is shown Name:Asahi, Taro

Special character string used in template

This section explains about special character strings used when creating a template.

List of character strings

  • $VAL{variable name}
  • $_IF{VAL,variable name,comparison value,result value 1,result value 2}
  • $_SELECT{VAL,variable name,comparison value 1,result value 1,comparison value 2,result value 2,...}
  • $_DUMPVAR{VAL}
  • $$

$VAL{variable name}

The character string $VAL{variable name} is replaced with the details entered in the form which has the same NAME attribute with the variable name. This is mainly used in templates for text box and text area.

Example: Text area

Enter “Cheap” in the text area of Form Decode and send.

How Form Decode is shown
Comment
Form Decode tag Comment<br>
<textarea NAME="comment" ROWS="4" COLS="30"></textarea>

The $VAL{variable name} of the template file reads the details entered in the form which has the same NAME attribute with the variable name.

Character string of template Comment:$VAL{comment}

Result

How it is shown Comment: Cheap

$_IF{VAL,variable name,comparison value,result value 1,result value 2}

$_IF{...} is used for questions choosing from two choices or allowing multiple choices.
The character string of $_IF{...} is replaced with “result value 1” if the chosen details of Form Decode with the same NAME attribute matches with “comparison value 1”, and “result value 2” if not.
This is mainly used for templates for radio button and checkbox.

Example: Radio button

Choose “Male” from the radio button list and send.

How Form Decode is shown
Gender Male Female
Form Decode tag Gender <input type="radio" NAME="gender" VALUE=" male">Male <input type="radio" NAME="gender">Female

The $_IF{...} of the template file reads the details entered in the form which has the same NAME attribute with the variable name.

Character string of template Gender:$_IF{VAL,gender,male,Male,Female}

Result

How it is shown Gender: Male

Example: Checkbox

Choose “United States” and “France” from the checkbox list and send.

How Form Decode is shown
Where do you want to go? (You can choose more than one answer)
United States
China
France
Germany
Form Decode tag Where do you want to go? (You can choose more than one answer)<br>
<input type="checkbox" NAME="usa" VALUE="country">United States<br>
<input type="checkbox" NAME="china" VALUE="country">China<br>
<input type="checkbox" NAME="france" VALUE="country">France<br>
<input type="checkbox" NAME="germany" VALUE="country">Germany

The $_IF{...} of the template file reads the details entered in the form which has the same NAME attribute with the variable name.
Here, result value 2 is left blank.
Also, a slash (/) is placed at the end of the country name of result value 1 so that it is easier to read after the process has been completed.

Character string of template Where do you want to go?: $_IF{VAL,usa,country,United States/,} $_IF{VAL,china,country,China/,} $_IF{VAL,france,country,France/,} $_IF{VAL,germany,country,Germany/,}

Result

How it is shown Where do you want to go?: United States/France/

$_SELECT{VAL,variable name,comparison value 1,result value 1,comparison value 2,result value 2,...}

Use $_SELECT{...} if you wish to have just one result from a multiple choice question.
The character string of $_SELECT{...} is replaced with “result value 1” if the chosen details of Form Decode with the same NAME attribute matches with “comparison value 1”, and “result value 2” if it matches with “comparison value 2”.
This is mainly used for templates for radio button and pull-down menu.

Example: Pull-down menu

Select Red from the pull-down menu and send.

How Form Decode is shown
What is your favorite color?
Form Decode tag What is your favorite color?
<SELECT NAME="color">
<option selected>Please choose.</option>
<option VALUE="red">Red</option>
<option VALUE="blue">Blue</option>
<option VALUE="yellow">Yellow</option>
</select>

The $_SELECT{...} of the template file reads the details entered in the form which has the same NAME attribute with the variable name.

Character string of template What is your favorite color?:$_SELECT{VAL,color,red,Red1,blue,Blue,yellow,Yellow}

Result

How it is shown What is your favorite color?: Red

$_DUMPVAR{VAL}

A character string required for the confirmation page template. Copy and paste it between <form> and </form> of the template.
It can be written anywhere if it is between <form> and </form>.

$$

If you are writing a dollar sign “$” in the template file other than using in the special character string, make sure to write two dollar signs like “$$”.

Example

Example of how to write a template file

How it is written in template file This food is $$10.

The $$ in the template file will be replaced with $.

How it is shown This food is $10.
Back to top of the page