Setting Validation Rules to EnsureCorrect Data Entry


Creating an effective Web page form is a balancing act: you want the form to be easy for your users to fill out. But you also want the information to be useful to you, and you want to control how users fill out the form, so that they give you the information you are looking for. If you re running a business on the Web, it s critical that your customers fill out registration, purchase, and shipping forms accurately.

FrontPage can help you create validation rules that give users the freedom to submit the data they want while ensuring that the data is transmitted in the form in which you need it. By taking a little extra time to set up rules that users need to follow when they fill out forms (also called forms validation ), you enable the process of verifying that the forms have been filled out accurately and completely.

Setting Validation Rules for Text Boxes

Text boxes and text areas are among the most frequently used form input elements. They are used to hold such important contact information as names , addresses, and phone numbers, and such important product ordering information as credit card numbers and product numbers . It pays to set rules for validating user input, so that the information comes to you correctly, and you don t lose orders, or have to delay shipping to verify data that wasn t submitted the right way to begin with. To validate text box input, follow these steps:

  1. Right-click the text box for which you want to set rules, and choose Form Field Properties from the shortcut menu.

  2. When the Text Box dialog box appears (see Figure 15-2), click Validate.

    click to expand
    Figure 15-2: Use this dialog box to set validation rules and other properties for text boxes.

  3. Choose an option from the Data Type drop-down list to constrain the type of content that can be typed in the text box. By default, the option is set to No Constraints. However, you can specify text, integer, or number constraints.

  4. Type a name for the field in the Display Name box (see Figure 15-3). Enter a name that describes the type of data you want users to enter. The name you enter appears as a prompt if the user attempts to leave the field blank.

    click to expand
    Figure 15-3: This dialog box lets you specify validation rules, so that users enter the text box data you want.

    Note  

    A field s display name becomes visible to your users when you set up rules for the fields in your form. When you use rules, FrontPage uses a field s name, and displays it to a user if that person has filled out a field incorrectly. (When the user presses the Submit button, the form is validated , and a message is displayed listing any fields that haven t been filled out correctly.) Because field names are visible when you set up rules, you should make sure your fields have clear, understandable names, instead of abstract codes.

  5. If you choose text, select the kinds of text content that the user can enter in the Text Format area. (Or, if you choose Number or Integer as a Data Type, specify additional options in the Numeric Format area).

  6. Check Required if you want this field to be a required field. (Otherwise the user doesn t have to fill out this text to complete the form.)

  7. Specify the minimum or maximum number of characters or numbers the text box can contain.

  8. Click OK to close Text Box Validation, and OK to close Text Box Properties.

Aha!  

Set an Initial Value
You can help ensure that your visitors fill out text boxes or other form fields correctly by suggesting a response in the Initial Value box in the Text Box Properties dialog box.

Set Rules for Drop-Down Boxes

You may create a drop-down box with a set of options to choose, but without validation, there s no guarantee that users will choose the right option, or any option at all. Often, drop-down boxes contain a prompt, such as Choose One or Make a Selection, as the first option. Validation ensures that users won t leave this option selected, but instead, will choose one of the options you do want them to pick. Just follow these steps:

  1. Right-click the drop-down menu list that you want to have rules, and choose Form Field Properties from the shortcut menu.

  2. When the Drop-Down Box Properties dialog box appears, click Validate.

  3. When the Drop-Down Box Validation dialog box appears (see Figure 15-4), click Data Required if you want this to be a required field in your form.

    click to expand
    Figure 15-4: Validating drop-down boxes ensures that users will make a choice from your list of options.

  4. Enter a name in the the Display Name box ”it will be used to prompt users if they don t make a choice from this list.

  5. Click Disallow First Choice, if you want to use the first item in the list for instructions (such as Choose One ).

  6. Click OK twice to close the Drop-Down Box Validation and the Drop-Down Box Properties dialog boxes.

Set Rules for Option Buttons

The problem with option buttons is that one choice is often preselected by default when the form is designed. Since only one button in a set of option buttons may be selected, it s possible that someone will leave the default option selected ”that is, unless you remove the default selection, and then set up validation for the option buttons in the group :

  1. Right-click any one of the option buttons in a set. If any of the buttons is preselected, right-click it instead.

  2. Choose Form Field Properties from the shortcut menu.

  3. If you right-clicked a pre-selected button, when the Option Button Properties dialog box appears, click Not Selected to remove the default option.

  4. Click Validate.

  5. When the Option Button Validation dialog box appears (shown in Figure 15-5), check Data Required to require that the user select one of the buttons in the set.

    click to expand
    Figure 15-5: Remove any default selections, then activate validation for the option buttons.

  6. Type a display name for the option button, so that users see it as a prompt if they do not make a selection from the group, and then click OK.

Aha!  

You Only Need to Activate Validation Once
When you add rules to any option button in a group, the rules apply to all buttons in that group. Only set rules for one of the buttons, and don t worry about the others.




Faster Smarter Microsoft Office FrontPage 2003
Faster Smarter Microsoft Office FrontPage 2003
ISBN: 0735619727
EAN: 2147483647
Year: 2004
Pages: 179

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