Main Page

autosuggest functionality

In this chapter you explored many ways to enhance Web forms. You learned how to use JavaScript to
reset and submit a form. This included ensuring that the form is submitted only one time. You also
explored different ways to access elements in a form.
You learned a great deal about text boxes, including how to allow or disallow certain characters. Further,
you discovered how to prevent a user from pasting invalid values into a text box and how to validate a
text box value using the
event handler.
List boxes and combo boxes were introduced and various methods of manipulation were discussed,
including how to add new options, remove existing options, and move options within a single list box
and between two list boxes.
Finally, all this knowledge is used to create an autosuggest text box that presents the user with a number
of suggestions after he has typed in a few characters. In the next few chapters, you’ll learn more about
how to enhance the usability of Web pages using JavaScript.
The autosuggest functionality described in this section is case-sensitive. To make a
case-insensitive version, you should convert all values in the array to lowercase and
then compare these values against the value of the text box (which should also be
converted to all lowercase).
Forms and Data Integrity
14_579088 ch11.qxd 3/28/05 11:40 AM Page 365

JavaScript EditorFree JavaScript Editor     Ajax Editor