Throughout this chapter, you learned how to publish on other servers ”Web hosting providers on the Internet. Publishing a Web in FrontPage is one of those
Chapter 40. Communicating with Web Forms
One of the
Create a Form with the Form Page Wizard
If you've never created a form before, the
Like other wizards in FrontPage, the Form Page Wizard asks a series of questions to determine what you'd like to add to your Web:
When all of this has been determined, the wizard will create a new page in the current Web and add the form to it. You can either use this page or transfer it to another page using copy and paste.
Call on the Wizard
The first step in using the Form Page Wizard is to add a new page to an existing Web by clicking File, New, Page. A list of templates and wizards that can be employed on the new page is shown.
When the Form Page Wizard is selected, you can immediately add questions to the form. You also can either remove or modify existing questions, which makes it easy to change things
The wizard requires two things in order to add questions to a form: a prompt and an input type. A
is a succinct line of text that asks a question or describes a
Ask a Simple Question
Several of the wizard's input types determine how a single question can be
Figure 40.1 shows the Form Page Wizard being used to add the question "Have you ever been convicted of a crime?" The input type for this question has been set to boolean , which limits responses to an either/or proposition such as yes or no. The string or paragraph input types could have been used instead, giving someone a chance to provide a more unstructured answer such as "Not since I quit using illegal drugs."
Figure 40.1. Adding a boolean question to a form.
Each of these questions can be customized once the input type and prompt have been defined. You can limit date and time answers to specific formats, restrict a string answer to a specific number of
One of the things you must customize about a question is the
A variable's name should describe its purpose. You can use any combination of
Choose from a List of Options
There are two input types in the Form Page Wizard that enable answers to be selected from a list of possible choices:
The prompt should identify what the list is being used to answer.
Each choice in a list must be a single line of text.
Figure 40.2. Three ways a list of options can be presented.
As shown, a drop-down menu shows only one possible answer at a time. If you click the arrow
A multiple-choice list enables the
Multiple-choice lists require a group of variables ”one for each possible choice that can be selected. Instead of providing a name for each of these variables, you provide a base name . This will be combined with the text of each answer to form variable names.
Figure 40.3 shows the Form Page Wizard being used to create a multiple-choice list. The list is used to answer the question "Which of the following languages do you speak?" One of four answers can be selected: English, Spanish, German, or Esperanto.
Figure 40.3. Providing answers and a base variable name for a multiple-choice list.
The base variable name is Speaks . The answers to this question will be saved in the variables Speaks_English, Speaks_Spanish, Speaks_German , and Speaks_Esperanto .
Ask Multiple Questions at Once
The remaining input types in the Form Page Wizard are used to ask several related questions at the same time. They include the following:
The Form Page Wizard automatically provides a prompt for each question in the group. If you provide your own prompt, it will be used to introduce the entire group rather than for any specific questions.
These combined input types make it easy to add some of the most common questions to a form. You can customize these questions by removing any questions that you don't want to ask.
In Figure 40.4, the Form Page Wizard is being used to customize a group of questions after the
input type was selected. The figure shows all of the customization options
Figure 40.4. Selecting which contact information questions to use on a form.
For some of these input types, the variable names will be provided by the wizard. Otherwise, a base variable name must be provided for the group of questions. This will be used by the wizard to associate a variable name with each question.
Determine How the Form Will Be Presented
After you've finished adding questions to a form, you can choose how the questions will be presented on a Web page. You can lay out the form as a series of paragraphs or as one of three different lists:
A definition list is a standard Web page element that's ideal for displaying a group of words and their definitions. The formatting varies depending on the browser being used. Generally, words are presented flush-left, and definitions are indented below the word they define. The following text is presented in the style of a definition list:
Do A deer; a female deer Ra A drop of golden sun Mi The name I call myself Fa A long, long way to run
On a form that's displayed as a definition list, questions are presented flush-left and possible answers are indented.
Another presentation decision you must make is whether to use tables when laying out your form. Tables can be used to arrange elements on a page. If you decide to use a table, the Form Page Wizard will place questions and answers into their own
If you decide not to use a table, questions and answers will be arranged more loosely as a series of paragraphs.
Figure 40.5 shows a Web page that contains two versions of the same three-question form ”a survey for
Figure 40.5. Arranging a form with and without a table.
Save the Information Collected on a Form
The last step in creating a form with the Form Page Wizard is to decide how a user's answers will be saved. The following three options are available:
To save a form's answers to a Web page or text file, you must be publishing your Web on a server that is enabled with FrontPage Server Extensions.
All answers submitted using the form will be saved to the same page. A question is identified on this form using its variable name followed by a semicolon. The answer to that question is presented on the following line. Figure 40.6 shows two sets of form results saved to a Web page.
Figure 40.6. Viewing a form's results that have been saved to a Web page.
Displaying results as a Web page is useful when you want to view the answers in an easy-to-understand format.
If you're going to use form results with other software (such as Microsoft Access or another database program), they should be saved to a text file. This file can easily be imported into a database program. The first line of the file will identify each of the form's variables, and each
The following output contains the same form results shown in Figure 40.6, saved to a text file instead:
[View full width]
This text file uses Tab characters to separate each field:
. A format like this is less readable to
When you save form results, you must name the file that will be used to store them. The Form Page Wizard will provide an .htm or .txt file extension for you, so all you'll need to choose is the name that precedes the extension. Results are saved in the same folder as the Web page that contains the form, unless you specify a different one along with the filename.
The file that contains form results can be loaded within FrontPage. If you'd like to delete all existing results, delete the file. A new file will be created automatically when new results are submitted using the form.
The final option for saving form results is to use a custom Common Gateway Interface ( CGI ) script. CGI refers to the use of special programs ”also called scripts ”that are run in conjunction with Web pages. A Web server that supports FrontPage offers a lot of the same functionality as a CGI program. The main use of CGI on the World Wide Web is to handle the results of Web forms.
CGI programs require special access to the Web server that's hosting your Web. You'll need to know the name of the CGI program to run and its location on the Web site.