Chapter 22

Runtime Bots- The Heartbeat of FrontPage Forms


CONTENTS

Throughout this book, I've noted where pages contain features requiring that the FrontPage Server Extensions be on your remote server's site. The pages I referred to were mostly forms that incorporated one of FrontPage's runtime bots.

For the beginner, adding advanced features to Web pages can be a daunting task. FrontPage puts advanced features well within the capability of beginning page developers with the use of its advanced bots. These bots work with the server at runtime to process information; they allow a user to submit requests or information to your site that you can use many different ways.

What These Bots Do

What are these runtime bots, and why are they so special? Well, if it weren't for these bots, you'd need to write custom scripts to instruct your server how to handle the forms you create. This isn't an easy task for a beginner, which is one reason there are as many books on scripting languages as there are on HTML programming. Scout the shelves in your local bookstore sometime, and you'll see rows of books on CGI, Perl, Java, JavaScript, VBScript, and countless other languages that can be used with your Web pages. With these scripting languages, you can add functionality to your Web pages-if you want to get into programming, that is.

For those who don't want to learn all those other programming techniques, you have the FrontPage bots to fall back on, which are really nothing more than custom CGI scripts designed to work with the FrontPage Server Extensions-like the plug-and-play of Web pages.

Five bots work with forms: the WebBot Discussion Component, the WebBot Registration Component, the WebBot Save Results Component, the WebBot Search Component, and the Confirmation Field bot. You may choose any but the WebBot Search Component and the Confirmation Field bot when you configure a form handler for your form. The WebBot Search Component and Confirmation Field bot are inserted with the Insert | WebBot Component command but do work with form fields, as you will learn later in this chapter.

Why These Bots Need the FrontPage Server Extensions

You might ask "Why do these bots need the Server Extensions, but the ones discussed in Chapter 14 don't?"

The bots you learned about in Chapter 14, "Automating Pages with Bots," don't require the FrontPage Server Extensions because they don't need user input to function. You control the content of those bots at design time, and their content is placed onto your pages in conventional form once your pages go out on the Web.

The runtime bots discussed in this chapter are basically CGI scripts written to be compatible with FrontPage and the Windows 95 or Windows NT operating system. They work seamlessly with FrontPage's Personal Web Server and the Microsoft Personal Web Server, which is why you can test the forms with your favorite browser while these Personal Web Servers are running.

More often than not, when your Web pages are placed "out there," they reside on a server that runs on a UNIX or Windows NT operating system. The runtime bots process the user's entries when he or she clicks the Submit button on your form. An executable file in your FrontPage-enabled Web site translates the data from your FrontPage form into language the UNIX or Windows NT server expects to see. That executable file is part of the FrontPage Server Extensions that need to reside on your remote server. In this case, the server extensions act as the go-between from the FrontPage bots to your server's operating system.

When Your Server Doesn't Have the Server Extensions

If your service provider doesn't have the FrontPage Server Extensions installed, you do have other options for adding interactivity to your Web site.

To use these alternative options, you need to understand how to work with other scripting languages. Unfortunately, it gets rather involved to discuss the different options and types of forms you can configure with scripts on a case-by-case basis. That subject goes far beyond the scope of this book, because so many variables come into play, such as using platform or browser-specific scripts, assigning directory permissions, and other advanced topics requiring some knowledge of the scripting language or languages you want to use.

Here are some options you can use to add forms to your pages:

With the basic information out of the way, the following sections will explain what each of the bots does and how you can use and configure them.

WebBot Discussion Component

In Chapter 19, "Can We Talk?," you learned how to add discussion groups to your Web site by using templates and wizards, but you can also create your own discussion groups with the WebBot Discussion Component. This bot enables you to create an online discussion on your Web site. It collects information from a form, formats the results into an HTML page, and adds the new page to a table of contents and to a text index. It also gathers information from the form and stores it in one of several formats.

WebBot Registration Component

In Chapter 19, you also learned that it was possible to create a protected discussion in which you could register an end user for participation in a closed section of your Web site. The registration form that is placed in your root web uses a WebBot Registration Component. This bot does not allow access to a web unless users enter their names and passwords. A WebBot Registration Component adds the user name and password to the server's authentication database and then gathers information from the form and stores it in one of several formats, as discussed in "Configuring a Results File," later in this chapter.

WebBot Save Results Component

