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 on-the-fly as you're working with the wizard.

The wizard requires two things in order to add questions to a form: a prompt and an input type. A prompt is a succinct line of text that asks a question or describes a group of related questions. The input type represents the structure of the information collected in response to the prompt.

Ask a Simple Question

Several of the wizard's input types determine how a single question can be answered . They include the following:

  • date ” A calendar date

  • time ” A time

  • number ” A numeric value

  • range ” A number from 1 to 5 that's used to rate something

  • string ” A single line of text

  • paragraph ” Text that can be longer than a single line

  • boolean ” A response limited to one of two options, such as yes or no, true or false, and on or off

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.

graphics/40fig01.gif

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 characters , and make other decisions that affect how the form will be used.

One of the things you must customize about a question is the name of its variable , which is a place in a computer program where information can be stored for later use. Variables are used in Web forms to keep track of how questions have been answered. Each variable is given a name that can be used to retrieve or modify its value.

A variable's name should describe its purpose. You can use any combination of letters , numbers , and the underscore character (_) when you're naming variables. For example, three appropriate names for the "convicted of a crime" question are Convictions, Any_Convictions , or CriminalRecord .

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:

  • one of several options ” A single item can be picked from the list.

  • any of several options ” An unlimited number of items can be picked (including none).

The prompt should identify what the list is being used to answer.

Each choice in a list must be a single line of text. Single-choice lists can be presented in three different ways on a Web page: a drop-down menu, radio buttons , or a list. All of these are shown on the portion of a Web page displayed in Figure 40.2.

Figure 40.2. Three ways a list of options can be presented.

graphics/40fig02.gif

As shown, a drop-down menu shows only one possible answer at a time. If you click the arrow next to the answer, a menu of other answers will appear. Radio buttons and lists show several possible answers.

graphics/bookpencil_icon.gif

To make a drop-down menu easier to understand, use the visible answer to provide explanatory text such as "Click to make your selection." This also prevents the visible answer from being picked more often than other answers simply because it is automatically displayed.


A multiple-choice list enables the user to select more than one answer from a list. Each possible answer is shown next to a check box. A single-choice list restricts the answer to a single item in the list. Both types of lists must have a named variable to store answers in.

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.

graphics/40fig03.gif

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:

  • contact information ” Name, title, address, phone number, and other identification

  • account information ” Username and password

  • product information ” Product name, product version, and serial number

  • ordering information ” Products to order, billing information, and a shipping address

  • personal information ” Name, age, physical characteristics, and related information

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 contact information input type was selected. The figure shows all of the customization options offered with the contact information input type. The Name and E-mail address questions are selected.

Figure 40.4. Selecting which contact information questions to use on a form.

graphics/40fig04.gif

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 numbered list

  • A bulleted list, in which each question is indented with a bullet character (like the list you're currently reading)

  • A definition list

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 cells on the table, making the form appear more organized. The borders of this table will not be visible when the form is created.

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 owners of a company's bread- makers . The upper version of the form is formatted with a table, which lines up the questions and possible answers evenly in two columns . The lower version does not use a table.

Figure 40.5. Arranging a form with and without a table.

graphics/40fig05.gif

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:

  • save results to a web page

  • save results to a text file

  • use custom CGI script

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.

graphics/40fig06.gif

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 subsequent line will contain a set of results.

The following output contains the same form results shown in Figure 40.6, saved to a text file instead:

[View full width]
 
[View full width]
"Personal_FullName" "Personal_DateOfBirth" "Personal_Sex" "Personal Height" graphics/ccc.gif "Personal_Weight" "John Q. Public" "01/11/65" "Male" "5' 8""" "175" "Jane R. Public" "07/20/61" "Female" "5' 2""" "100"

This text file uses Tab characters to separate each field: Personal FullName , Personal DateOfBirth , Personal Sex , and Personal Height . A format like this is less readable to humans than HTML, but much more readable to database software.

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.

graphics/bookpencil_icon.gif

A FrontPage Web's _private subfolder is a useful place to save form results that shouldn't be viewed by the people who visit your site. To save results to this folder, precede the filename with the text _private/ . Also, make sure that access permissions for that folder have been established correctly.


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.



Sams Teach Yourself Office Productivity All in One
Sams Teach Yourself Office Productivity All in One (Sams Teach Yourself All in One)
ISBN: 0672325349
EAN: 2147483647
Year: 2003
Pages: 474
Authors: Greg Perry

flylib.com © 2008-2017.
If you may any questions please contact us: flylib@qtcs.net