Main Page

Forms and Data Integrity

Forms and Data Integrity
Form elements were created to address the need for the user to send data back to the server. The
answer they provided came in the form (no pun intended) of Web forms, using the HTML
, and
elements. Using these elements, browsers can render
text boxes, combo boxes, and other user input controls to allow communication from the client to
the server.
Although the Web has developed at a rapid pace, Web forms have remained virtually unchanged.
Although a new standard called XForms looms on the horizon, no browser has made a move to
adopt it natively, and so Web forms today rely on JavaScript to augment the built-in behavior.
In this chapter, you learn how to use JavaScript to extend the behavior and usability of common
Web forms to include the functionality that today’s users expect.
Form Basics
An HTML form is defined by using the
element, which has several attributes:
— Indicates whether the browser should sent a GET request or a POST request
— Indicates the URL to which the form should be submitted
— The way the data should be encoded when sent to the server. The default is
, but it may be set to
if the
form is uploading a file.
— Lists the mime types the server will handle correctly when a file is uploaded
— Lists the character encodings that are accepted by the server when
data is submitted
14_579088 ch11.qxd 3/28/05 11:40 AM Page 335

JavaScript EditorFree JavaScript Editor     Ajax Editor