The WebBot Save Results Component is the general-purpose form handler in FrontPage. It is used for many types of forms. Survey forms, guest books, information forms, and online ordering forms are some examples of what you can do with a WebBot Save Results Component. It gathers information from a form and stores it in a variety of Web page and text formats.

WebBot Search Component

The WebBot search component creates a list of links to pages containing one or more words-that is, the search term-entered by the user in the form. The results returned to the user list pages in which his or her search term appears. The list can also include the file's date and size and the score for the quality of the search term's match.

Confirmation Field Bot

When a user submits a response to a form on your page, you use a confirmation page to acknowledge his or her post. For this type of page, you use the Insert | WebBot command to place a Confirmation Field bot on your page for each name/value pair you want to acknowledge. The Confirmation Field bot retrieves the information the user entered into your form and places his or her response on the confirmation page.

Assigning a Form Handler to a Form

To use any of the bots mentioned in this chapter, you first develop a Web page containing form fields appropriate for the type of bot you're assigning. After you design the form, assign one of the bots as a form handler by following these steps:

  1. Right-click anywhere inside the form (the area enclosed by dashed lines).
  2. Choose Form Properties from the pop-up menu to open the Form Properties dialog box, shown in Figure 22.1.
    Figure 22.1 : Use the Form Properties dialog box to assign a form handler to a form.

  3. Select the type of form handler from the Form Handler field. You can choose one of the following options:
    Custom ISAPI, NSAPI, or CGI Script
    Internet Database Connector
    WebBot Discussion Component
    WebBot Registration Component
    WebBot Save Results Component
  4. Click Settings to configure the form handler. Edit the form handler settings as outlined in the tasks in the following sections.
  5. Click OK to exit the Settings dialog box.
  6. Click OK to close the Form Properties dialog box.

Creating a Discussion Form

You can add a WebBot Discussion Component to a page that you create yourself. You need at least the following pages to completely configure a WebBot Discussion Component:

The easiest way to add a discussion group to your Web site is to use the Discussion Wizard, discussed in Chapter 19. This wizard streamlines the process of creating a discussion group, because the required forms and pages are automatically created and linked for you. You can then use the procedures outlined in the following numbered steps to configure or revise the WebBot Discussion Component on the discussion submission form. An example of a submission form is shown in Figure 22.2.

Figure 22.2 : The Discussion Web Wizard generates a submission form that uses a WebBot Discussion Component.

To add and configure a WebBot Discussion Component, follow these steps:

  1. Design the form fields for your discussion submission form. The example shown in Figure 22.2 contains a Subject text box, Category drop-down menu, From text box, Comments scrolling text box, and Post Article and Reset Form pushbuttons.
  2. Right-click anywhere in the form and choose Form Properties from the pop-up menu. The Form Properties dialog box appears.
  3. From the Form Handler drop-down menu, choose WebBot Discussion Component.
  4. Click Settings to configure the WebBot Discussion Component. The Settings for Discussion Form Handler dialog box appears. By default, it opens to the Discussion tab.

Configuring the Discussion

Use the Discussion tab of the Settings for Discussion Form Handler dialog box, shown in Figure 22.3, to configure the discussion and its table of contents arrangement. The steps to configure the WebBot Discussion Component follow:

Figure 22.3 : Use the Discussion tab to configure your discussion articles.

  1. Enter a title for the discussion group in the Title field. This title appears on the main pages and articles in your discussion.
  2. In the Directory field, enter a directory name in which to place the discussion group articles. The directory name must be preceded by an underscore. The directory name shown in Figure 22.3 is _discussion.

NOTE
To view the discussion group articles in the FrontPage Explorer, choose Tools | Web Settings, click the Advanced tab, and check Show Documents in Hidden Directories.

  1. In the "Table of contents layout" section, complete the following:
  2. Form fields. In this section of the dialog box, enter the fields you want to appear at the top of the discussion articles, separating each with a space (for example, Subject Category Comments).
    Time. If you select this option, the table of contents includes the time an article was written.
    Date. If you select this option, the table of contents includes the date an article was written.
    Remote computer name. If you select this option, the table of contents includes the remote computer name of the article's author.
    User name. If you select this option, the table of contents includes the name of the article's author.
    Order newest to oldest. Uncheck this option to sort the articles in the order in which they were created, but check it to place the most recent articles at the top of the table of contents.
  3. If you want to use a style sheet from your current Web site, enter the URL of the style sheet in the "Get background and colors from page (optional)" field, or use the Browse button to select a page from your current Web site.
  4. Click the Article tab to continue with the article settings.

