VForm Form Configuration
Once you've created a valid HTML form, configuring VForm is a simple matter of
including extra form fields using the special names that VForm recognizes.
Here's an example of a functional (but boring) form:
<form method=post action="/cgi-bin/vform">
<input type=hidden name="mailto" value="user@coastnet.com">
Please enter your name <input name="name" size=35>
<input type=submit value="Submit name">
</form>
The variables "name" and "mailto" would be e-mailed to user@coastnet.com. Below is a
list of form fields VForm understands and examples of how to use them:
mailto
This is the only required field. If not supplied within your form, then
a mailto comment must be included in a custom response page.
This form field allows you to specify to whom you wish your form results to be
mailed. Most likely you will want to configure this option as a hidden form
field with a value equal to that of your e-mail address. You can include any
number of these fields within the form to send the data to multiple
addresses.
Form Example:
<input type=hidden name="mailto" value="user@coastnet.com">
Response Page Example:
<!-- mailto:user@coastnet.com -->
subject
The subject field allows you to specify the subject that you wish to appear in
the e-mail message that is sent to you after your form has been filled out. If
you do not have this option turned on, then the script will default to a
message subject: VForm Response. Note: You should only define one subject
field. If you define more than one, they will be concatenated together, each
separated by commas.
Form Examples:
If you wish to choose what the subject is:
<input type=hidden name="subject" value="Your Subject">
To allow the user to choose a subject:
<input type=text name="subject">
Response Page Example:
<!-- subject:Your Subject -->
email
This form field will allow the user to specify their return e-mail address. If
you want to be able to return e-mail to your users, include this form field and
allow them to fill it in. This will be put into the Reply-To: field of the
message you receive.
Form Example:
<input type=text name="email">
realname
The realname form field will allow the user to input their real name. This
field is useful for identification purposes and will also be put into the
Reply-To: line of your message header.
Form Example:
<input type=text name="realname">
redirect
If you wish to redirect the user to a different URL, rather than having them
see the default response to the fill-out form, you can use this hidden variable
to send them to a pre-made HTML page.
Examples:
To choose the URL they will end up at:
<input type=hidden name="redirect"
value="http://your.address/to/file.html">
required
You can now require that certain fields in your form be filled in before the
user can successfully submit the form. Simply place all field names that you
want to be mandatory into this field. If the required fields are not filled in,
the user will be notified of what they need to fill in, and a link back to the
form they just submitted will be provided.
Examples:
If you want to require that they fill in the email and phone fields in your
form, so that you can reach them once you have received the mail, use a syntax
like:
<input type=hidden name="required"
value="email,phone">
sort
This field allows you to choose the order in which you wish for your variables
to appear in the e-mail message that VForm generates. You can choose to have
the field sorted alphabetically or specify a set order in which you want the
fields to appear in your mail message.
By leaving this field out, the order will simply default to the order in which
the user's browser sends the information to the script (which isn't always the
exact same order as they appeared in the form.)
When sorting by a set order of fields, you should include the phrase "order:"
as the first part of your value for the sort field, and then follow that with
the field names you want to be listed first in the e-mail message, separated by
commas. Any fields that you don't list will appear after those you've listed,
in the default order.
Examples:
To sort alphabetically:
<input type=hidden name="sort"
value="alphabetic">
To sort by a set field order:
<input type=hidden name="sort"
value="order:name1,name2,etc...">
hide_fields
This field allows you to specify that certain fields should not appear in the
e-mail message that VForm generates. This is handy for configuration fields,
like sort (see above), since they won't change from message to message.
Example:
To hide the mailto and sort fields from the e-mail message:
<input type=hidden name="hide_fields"
value="mailto,sort">
title
This form field allows you to specify the title and header that will appear on
the resulting page if you do not specify a redirect URL.
Example:
If you wanted a title of 'Feedback Form Results':
<input type=hidden name="title"
value="Feedback Form Results">
return_link_url
This field allows you to specify a URL that will appear, as return_link_title,
on the following report page. This field will not be used if you have the
redirect field set, but it is useful if you allow the user to receive the
report on the following page, but want to offer them a way to get back to your
main page. Note: You must also specify 'return_link_title' (see below) for this
to work.
Example:
<input type=hidden name="return_link_url"
value="http://your.host.xxx/main.html">
return_link_title
This is the title that will be used to link the user back to the page you
specify with return_link_url. The two fields will be shown on the resulting
form page as:
<ul>
<li><a href="return_link_url">return_link_title</a>
</ul>
Example:
<input type=hidden name="return_link_title"
value="Back to Main Page">
background
This form field allow you to specify a background image that will appear if you
do not have the redirect field set. This image will appear as the background to
the form results page.
Example:
<input type=hidden name="background"
value="http://your.host.xxx/image.gif">
bgcolor
This form field allow you to specify a bgcolor for the form results page in
much the way you specify a background image. This field should not be set if
the redirect field is.
Example:
For a background color of White:
<input type=hidden name="bgcolor"
value="#ffffff">
text_color
This field works in the same way as bgcolor, except that it will change the
color of your text. This field should not be set if the redirect field is.
Example:
For a text color of Black:
<input type=hidden name="text_color"
value="#000000">
link_color
Changes the color of links on the resulting page. Works in the same way as
text_color. This field should not be set if the redirect field is.
Example:
For a link color of Red:
<input type=hidden name="link_color"
value="#ff0000">
vlink_color
Changes the color of visited links on the resulting page. Works exactly the
same as link_color. This field should not be set if the redirect field is.
Example:
For a visited link color of Blue:
<input type=hidden name="vlink_color"
value="#0000ff">
Any other form fields that appear in your script will be mailed back to you,
and displayed on the resulting page if you do not specify a custom response
page. There is no limit as to how many other form fields you can use with this
form, except the limits imposed by browsers and your server.