[Previous] [Content Page] [Next]
Creating a Form ManuallyYou can add a form to any Web page. It doesn't even have to take up the whole page. For instance, you could insert a small form with just one field at the bottom of a page. After you insert the form, you'll need to fill it with form elementslike text boxes, drop-down menus, and radio buttons. 15.2.1. Creating a FormTo create a form, place your cursor where you want the form to start and select Insert
FrontPage inserts a form on your pagea dotted line in the shape of a rectangle. At first, all that's in your form are two buttons: Submit and Reset. Later, a visitor will use these buttons to send you the info he's entered (Submit) or to start over again (Reset). Tip: FrontPage supplies you with a form creation shortcut. Just insert any form element on a page (details on form elements follow in the next section), and FrontPage automatically creates a form to surround it. The area inside the dotted lines is your work area. When you add elements to your form (which you'll do in the next section), make sure you're inserting them inside the dotted lines. Note: If you add an element outside the bounds of your form, FrontPage creates another form on the page. While the program lets you include multiple forms on one page, you wouldn't want to, because a visitor can submit only one form at time (and when she does so, the page disappears from view). If things seem a bit cramped inside your form, make some space. Place your cursor in front of the Submit button in the document window. (If you have trouble clicking in that spot with your mouse, use the arrow keys on your keyboard to get there.) Then press Enter a few times to insert some paragraph returns. This way, you'll have plenty of room above your Submit button to lay out your form. 15.2.2. Adding Form FieldsInside the bounds of your new form, you'll enter form elements (fields that a visitor fills out) and text labels for each (so visitors know what information you're looking for). You can lay out elements of a form just as you'd lay out any Web page. For best results, insert a table (Tutorial 5) in your form so you can better organize form fields and their labels. As you'll see, form elements come in all shapes and sizes. If you insert them without a table, in the regular flow of HTML text, your page can look unkempt and difficult to follow. Wrangling form elements into a table can really tidy up your page. Each form element consists of two parts: name and value. Name is what you decide to call the field. For instance, say you've created a checkbox that a viewer can turn on if he wants more information. You could name that field "moreinfo." An element's value is the part that your site visitors provide. This can be text they enter in a text box or a checkmark they place in a checkbox. Only when these two parts of a form element work together, does your data make sense. For instance, if a visitor turns on a checkbox, you need to know the name of it. Did they place a checkmark in the "Send me more information" or the "Never contact me again" box? Below, you'll walk through the basic process of adding a form field, then you can read on to understand what kind of data you can collect with each type of element. Note: Don't forget! You have to enter all form elements within the dotted line that represents the form's border. No matter what form element you're adding, the process you'll follow is pretty much the same:
Each field needs a corresponding label that lets a visitor know what information you want her to enter. Again, organizing fields and labels in a table will help you create a pleasing page layout that's easy to follow. 15.2.3. Configuring Form FieldsFrontPage offers a variety of form fields, to help you collect different types of information from your site visitors. Each element has its own purpose and properties (see Figure 15-2). To edit the properties of a form field, just double-click it. Or, right-click it and select Form Field Properties.
15.2.3.1 Text boxUse text boxes to collect short chunks of text, like names, email addresses, and phone numbers. When you insert a text box, FrontPage gives you the following additional configuration options:
Note: Choosing Yes at the password field option affects display only. Once a visitor clicks Submit, this info travels as plain text like any other field. Therefore, this feature doesn't ensure that the information a visitor enters is secure from hackers and eavesdroppers. To truly protect information like account numbers and passwords, you've got to encrypt (scramble) it using SSL (Secure Socket Layer).You've probably seen this in action while you've surfed the Net. Your browser usually displays a message letting you know that info you send will be encrypted. Also, a padlock icon shows up somewhere along the status bar at the bottom of the screen. When you're browsing pages on the Web, never enter sensitive information in a Web form unless your browser is displaying that little padlock. If you want this kind of security on your site, get in touch with your Web server administrator, who'll need to set this up on the server. He can also tell you what you need to do. Often you'll need to purchase an encryption certificate, but check with your host or administrator first.
15.2.3.2 Text areaThe text area box is for your long-winded, loquacious types. Basically this is just a very large text box. Property settings here are the same as they are for a text box, with one exception. The Number of Lines field sets the height of the text area box. You can also use this element's resize handles to change dimensions. (As with text boxes, the size of the box doesn't limit the number of characters a visitor can enter. To learn how to limit the number of characters a text area box accepts, see "Validating Text Fields" on Section 15.3.1.) 15.2.3.3 CheckboxTo the simple checkbox, life's an all or nothing affair. A checkbox is either on or off. This element is great for "check all your areas of interest" type questions. A visitor can turn on one, two, all, or nonehowever many she wants. If you have a checkbox or two in your form, be sure to configure the following options in the Form Field Properties dialog box:
15.2.3.4 Option (or radio) buttonOption buttons present your visitors with a choice. These buttons appear in groups, and a viewer can select only one. When you select or activate one option, all others turn off. You can use this field type for simple Yes or No questions, or for multiple-choice questions where you only want one answer. Note: The rest of the worldincluding HTMLcalls option buttons "radio buttons." Option is a good name for them, too, since a viewer can choose only one option, but you may see the old-fashioned term "radio button" as well. Perhaps those in charge of user-friendly naming at Microsoft felt that most people are now too young to remember the old radios that let you change the station by pressing a button. Press one and you were listening to a station down at the right end of the dial. Press another and you moved left, up the dial, to a different station. In other words, when you pressed a radio buttonyou'd selected that one option (radio station) only, while turning off any others that you'd previously selected. While all other form elements require a unique name, option buttons are the exception. Because they work together, all option buttons in a group should have the same name. FrontPage takes care of this for you if you insert option buttons one right after another. Insert another element in between, and FrontPage gives the latter radio button a new unique name. (If need be, you can edit the "Group name" field (in Form Field Properties) so all the buttons in one group match each other.) Other fields you'll configure for option buttons are:
15.2.3.5 Drop-down boxOption buttons and checkboxes are nifty, but what if you've got a really long list of choices? Adding all those buttons to your form would take up a lot of screen real estate. If you've got a ton of options, try consolidating them in a drop-down list. When you insert a drop-down box, it shows up empty. You've got to add choices. To do so, double-click the box to open the Drop-Down Properties dialog box (see Figure 15-3).
To add a choice, click Add. In the Add Choice dialog box that opens, type in the name for your choice. If you want the Web server to send you a result value other than the one you just typed, turn on the "Specify value" checkbox, and then type the value in the line below. Click OK, and FrontPage adds the new entry to the list. Other configuration options in the Drop-Down Box Properties dialog box include:
When your list appears on a Web page, the first item in the list shows. If you'd prefer that another item in the list display instead, but don't want it at the top of the list, do the following: Highlight the choice in the Drop-Down Properties dialog box and click Modify. In the Modify Choice dialog box, under Initial state, click Selected and click OK. Tip: You can also make your first choice, which displays on the page, be some instructional text like "Select an item below." Just enter it as the first choice and use validation settings (Section 15.3.1, later in this tutorial) if you want to force a visitor to choose another selection. 15.2.3.6 File uploadSuppose a form can't hold all the information you're looking for. Maybe you want visitors to send you their résumés, business plans, or pictures of their pets engaging in water sports. You don't need to make them paste any of these items in a text area box. Let them send you their files in all their glorythat's right, you can let a visitor upload an entire file to you by letting them use a form. Note: You'll need to check with your Web server administrator to make sure the server accepts anonymous file uploads. For security reasons, many don't. Insert a File Upload field as you would any other. Once it appears on your page, you'll see that it features a simple text field and a Browse button. FrontPage has preprogrammed this button to let a visitor browse his computer to select a file. You can't edit the button or its label. Double-click the upload element, and FrontPage lets you select a destination folder for uploaded files. Create a special folder in your site to hold these files. If you want to keep them out of the public eye, create an uploads folder within your _private folder and select it. (The _private folder is off-limits to site visitors. FrontPage excludes it from searches and browsing.) When you add a file upload element to a form, FrontPage adds a special File Upload tab to the Saving Results dialog box, which you access through the Form Properties dialog box (see Figure 15-4). (To open it, right-click inside the form, select Form Properties, and then click Options.)
15.2.3.7 Group boxOften you'll want to group some of your form fields together, both for aesthetic reasons and to help let viewers know what you're looking for. A group box surrounds a bunch of elements with a border and provides a heading for them (for a picture of what the group box looks like, pop back to Figure 15-2). When you insert a group box, it's empty. You've got to paste or insert form fields in it after you create it. Group boxes always fill the browser screen horizontally. If that's too wide for you, try inserting the group box inside a table cell. 15.2.3.8 LabelAs you've read, you label your form fields using simple HTML text. All you can do is position labels next to fields to try to make it very clear which label goes with what field. While that's true, FrontPage can enhance the label setup that you created by linking a label to a field. One advantage to doing this is that a visitor won't be limited to just clicking in an element (for instance, a checkbox) to turn it on. She could click the field's label, too. More importantly, labels make your form more accessible for visitors who are viewing impaired. If an author lays out a form poorly (see Figure 15-5), screen readers can have a terrible time connecting labels with fields. This makes it really difficult for a visually impaired visitor to fill out the form correctly. If you link a field with its label, you can avoid any such confusion.
To link a field and its label together, you already need to have both elements in place. Select them both and select Insert 15.2.4. ButtonsAll the form fields you just read about would be nothing without a means to send the information. That's where the not-so-humble form button comes in. 15.2.4.1 Submit and Reset buttonsWhen you create your form, FrontPage automatically gives it two buttons: Submit and Reset. The Submit button is the form's control center. All form activity revolves around this important hub. After a visitor fills out a form and clicks Submit, the action starts. The Submit button tells the Web browser to send the form data to the Web server. You don't need to configure this button in any way. If you want, you can change its label (right-click the button, select Form Field Properties, and then edit the Value/Label field). The Reset button is the visitor's "do over" option. If a visitor clicks Reset, the form returns to its original state. This button doesn't clear the form. Instead, whatever the visitor saw when he first opened that pagelike empty fields and some preset optionshe'll see again. 15.2.4.2 Normal buttonIf you want to add another kind of button to a pageperhaps one that links to more information, for instanceyou can add what FrontPage calls a "Normal" button. Unlike the Submit and Reset buttons, a Normal button has no preset mission. To get a Normal button, select Insert
15.2.4.3 Advanced buttonThe Advanced button is a more flexible variation on the Normal button. You can type a label directly on it as soon as you create it or resize it; you can even insert an image in it. 15.2.4.4 Using a picture as a Submit buttonIf you want to jazz up your page, you can have a picture serve as the page's Submit button. To do so, insert a picture in your form using the Form menu (select Insert
|
[Previous] [Content Page] [Next]