Configuring the Discussion Articles

You use the Article tab, shown in Figure 22.4, to configure the articles in the discussion.

Figure 22.4 : Use the Article tab to assign a header and footer to your discussion articles.

To configure your articles, follow these steps:

  1. To configure the discussion articles, click the Article tab in the Settings for Discussion Form Handler dialog box.
  2. Enter the URL of the article header in the "URL of Header to Include" field, or use the Browse button to select a page from your current Web site.
  3. Enter the URL of the article footer in the "URL of Footer to Include" field, or use the Browse button to select a page from your current Web site.
  4. From the "Additional information to include" section, select any or all of the following items to include on each discussion article:
    Time. If you select this option, the article includes the time it was written.
    Date. If you select this option, the article includes the date it was written.
    Remote computer name. If you select this option, the article includes the remote computer name of its author.
    User name. If you select this option, the article includes the author's name.
  5. Select another tab in the Settings for Discussion Form Handler dialog box, or choose OK to assign the WebBot Discussion Component properties to your form.

Configuring the Discussion Confirmation Page

Use the Confirm tab of the Settings for Discussion Form Handler dialog box, shown in Figure 22.5, to configure the confirmation page and validation page for the WebBot Discussion Component. The steps follow.

Figure 22.5 : Use the Confirm tab to configure the confirmation page and validation page for your discussion.

  1. In the "URL of confirmation page (optional)" field, enter the name of the page that you use to confirm the user's submission to your discussion. Enter the URL, or use the Browse button to select a page from your current web.
  2. Use the "URL of validation failure page (optional)" field to specify the page that is returned to the user when the form fields do not meet validation requirements. Enter the URL, or use the Browse button to select a page from your current web.
  3. Click OK to apply the form handler settings to your form.

Creating Your Own Registration Pages

You use the WebBot Registration Component when you design a form that registers a user for an event or to gain entry to a protected Web page on your site. In Chapter 19 you learned that you can create a discussion group in which only registered users can participate. When you select this option, the Discussion Web Wizard generates a web self-registration form (shown in Figure 22.6), which is placed in your root web, as outlined in "Saving a Registration Page for a Protected Web," later in this chapter. This form uses a WebBot Registration Component. FrontPage gives you two templates to help you develop your own registration forms:

Figure 22.6 : WebBot Registration Components are used on user registration forms to register for a product or an event.

You can use either of the templates as guidelines to create your own registration form; follow these steps:

  1. Design the form fields for your registration form. The example in Figure 22.6 includes a text field for the User Name, a password text field for the Password entry, and another password text field for the Verify Password entry. There are also two pushbuttons-one to submit the form and one to reset the form.
  2. Right-click anywhere in the form and choose Form Properties from the pop-up menu. The Form Properties dialog box appears.
  3. From the Form Handler drop-down menu, choose WebBot Registration Component.
  4. Click Settings to configure the WebBot Registration Component. The Settings for Registration Form Handler dialog box, shown in Figure 22.7, appears. By default, it opens to the Registration tab.
    Figure 22.7 : Use the Registration tab to assign a restricted web to your registration form and to assign name and password fields.

  5. In the "FrontPage web name" field, enter the web name you're creating the registration form for. The web name URL is relative to the location of the root web. If you are registering a child web of the root, the URL looks something like this:
    /Registered
  6. In the "User name fields" field, enter the names of one or more form fields on the registration form, separating them by commas or spaces. The WebBot Registration Component constructs the user name from these fields. The values you enter here should agree with the fields you inserted in your form.
  7. In the "Password field" section, enter the name of the form field in which the user enters his or her password. In the registration form used in the example, this field is named Password.
  8. In the "Password confirmation field" section, enter the name of the form field in which the user enters his or her password confirmation. In the registration form used in the example, this field is named VerifyPassword.
  9. If you want the user to enter a secure password, check the "Require secure password" checkbox. When this is checked, the user must enter a password that has at least six characters and doesn't partially match his or her name. Password fields display an asterisk for each character entered by the user.
  10. In the "URL of registration failure page (optional)" field, enter a page URL or use the Browse button to select a page from your current Web site. The registration failure page is returned if the user makes an error in his or her name or password. If the user doesn't enter a name and password that appears in your server's authentication database, a failure page returns. This page can inform the user that he or she needs to enter a correct password to gain access to the page or Web site.
  11. Choose another tab in the Settings for Registration Form Handler dialog box, or click OK to configure the registration form.

