Chapter 6: Forms for Any Purpose


What's the first thing that pops into your mind when we mention forms? Bureaucracy-perpetuating pieces of paper? Multipage monstrosities in triplicate? Well, put those thoughts aside for a moment, because in this chapter, we introduce you to the wonders of the interactive form. Interactive forms allow you to survey your visitors and ask for their opinions. And you don't even need to hire an accountant.

Looking at How Forms Work

Before you build a form, understanding the basics of how forms work can help. If this stuff seems a little tricky, don't worry. Expression Web takes care of the hard part. All you need to do is decide how you want to use forms in your Web site.

Like paper forms, interactive forms collect different types of information. Web site visitors fill in fields, either by typing information or selecting an item from a list. After visitors complete the form, they click a button to submit the information. The form shown in Figure 6-1 illustrates how this process works.

image from book
Figure 6-1: A typical Web page form.

The information submitted from forms is organized into a list of field names (also known as variable names) and field values. The field name is a unique identifying descriptor assigned to each field in your form. The field name is invisible to your visitors; it exists inside the form's HTML and is visible only to the person (or computer) receiving the information submitted from the form. The pieces of text you see in Figure 6-1-Do you like gelato? and What is your favorite flavor?, for example-aren't field names; they're bits of regular text sitting inside the page and prompting the visitor to fill in the accompanying field.

The field value is the information that the visitor submits. Depending on the type of field, the value is either the stuff the visitor types or an item that the visitor chooses from a list you define. (In Figure 6-1, for example, the value of the favorite flavor field is Mango.)

What happens to that information after a visitor submits the completed form depends on the type of form handler assigned to the form. A form handler is a program that resides on the host Web server (the computer on which your Web site will eventually be published). This program receives the form data and then does something with it. Depending on the type of form handler, the program might, for example, save the data (also known as the form results) in a text file, format the results as a Web page, or send the information back to the site administrator in an e-mail message.

Warning 

Depending on the type of form handler you use, spammers may eventually find a way to fill your survey fields with junk that gets sent on to your inbox because the form handler can't differentiate between legitimate survey answers and ads for Rolex knockoffs. If your form falls prey to spammers, you can do a couple of things about it. Ask someone at your Web host whether it has spam-protected form handlers. If not, some Web-based services and third-party software products offer form security for a small fee. (Take a look at http://www.formbreeze.com and http://www.hform.com.)

TECHNICAL STUFF 

If something beyond the simple user-input form is what you're after (such as a form that interacts with a database or a survey that requires authentication), consider taking a look at the more advanced ASP.NET site-building features that Expression Web offers. (ASP.NET sites are beyond the scope of this book, but you can find ASP.NET resources for beginners at http://www.dummies.com.)

image from book
Forms, FrontPage Server Extensions, and Expression Web

Suppose that you already have a form-enhanced Web site that you built in FrontPage. The forms work just fine, but they require that the host server have FrontPage Server Extensions installed in order to work. Expression Web no longer uses FrontPage Server Extensions, so what do you do? Not to worry-you can open your FrontPage-created site in Expression Web, publish it to your Web server with FrontPage Server Extensions enabled, and continue to use your forms as you set them up in FrontPage. The built-in form handler continues to validate and process your form results as before. But here's what you can't do in Expression Web:

  • The Form Wizard and FrontPage form templates have gone bye-bye. You have to build any new forms for your site by hand. (It's not difficult; we show you how later in this chapter.)

  • Built-in form field validation has also gone by the wayside. If any of your form fields has data-entry requirements, you cannot modify its data rules from within any Expression Web form-related dialog box. (If the data rules are stored in a script in your Web page, they're written in either VBScript or JavaScript, whichever you specified when you set up form validation. With some scripting-language know-how, you can modify the data rules in the Expression Web Code view.)

Even though your existing forms that rely on FrontPage Server Extensions continue to work (as long as you publish your site to a Web server with FrontPage Server Extensions available and as long as your Web host continues to offer FrontPage Server Extensions), you eventually have to find another solution. Check with your Web host to see whether its form handlers offer field validation. If not, you can build form validation into your form by using JavaScript. Check out JavaScript For Dummies, 4th Edition, by Emily A. Vander Veer (Wiley) to find out more.

If you're feeling ambitious, the ASP.NET controls in Expression Web offer all sorts of form options. The catch is that you have to build an ASP.NET Web site rather than an HTML Web site. The topic of building an ASP.NET site is beyond the scope of this book. Check out ASP.NET 2 For Dummies, by Bill Hatfield (Wiley) and ASP.NET 2.0 Everyday Apps For Dummies, by Doug Lowe (Wiley).

image from book



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