A functional form requires two files:

With the form selected, go to the Properties Panel and click the "Browse for File" icon next to the Action box. Select the .fcn (formication) file created to work with your form.
HTML code: <FORM method="POST" action="documentname.fcn">

Group check boxes or radio buttons together with a label or legend.
When you insert an HTML form object and you’ve selected the Form Object option in Accessibility preferences, Dreamweaver prompts you to enter information to make the form object accessible. You can also change accessibility attributes after inserting the object.
The Input Tag Accessibility Attributes dialog box appears.

Attach Label Tag using for uses the for attribute to wrap a label tag around the form item, as follows:
<input type="radio" name="radiobutton" value="radiobutton" id="radiobutton"> <label for="radiobutton">RadioButton2</label>This choice causes the browser to render text associated with a checkbox and radio button with a focus rectangle, and enables the user to select the checkbox and radio button by clicking anywhere in the associated text instead of just the checkbox or radio button control.
Note: This is the preferred option for accessibility; however, the functionality may vary depending on the browser.
Complete the dialog box.
Formication is a way of collecting data via a web interface. The formication script works with the html page.
Data can be sent to:
Options include:
<error>
<h1>Please include last name</h1>
</error>
<require lastname>
<error>
<h1> Please include your street address</h1>
</error>
<require street>
<error>
<h1> Please include your city</h1>
</error>
<require city>
<error>
<h1> Please include your state</h1>
</error>
<require state data_format state>
<error>
<h1> Please include your zip code</h1>
</error>
<require zip>
<mail>
To: cgordon2@siumed.edu
From: %email%
Subject: Library Form
===============================================
The following data was submitted:
===============================================
| First Name? | %firstname% |
| Last Name? | %lastname% |
| Street Address? | %street% |
| City? | %city% |
| State? | %state% |
| Zip Code? | %zip% |
| Gender? | %gender% |
| Requests? | %moreinfo%, %directions%, %money% |
</mail>
<response>
<html>
<head>
<title>Thank you</title>
</head>
<body bgcolor = "FFFFFF" text = "000000">
<h2>Thank you for completing our
form!</h2><br><br>
<p><a href="http://www.siumed.edu/lib">SIU Medical Library</a></p>
</body>
</html>
</response>
Example of an email generated by using a form:
Subject: Library Form
Date: Wed, 7 Nov 2001 12:48:49 -0600
From: webmaster@siumed.edu
To: cgordon2@siumed.edu
===============================================
The following data was submitted:
===============================================
| First Name? Last Name? Street Address? City? State ? Zip Code? Gender? Requests? |
Mortimer Snerd 1118 S. Walnut St. Springfield IL 62704 male send information, send directions, send money |
Requires 3 files: html file with form, fcn file, data file.
NOTE: You must set file read and write permissions for the data file.
<error>
<h1>Please include your name!</h1>
</error>
<require name>
<error>
<h1>Please select a sex!</h1>
</error>
<require sex>
<error>
<h1>Please input a color!</h1>
</error>
<require color>
<error>
<h1>Please input a food!</h1>
</error>
<require food>
<error>
<h1>Please input a lucky number!</h1>
</error>
<require number>
<savedata"test2.dat">
name sex color food number
</savedata>
<redirectto href="http://www.siumed.edu">
Requires 3 files: html file with form, fcn file, data file.
NOTE: You must set file read and write permissions for the data file.
<error>
<h1>Please include your name!</h1>
</error>
<require name>
<error>
<h1>Please select a sex!</h1>
</error>
<require sex>
<error>
<h1>Please input a color!</h1>
</error>
<require color>
<error>
<h1>Please input a food!</h1>
</error>
<require food>
<error>
<h1>Please input a lucky number!</h1>
</error>
<require number>
<savecustom "test3.dat">
Name = %name%
Sex = %sex%
Color = %color%
Food = %food%
Lucky Number = %number%
</savecustom>
<response>
<html>
<head>
<title>Thank you</title>
</head>
<body bgcolor = "FFFFFF" text = "000000">
<h2>Thank you for completing our
form!</h2><br><br>
<p><a href="http://www.siumed.edu/lib">SIU Medical Library</a></p>
</body>
</html>
</response>
<error>
<h1>Please include your name!</h1>
</error>
<require name>
<error>
<h1>Please enter a valid e-mail address!</h1>
</error>
<require email data_format email>
<error>
<h1>Please select a sex!</h1>
</error>
<require sex>
<securemail to="cmcintyre" from="cmcintyre" subject"Test 5">
Name = %name%
Sex = %sex%
</securemail>
<redirectto href="http://www.siumed.edu">
Function:
Validation of user input prior to web page submission.
Field Options:
Usage:
If a field is required, and the input needs to checked for a valid format:
'require field_name data_format formattype'
Example:
<require user_ssn data_format ssn>
If a field is not required, but you still want to check for a valid format, use the following syntax:
'data_format format_name fieldname thefieldname'
Example:
<data_format money fieldname total_cost>
The following data types can be validated:
| Data Type | Description of valid data |
|---|---|
name |
Alphas, hyphens, apostrophes, periods. No numbers allowed. |
Valid-looking email – must include @ and may include sub-domains |
|
state |
A valid 2-letter state or territory abbreviation as used by the USPS |
zip |
5 digits or 5 digits plus 4 digits with hyphen 44444 or 44444-4444 |
phone |
Standard U.S. 10 digit phone number. Dashes and parentheses are optional. (333) 333-3333 will pass, as will 555-555-5555. |
ssn |
xxx-xx-xxxx must include dashes |
sex |
m, f, male or female |
age |
1-99 |
time |
00:00 through 23:59 Must include 4 digits and colon |
military time |
Time in military format, i.e. 0400 2045 |
ip |
1.1.1.1 through 255.255.255.255 |
domain |
A valid-looking domain name. xxxx.(optional xxx).[com, biz, edu, net, mil, info, org, name, museum, aero, pro, coop] |
date |
MM/DD/YYYY must include slashes and a 4 digit year |
money |
Any number followed 2 decimal digits. $ is optional |
credit |
A valid credit card format– Visa, MasterCard, Discover and American Express. DOES NOT check for valid cards, only valid formats. |
comments |
Alphanumeric |
numbers |
Numeric only |
<error>
This is where the HTML code would go to display the specific error.
</error>
Description for error:
Error is used in conjunction with require, if a required field is not filled out from the form then the .fcn file reverts to the HTML code embedded in the error codeExample 1 has five different error statements, all five display a simple heading telling the user they did not include a required field. After the message is displayed the user then would have to click on the back button and fill in the necessary fields.
<require input_name>
Description for require:
Require looks at the input_name and then sees if it has been set or not. If there is no value given to that input name, require then calls the previous error block from the .fcn file. As you can see in Example 1, each error statement is placed before the require field, so that if the required field does not have any value it goes to the proper error message. If the required field does have a value, then it continues on down through the .fcn file.
--------------------------------------------------------------------------------
<redirectto href="Some web page address">
Description for redirectto:
This is pretty easy to understand. When the server gets to this part of the .fcn file and no errors have occured, it will automatically send the user to the desired webpage that you have input, just make sure it is a valid webpage.
--------------------------------------------------------------------------------
<savedata "filename">
input_name1
</savedata>
Description of savedata:
Delimited format, meaning after each field there is going to be a tab placed. Tab delimited data is very easy to import into an Excel worksheet and manipulate the data.
New data is appended to the end of the file.
Important:
Make sure that none of your data contains any tabs or it will
throw off your file's definition
Make sure that none of your data contains new line characters. New line characters occur when you have a textarea field on your form and you allow the user to separate lines by hitting the return key. If you allow them to use the return key it causes the data to be stored incorrectly in the file.
Note:If you have several hundred fields you want to put in your file, to make it easier to read you can have several input names on each line. The end result of this procedure will be one line of data for each entry from the form. The reason being, the savedata function ignores any white space and therefore creates one line of data in your file. Also if the file does already exist and is not blank, it appends the new data to the end of the file.
-------------------------------------------------------------------------------
Description: %field1%
Description: %field2%
Description for savecustom:
--------------------------------------------------------------------------------
<mail>
To: e-mail address to be sent to
From: e-mail address of person sending it
Subject: A subject for the e-mail
Then the body of the e-mail message.
</mail>
Description for mail:
From Example 1
Notice that there are certain words contained in percent signs, those are the input fields from the form. So %email% is the e-mail address that the user will input on the form page. And within the body of the message I have put the name and the sex the user has entered. In order to get the value of an input field from a form, you must remember to give that input a name when typing the HTML code.
--------------------------------------------------------------------------------
<securemail to="receiver" from="sender"
subject="foobar">
Body of e-mail message.
</securemail>
Description for securemail:
SECURE FORMS - Consult with Paul Fleming, 217-545-4194, pfleming@siumed.edu. The secure form and formication file will need to go on the secure web site. Your link to the secure form will begin with https:// rather than http://
When making a form to send information to a tab delimited file or a custom file, after putting the file up on the server you must set read and write permission for everyone.
Step 1 - Open and expand the Files panel so that both the local files and remote server are showing:
Step 2 - Right click on the data file on the Remote server side and choose Set Permissions...

Step 3 - Check the box to allow everyone to write to the file.

People to contact for assistance with forms:
| Carol Gordon, Medical Library | 217-545-7452 | cgordon2@siumed.edu |
| Paul Fleming, Information Resources | 217-545-4194 | pfleming@siumed.edu |