Configuring a Results File

A results file is the page on your web that stores the data that was submitted by the user. This file can be a text file or an HTML file. Both the WebBot Registration Component and the WebBot Save Results Component (discussed in "Creating a General Form," later in this chapter) offer you a choice of configuring a results file. The Results tab, shown in Figure 22.8, is identical for both bots.

Figure 22.8 : Use the Results tab to identify the Web page in your current Web site that stores the user's responses.

You configure a results file for a WebBot Registration Component or WebBot Save Results Component as follows:

Both bots offer several choices for how you store the results from forms on your Web site. To configure the settings for the results file, follow these steps:

  1. Enter the name and location of the file in which to place the form results in the "File for results" field. If the file does not exist, the bot creates the file the first time the form is submitted. If you want to save your results file in text format, be sure to enter a .txt extension when you specify the filename.
  2. From the "File Format" drop-down menu, select the format you want to store the results file in. The first four options are used when you specify a results file with an .htm or .html extension. The latter four options are used when you specify a results file with a .txt extension. The choices follow:

NOTE
When you collect information you will read from a Web browser or from FrontPage, you have the option to supply an .html or .htm extension. This causes the FrontPage Server Extensions to generate the HTML at runtime, which could make your Web site slower as more results are appended to the page. You can also save your results in formatted text format or periodically edit the results page and paste its contents into another Web page on your server.

HTML. This is the default style. When you select this option, your results file is stored in an HTML page that uses normal text with line endings, as shown in Figure 22.9.
Figure 22.9 : A results file stored in HTML format.

HTML Definition List. When you select this option, your results file appears in a definition list. The names of the form fields appear as terms, and the values of the form fields appear as the definition. An example is shown in Figure 22.10.
Figure 22.10 : A results file stored in HTML definition list format.

HTML Bulleted List. When you choose this option, your results file appears in a bulleted list, as shown in Figure 22.11.
Figure 22.11 : A results file stored in HTML bulleted list format.

Formatted Text Within HTML. When you choose this option, your results file appears in formatted paragraphs with line endings, as shown in Figure 22.12.
Figure 22.12 : A results file stored in formatted text within HTML format.

Formatted Text. When you choose this option, the results file appears in formatted text, as shown in Figure 22.13.
Figure 22.13 : A results file stored in formatted text format.

Text Database Using Comma as a Separator. This option specifies a text file that uses commas to separate the values in the results file. An example is shown in Figure 22.14.
Figure 22.15 : A results file stored in the format text database using tab as a separator.

Text Database Using Tab as a Separator. This option specifies a text file that uses tabs to separate the values in a results file. Many database or spreadsheet applications allow you to import files of this type. An example is shown in Figure 22.15.
Figure 22.14 : A results file stored in the format text database using comma as a separator.

Text Database Using Space as a Separator. This option specifies a text file that uses spaces to separate the values in a results file, as shown in Figure 22.16. These files can be used with spreadsheet or database applications and are recommended for single-word responses to maintain proper formatting of the items in the database.
Figure 22.16 : A results file stored in the format text database using space as a separator.

  1. Check "Include field names in output" to save both the name and value of each form field. If you uncheck this option, only the responses from the user will be written to the file.
  2. In the "Additional information to save" section, choose any or all of the following additional items to save in the results file:
    Time. If you select this option, the results file includes the time it was written.
    Date. If you select this option, the results file includes the date it was written.
    Remote computer name. If you select this option, the results file includes the remote computer name of the respondent.
    User name. If you select this option, the results file includes the respondent's name.
    Browser type. If you select this option, the results file includes the type of browser the respondent used.
  3. Choose another tab in the Settings for Registration Form Handler (or Settings for Save Results Form Handler) dialog box, or click OK to apply the settings and exit the dialog box.

Configuring a Confirmation Page

