Specifying What Happens to Form Results


All the real action occurs after a visitor submits the form. What happens to the form results is up to you. You specify where and in what manner to send the form results. For this task, you need a form handler script. Chances are good that your Web host has a form-handling script or two already in place on your Web server. Speak to your Web host technical service or administrator to discover the script's capabilities and find out where the script (that is, the script's URL) is located on the server. If form results are sent to you via e-mail, you need to tell your Web host which e-mail address you want to use to receive form results.

Many form handlers provide additional options, such as customizing the form results e-mail message with a Subject line and specifying a confirmation page that appears when the visitor clicks the Submit button. (We talk about creating a confirmation page in the next section.) Other scripts offer more advanced options, such as input field validation. What does that term mean? If you've ever typed your e-mail address incorrectly into a Web site and received the message E - mail address not valid, you've been on the receiving end of a script for input field validation.

TECHNICAL STUFF 

If you need special data-processing capabilities beyond what your Web host's form handler can provide, you can write your own custom script and embed it into your Web page (for which you need programming experience or a programmer friend who owes you a big favor.) Prebuilt form-handling scripts for specific purposes are also widely available on the Internet, some even for free, depending on their features and capabilities.

Regardless of the form handler script you choose, hitching your form to a form handler in Expression Web is easy. In this section, we use a simple e-mail form handler as an example (such as your Web host would typically provide), to show you what dialog boxes you need to visit to introduce your form and your form handler to each other. Our sample form handler offers two additional options:

  • A subject line for the form results e-mail

  • The ability to specify a confirmation page

Depending on the form handler script you pick, you need to enter slightly different information, but the basic steps to get the form and the form handler to communicate nicely with each other are the same.

To hook up your form to this type of form handler, follow these steps:

  1. Right-click inside the form area and, from the pop-up menu that appears, choose Form Properties.

    The Form Properties dialog box appears.

  2. Select the Send to Other option.

    The corresponding list box comes into view, with the Custom ISAPI, NSAPI, CGI, or ASP Script option visible.

    TECHNICAL STUFF 

    If you must know, ISAPI stands for Internet Server Application Programming Interface, NSAPI stands for Netscape Server Application Programming Interface, CGI stands for Common Gateway Interface, and ASP stands for Active Server Pages.

  3. In the dialog box, click the Options button.

    The Options for Custom Form Handler dialog box appears.

  4. In the Action text box, type the URL of the form handler.

    If you don't know the URL, ask your Web host or system administrator.

    In our example, our form handler is named gdform.asp, and it lives in the same place as our Web site, so we would enter http://www.domain.com/gdform.asp.

  5. If post isn't already visible, choose it from the Method list box.

  6. Leave the Encoding Type text box alone.

  7. Click OK to close the Options for Custom Form Handler dialog box.

    You just hooked up your form to the form handler.

  8. To set up additional options, click the Advanced button.

    The Advanced Form Properties dialog box appears.

    We first set up the option to specify the Subject line for the form results e-mail.

  9. In the Advanced Form Properties dialog box, click the Add button.

    The Name/Value Pair dialog box appears.

    The instructions for our form handler specify to use the field name subject.

  10. In the Name text field, type subject.

  11. In the Value field, enter the text for the Subject line that you want to appear in the form results e-mail.

    You can enter anything you want. (We entered Gelato Survey Results.)

  12. Click OK to close the Name/Value Pair dialog box.

    In the Hidden Fields list in Advanced Form Properties dialog box, subject appears in the Name column and the Subject line text appears in the Value column (see Figure 6-9).

    image from book
    Figure 6-9: Options for e-mail subject line and confirmation page.

    Tip 

    These fields are hidden because the visitor never sees them on your form. The fields sit backstage in the HTML code and direct the form handler to do specific things after the visitor clicks the Submit button.

    Repeat Steps 9 through 12 to add options.

    In Figure 6-9, we added the field name redirect (from the form handler instructions) and the value survey_confirm.htm, the confirmation page we want the visitor to see after clicking the Submit button.

  13. When you are done adding options, click OK to close the Form Properties dialog box.

GLANCE AT THE CODE 

Now that we've introduced our form to its handler, take a peek at the form code:

 <form method="post"           action="http://www.mydomain.com/gdform.asp"> 

The code action=“http://www.mydomain.com/gdform.asp” tells the Web browser where to find the form-handling script.

REMEMBER 

We give you a sample URL here; contact your Web host to find out the URL of the form handler you use for your site.

Here's the code for specifying the Subject line for the form results email:

 <input type="hidden" name="subject" value="Gelato Survey           Results"> 

This code fetches and displays the confirmation page after the visitor clicks the Submit button:

 <input type="hidden" name="redirect"           value="survey_confirm.htm"> 
Tip 

Figure 6-10 shows an example of an e-mail message sent by a form handler.

image from book
Figure 6-10: E-mail results from a form.



Microsoft Expression Web for Dummies
Microsoft Expression Web For Dummies
ISBN: 0470115092
EAN: 2147483647
Year: 2004
Pages: 142

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