|
Inside Dynamic HTML Microsoft Programmers Series
Chapter 10 Forms and Intrinsic Controls
This chapter shows you how to script user interfaces that request and process input from the user. HTML supports both controls that can take user input and an element that pro-vides a form model for grouping and submitting contents back to the server. These controls are known as intrinsic controls because they are built into HTML. The functionality of the intrinsic controls is still fairly limited when compared to most forms and database packages. Validation and formatting are not yet supported, but using the object model you can easily add this behavior. This chapter presents techniques for manipulating forms and intrinsic controls within a document; it organizes the intrinsic controls in functional categories and shows you how to extend HTML forms to be on par with powerful forms packages.
The following topics are covered in this chapter:
- HTML forms
Forms are used to group related input from the user and submit it back to the server. Forms are fully accessible to scripts and can also be used for client-side processing. This section provides an introduction to HTML forms and input elements.
- Programming text Input elements
Text Input elements create a text box for requesting information from the user. Three types of text boxes are defined by HTML: a single-line text box, a multiple-line text box, and a password text box. This section focuses on techniques for using events and the object model to validate and format the user's input.
- Programming list (Select) elements
Select elements are used to provide the user with a defined list of choices. Two styles of lists can be created using intrinsic controls: list boxes and combo boxes. For both styles of lists, the programming model is the same. This section focuses on techniques for scripting lists and for dynamically adding and removing list items.
- Programming lists with check boxes and radio buttons
An alternative way to allow the user to select from a list of elements is to provide a set of check boxes or radio buttons. Check boxes are useful for simple yes/no questions; radio buttons are used for selecting one item from a list. This section discusses the benefits of using lists with buttons vs. using a list box style and provides scripting techniques.
- Programming command button elements
Four types of command buttons can be created in HTML: plain-text buttons, rich HTML buttons, Submit buttons, and Reset buttons. The Submit and Reset buttons have a defined behavior when used in forms and also act as the Default and Cancel button. The Default button is indicated by an extra border and is the button that receives the click event when the user presses enter; the Cancel button is clicked when the user presses Esc. The other types of command buttons' behavior must be defined through a script. This section shows you how to take advantage of command buttons.
- Programming Label and Fieldset elements
Labels and fieldsets are a new ad-dition to HTML and are necessary to create rich forms. The Label element is used to define the relationship between the Input element and some contents, and the Fieldset element is used to define the relationship between groups of controls.
|
|