Use the Confirm tab of the Settings for Registration Form Handler, shown in Figure 22.17, or the Settings for Saving Results of Form dialog box to configure the confirmation page and validation page for the WebBot Registration Component or the WebBot Save Results Component. The Confirm tabs are identical in each of these dialog boxes. The steps follow:
Figure 22.17 : Use the Confirm tab to configure the confirmation page and validation page for your registration page.

  1. In the "URL of confirmation page (optional)" field, enter the name of the page that you use to confirm the user's registration submission. Enter the URL, or use the Browse button to select a page from your current web.
  2. Use the "URL of validation failure page (optional)" field to specify the page that is returned to the user when the form fields do not meet validation requirements. Enter the URL, or use the Browse button to select a page from your current web.
  3. Choose another tab in the Settings for Registration Form Handler dialog box, or click OK to apply the form handler settings to your form.

NOTE
The confirmation page notifies the user that his or her response was received by the web. If you don't specify a confirmation page, the WebBot component generates and maintains one automatically for you. The confirmation page thanks the user for submitting the form and returns the contents of the form by using Confirmation Field bots.
You can enter one of three special attributes for a WebBot Registration Component confirmation page
  • Registration-Username designates the name of the user who is registering.
  • Registration-Password specifies the password of the user who is registering.
  • Registration-Error designates a sentence or two that describes an error condition at runtime.

Configuring a Second Results File

You can also choose to configure a second results file for the WebBot Registration Component or WebBot Save Results Component. You do this by using the Advanced Tab, shown in Figure 22.18, in the Settings for Saving Results of Form or Settings for Registration Form Handler dialog box.

Figure 22.18 : Use the Advanced tab to configure a second results file or additional field selections.

To configure a second results file for a WebBot Registration Component or WebBot Save Results Component, choose one of the following:

The available choices for a second results file are the same as those described previously, in the section "Configuring a Results File."

Adding Additional Fields

Your form might have more fields than those available to choose from in the first tab of the Settings for Registration Form Handler or Settings for Saving Results of Form dialog box. By default, the results file returns all information on the form itself. You can use the Advanced tab to specify which additional fields the WebBot Registration Component or WebBot Save Results Component returns.

To configure additional fields for a WebBot Registration Component or WebBot Save Results Component, choose one of the following:

Saving a Registration Page for a Protected Web

Figure 22.6 shows the registration form generated by the Discussion Web Wizard when you select to allow only registered users to participate in the discussion. As previously mentioned, this page must be located in the server's root web. The steps to complete this follow:

  1. After you press the Finish button in the Discussion Web Wizard to generate your discussion, the registration form appears in your web. Choose Tools | Show FrontPage Explorer. The FrontPage Explorer opens.
  2. From the FrontPage Explorer, choose Tools | Permissions. The Permissions dialog box appears.
  3. In the Settings tab, select "Use unique permissions for this web." Click the Apply button.
  4. Click the Users tab. Select "Only registered users have browse access." Click the Apply button.
  5. Choose OK to exit the Permissions dialog box.
  6. From the FrontPage Explorer, choose File | Open FrontPage Web. The Open FrontPage Web dialog box appears.
  7. Click the List Webs button. From the list of webs on your server, choose <Root Web>. Then click OK. The root web opens in the FrontPage Explorer.
  8. Choose Tools | Show FrontPage Editor, or switch to the FrontPage Editor from your taskbar.
  9. From the FrontPage Editor, choose File | Save. When FrontPage notifies you that the page was opened from another web and asks if you want to save it, answer Yes.

When and Where to Use the WebBot Save Results Component

The WebBot Save Results Component is used as a form handler for general forms you place in your web, such as the Feedback Form template, the Guest Book template, and the Survey Form template, shown in Figure 22.19. You can use any of these examples as guidelines to develop your own forms.

Figure 22.19 : You can use the WebBot Save Results Component for forms of a general nature.

Creating a General Form

To create a general form, use one of the previously mentioned templates or design your own form with the Form Page Wizard; these methods help make the form layout a lot easier. After your form is designed, you can assign the WebBot Save Results Component as follows:

  1. Using the steps outlined in the previous section, "Assigning a Form Handler to a Form," choose the WebBot Save Results Component. The Settings for Saving Results of Form dialog box appears.
  2. Use the steps outlined in the previous section, "Configuring a Results File," to complete the settings in the Results tab. This is the default tab for the dialog box.
  3. Use the steps outlined in the previous section, "Configuring a Confirmation Page," to complete the settings in the Confirm tab.
  4. Use the steps outlined in the previous sections, "Configuring a Second Results File" and "Adding Additional Fields," to complete the settings in the Advanced tab.

