Steps to Publish a Form
- Determine what information your form will collect.
- What are the field names? Which are required fields and which are optional?
- Will the info be written to another web page, a database file, or sent via email?
- Using the text or HTML editor of your preference, create a new file, and add the basic HTML tags (
<body>, etc.). Inside the opening
<body>tag, add a
<form>tag. This will normally look like this:
<form method="post" action="/htbin/ponyexpress2">.
Before the closing
</body>tag, add a closing
</form>tag so you don’t forget to add this later.
- Add text fields, selection menus, buttons, etc. for each piece of information you want to collect. Make sure each element has a distinct NAME attribute, and where appropriate a VALUE (e.g., radio buttons):
Your school: <input type="text" name="school">
- Below the opening <form> tag, add the special “hidden” tags used by PonyExpress:
<input type="hidden" name="to" value="firstname.lastname@example.org">
<input type="hidden" name="subject" value="Comments on site">
<input type="hidden" name="return" value= "http://www.bu.edu/yoursite/thanks.html">
<input type="hidden" name="order" value="lastname,firstname,email, phone,department,comments">
<input type="hidden" name="required" value= "lastname,firstname,email, comments">
In addition to the above tags, you will often include other hidden tags depending on what your form will do.
- Don’t forget to add a “Submit” button so users can send their information and a “Reset” button so that they can revert their answers back to the defaults:
<input type="submit" value="Submit">
<input type="reset" value="Reset">
- To test your form, you will need to upload it to the server. FTP to webdev.bu.edu (departmental sites) or people.bu.edu (individual sites) and upload the file.Access the form on your site using your web browser. You should now be able to fill out and submit your form and receive an instant email containing the unformatted form data. It is often helpful to keep an active FTP session open while you make any needed changes to your form, so that you can quickly modify and re-upload the form during testing.
- Create the template files you will use. To format emails these will be the admin.message and/or visitor.message. To format web page output, you will create an output.template file.
- Use FTP to upload the templates into your form directory. Make sure also that you include a “form_location” hidden tag in your form and re-upload it if you haven’t already done so.
- You will need to create an output directory and activate your directory in order to have your form write to a web page or datafile. You can do this before or after creating the actual files in the directory. For departmental sites you will need to send us a request to do this for you. We will usually process these requests within one business day. Individuals on people.bu.edu will activate their own directories using the acledit command from ACS. Refer to the directory activation page.
- Finally, make any revisions to your form fields and the page layout and design before you link to the page. Submitting several test forms and looking at the email or web page output can help you refine your forms so they are both easier to use and collecting the appropriate information from the visitor. This final stage is obviously more important for large forms gathering lots of highly specific data, and less crucial for informal guestbooks.