E-Mail Fields (Article 1331)

Body

These hidden fields have the same name as the field they control except that they have a "_command" afterwards and the value may be text message to display to the user if the test fails. More than one command may be used for each field. The MAILTO program will search for any conditions that fail and display all the error messages at the same time. This means that the user may be presented with a list of things to correct rather than one item at a time.

_required

This command indicates that the specified field must be completed by the user before the email message is sent. As long as the user enters something, the test is satisfied. If nothing is entered, the text in the "value" clause is displayed. For example:

<input type="hidden" name="uname_required" value="Please enter your name">

will force the user to enter something in the field called "uname". If they do not enter anything, they will be told:

Please enter your name

_email

Check that the specified field could be a valid email address. The check that MAILTO carries out is to make sure the text entered has a "@" sign in it. Thus "mark" would fail and "mark@company.com" would succeed. Note that "mark@" would also succeed and that the domain name is not verified. If the check fails, the message in the "VALUE" part is displayed. For example:

<input type="hidden" name="email_email" value="Please enter your email address">

will force the user to enter an email address in the field called "email". If they do not enter anything they will be told:

Please enter your email address

_num

Check that the specified field contains a valid number. The following characters are allowed in a number:

0 1 2 3 4 5 6 7 8 9 0 + - . , E e

If anything else is entered the user will be presented with the text in the "value" field. For example:

<input type="hidden" name="age_num" value="Please enter your age in years">

will force the user to enter an number in the field called "age". If they do not enter anything they will be told:

Please enter your age in years

_display

This command can be used to place the values of variables supplied by the WWW server into the email message. The special field "*_display" will cause all variables from the WWW server to be displayed - this can be used to select those that may be of interest. The following values may be of interest:

SERVER_SOFTWARE - Name of the server software.
SERVER_NAME - Name of the WWW server.
SERVER_PROTOCOL - HTML protocol supported by the server.
SERVER_PORT - Port number of connection from remote client.
REMOTE_HOST - IP address of the remote client.
REMOTE_ADDR - IP Address of the remote client.
HTTP_USER_AGENT - The remote client software.
HTTP_REFERER - URL of the page where the form was entered.


Thus the command:

<input type="hidden" name="REMOTE_ADDR_display">
will add the field:

REMOTE_ADDR = 123.123.123.123

to the resulting email message.

_hidden

This command forces the variable to be excluded from the email message or file.