Creating and Configuring a Search Form

If your site is very large, including a search form in your Web site allows visitors to find topics of interest quickly and easily. There's really no hard and fast rule for where to put a search form in your web. The following list offers some ideas:

You can create a search form that searches your entire Web site, a portion of it, or only discussion articles. Figure 22.20 shows the search page that is generated by the Search Page template that you select from the New Page dialog box in the FrontPage Editor.

Figure 22.20 : You can configure a search form to search your entire Web site or just a portion of it.

To create a search form, follow these steps:

  1. Design the page on which you want to insert the WebBot search component. You'll want to add some text that instructs the user how to enter text into the search form fields.
  2. Position the insertion point where you want to place the search form.
  3. Choose Insert | WebBot Component, and choose Search from the Insert WebBot Component dialog box. The WebBot Search Component Properties dialog box, shown in Figure 22.21, appears.
    Figure 22.21 : You place a WebBot search component on your page to create a search form.

  4. Configure the WebBot search component in the WebBot Search Component Properties dialog box. The following settings can be configured in this dialog box:
    Label for Input. Enter the label that you want to appear before the text input field on the search form. The default text is Search for.
    Width in Characters. Enter the width in characters of the input field, or select the default of 20. Note that this doesn't limit the length of text the user can enter in the field; rather, it limits the width of the text entry box. Take care not to make the width too wide for the page.
    Label for "Start Search" Button. Enter the text you want to appear on the Start button or accept the default of Start Search.
    Label for "Clear" Button. Enter the text you want to appear on the Clear button or accept the default of Reset.
  5. Select the word list you want the WebBot Search Component to search through from the Word List to Search field. Enter one of the following:
  6. Configure additional options for the WebBot search component as follows:
    Score (Closeness of Match). Indicates the quality of the match to the text the user enters.
    File Date. Reports the date and time of the document that matches the user's search entry. The date reported is the date the document was last modified.
    File Size (in K bytes). Reports the size of the matching document in kilobytes.
  7. Choose OK to accept your selections and return to the FrontPage Editor.

Confirming Pages

When a user sends a response from a form to your site, it's nice to send them a thank you with a confirmation form. It lets users know that their information was received. The confirmation form can also include information about what you'll do with the information after you get it. For example, if you created a survey form, you can inform the user that once the survey is complete and tabulated, you'll post the results on your site. The confirmation page can be as simple as acknowledging that you received their information. Figure 22.22 shows the confirmation page that is generated when you choose Confirmation Form from the FrontPage Editor's New Page dialog box. The Confirmation Field bots are the items contained in brackets.

Figure 22.22 : Confirmation fields, which confirm responses from the user, are placed into pages with the Confirmation Field bot.

The Confirmation Field bot works somewhat the same as the Substitution bot (discussed in Chapter 14), except that it's directly tied to a WebBot Save Results Component or WebBot Discussion Component. The Confirmation Field bot works at runtime and requires processing from the server to insert its replacement text. It extracts information from the originating form and places the data on the confirming page.

To create a confirmation form, follow these steps:

  1. Create the contents of the confirmation form.
  2. Position the insertion point where you want to place the confirmation field. Don't enter the name of the Confirmation Field bot on the page. That is entered automatically by the bot itself.
  3. Choose Insert | WebBot Component, and choose Confirmation Field from the Insert WebBot Component dialog box. The WebBot Confirmation Field Component Properties dialog box, shown in Figure 22.23, appears.
    Figure 22.23 : Enter a confirmation field in a page by using the WebBot Confirmation Field Component Properties dialog box.

  4. In the "Name of Form Field to Confirm" field, enter the name of one of the fields that appears in the form you're confirming. The example shown confirms the UserEmail field from a feedback form. When the user receives the confirmation, his or her e-mail address appears in the Confirmation Field bot's place.
  5. Choose OK. The name of the field is inserted into your confirmation form, surrounded by brackets.
  6. Save the page to your web, using the same URL that you entered when completing the steps previously mentioned in "Configuring a Confirmation Page."

How to Assign Custom ISAPI, NSAPI, or CGI Scripts

One of the options you have if your Internet service provider does not have the FrontPage Server Extensions installed is to use a custom ISAPI, NSAPI, or CGI script to process your forms. CGI (Common Gateway Interface) scripts are typically platform dependent, and they reside on your service provider's server. You need to coordinate usage of CGI scripts with them. ISAPI (Internet Server Application Programming Interface) is an interface developed by Process Software and Microsoft Corporation. NSAPI (Netscape Server Application Programming Interface) is an interface developed by Netscape Communications Corporation and runs only on Netscape servers.

NOTE
There are enough alternative options to make your head swirl. You can also use Java, JavaScript, ActiveX, and VBScript to process forms. See Chapter 23, "Java and Plug-Ins," and Chapter 24, "ActiveX and VBScript," to get a feel for what these other Web technologies can do for you.

You might want to include advanced features in your form, such as automatically entering the results in a database or spreadsheet or tabulat ing totals in an online ordering form. In that case, some programming of your own is definitely in order. What's important to learn here is how to configure your FrontPage form to use that custom CGI script.

Using CGI Scripts

A form and script are usually developed in concert with each other. The script contains information on how to handle each of the form fields in the form, along with other instructions for the server. You can find several good examples of CGI scripts you can use, along with the HTML pages associated with them, at the following sites on the Web:

Matt's Script Archive has several good forms with features similar
to those some of the bots accomplish. You can find his site at
http://worldwidemart.com/scripts/.
Selena Sol's Public Domain CGI Script Archive also offers some creative examples of how you can use CGI scripts with forms, scripts, and Web page examples. The URL for this site is http://www.eff.org/~erict/Scripts/.

However, even if you use ready-made CGI scripts, you can still expect to spend some time on them. The CGI scripts must be tweaked in many cases to get them up and running on your own site. You might also need to check with your service provider to see whether you can use custom CGI scripts on your site-and if so, where you are allowed to place them. Sometimes, CGI scripts must be assigned a .cgi extension to be recognized on the server; other times, they have to be placed in a specific directory to function properly. These particulars should be coordinated with your ISP before you configure your form. At that time, ask your service provider how to assign permissions for the form. They may already have a "frequently asked questions" page on their site that deals with these issues.

If all this sounds confusing, don't feel bad. CGI scripts are not something you can learn to work with in a few minutes; if you find you're still scratching your head after a few days of working with them, you aren't the first. Several good resources on the Web for learning all about CGI scripts are listed in Appendix C, "Directory of Resources."

Configuring a Form to Use ISAPI, NSAPI, or CGI Scripts

You assign an ISAPI, NSAPI, or CGI script to your FrontPage form in much the same way as you assign any of the other form-handling bots-with the Form Properties command. The steps follow:

  1. Right-click anywhere inside the form, and choose Form Properties from the pop-up menu to open the Form Properties dialog box.
  2. From the Form Handler field, choose Custom ISAPI, NSAPI, or CGI Script.
  3. Click Settings to configure the form handler. The Settings for Custom Form Handler dialog box, shown in Figure 22.24, appears.
    Figure 22.24 : Assign a custom ISAPI, NSAPI, or CGI script to your form in the Settings for Custom Form Handler dialog box.

  4. In the Action field, enter the absolute URL of the form handler. For example, if your form handler is named guestbk.cgi and it resides in the /cgi-bin subdirectory of your Web site, the absolute URL might look something like this:
    http://www.yourserver.com/~yourdirectory/cgi-bin/guestbk.cgi
  5. In the Method field, enter the method the form handler needs to process the form. If you're using one of the examples from either of the sites mentioned earlier, you can see which method was used by examining the HTML page example provided with the CGI script. You typically have one of the following options:
    POST (default). This method passes the name/value pairs to the form handler as input.
    GET. This method encodes the name/value pairs of the form and assigns the information to a server variable called QUERY_STRING.
  6. In the Encoding type field, enter the default encoding method used for the form. If you leave this field blank, the following encoding method is used by default:
    application/x-www-form-urlencoded
  7. Click OK to close each of the Settings for Custom Form Handler and Form Properties dialog boxes.

Adding Extended Attributes to a Form

You can assign extended attributes to any form field that uses a custom ISAPI, NSAPI, or CGI script as a form handler. To assign extended attributes to a form, follow these steps:

  1. Right-click anywhere inside the form, and choose Form Properties from the pop-up menu. The Form Properties dialog box appears.
  2. In the Form Handler field, choose Custom ISAPI, NSAPI, or CGI Script.
  3. Click Settings to open the Settings for Custom Form Handler dialog box.
  4. Click Extended to open the Extended Attributes dialog box.
  5. Click Add to open the Name/Value Pair dialog box.
  6. Enter the attribute's name in the Name field.
  7. Enter the attribute's value in the Value field.
  8. Click OK to close each of the Name/Value Pair, Extended Attributes, Setting for Custom Form Handler, and Form Properties dialog boxes.

Configuring a Form to Use an IDC File

You learned in Chapter 16, "Database Connectivity," how to generate an Internet Database Connector (IDC) file that connects to an ODBC-compliant database. FrontPage allows you to configure your forms to work with this IDC file, as shown in Figure 22.25. The steps to complete this follow:

Figure 22.25 : Use the Internet Database Connector form handler to interface with the IDC files generated by the Database Connector Wizard.


NOTE
To use the Internet Database Connector as a form handler, your Web site must reside on a server that uses the Microsoft Internet Information Server (IIS), running under Windows NT 3.5.1 or above, or the Microsoft Personal Web Server, running under Windows NT.

  1. Right-click anywhere inside the form, and choose Form Properties from the pop-up menu to open the Form Properties dialog box.
  2. From the Form Handler field, choose Internet Database Connector.
  3. Click Settings to configure the form handler. The Settings for Database Connector dialog box, shown in Figure 22.25, appears.
  4. In the Internet Database Connector File field, enter the path to the IDC file, or click the Browse button. The Current Web dialog box appears. Locate the directory in which your IDC file resides. Double-click the IDC filename. You return to the Settings for Database Connector dialog box.
  5. Choose OK to return to the Form Properties dialog box. Enter a form name in the Form Name field.
  6. Choose OK. You return to the FrontPage Editor. Save your form and preview it in your browser using the File | Preview in Browser command.

Other Ways to Use Forms

You can display forms in tables or frames much as you can any other type of content. To display a form in a table, create the form by using the Form Page Wizard, or build your own as you've learned in this section. You can copy the form into the clipboard and paste it into a table, or you can insert the form into another page with an Include bot.

You can also configure forms to direct their output to a frame. The steps are as follows:

  1. Right-click anywhere inside the form, and choose Form Properties from the pop-up menu to open the Form Properties dialog box.
  2. In the Target Frame field, enter the name of the default target frame you want your form to appear in.
  3. Click OK to close the Form Properties dialog box.

Workshop Wrap-Up

You should now know all the basics about designing forms in FrontPage. If you want to learn more about writing your own scripts, refer to the online sources listed in Appendix C. Other options you can use as an alternative to CGI are discussed in Chapters 23, "Java and Plug-Ins," and 24, "ActiveX and VBScript."

In this chapter, you learned how to configure FrontPage's runtime bots-the backbone of form handling in FrontPage. You learned why you need the FrontPage Server Extensions to use the bots covered in this chapter and how they enable you to add interactivity to your site without programming. You learned about results files and how to store them to your site in several different formats. You also learned how to configure your FrontPage forms to use the IDC files generated by the Database Connector Wizard and how to assign custom ISAPI, NSAPI, and CGI scripts to your forms. You should now have an understanding of what really makes these forms tick.

Next Steps

If the features that are built in to FrontPage aren't enough for you, get ready for an introduction into some exciting Web technologies that can take you in just about any direction. If you want to add pizzazz to your site, read on. You'll learn how to add multimedia, native document viewing, and even more interactivity into your site, using Java, JavaScript, Netscape Plug-Ins, ActiveX, and VBScript. With these Web technologies, the sky is the limit.

For additional information on topics related to this chapter, refer to these chapters:

Q&A

Q:I designed my form, I've got everything configured, and my Internet service provider has the FrontPage Server Extensions installed. Is there anything else I need to know about forms?
A:Believe it or not, after three chapters, you've finally got it all. If you want to go beyond what you've learned, you can get even more interactivity if you write custom routines yourself.
Q:Where should I put the results files?
A:It's best to put them in a location where your table of contents can't find them. If your service provider has the FrontPage Server Extensions installed, the most likely place is the _private directory, because your Table of Contents bot doesn't look there. Browsers can't find that one, either.
Q:If I place more than one form on a single Web page, do their results go to the same file?
A:No, you can configure them to go to different files, just as you could if they were on separate pages. Of course, if you want all the forms on a single page to point to one results file, you can do that, too!