HTML and CSS Reference
In-Depth Information
figure 6-5
values of the enctype attribute
The default format. In this format, form data is transferred as a
long text string in which spaces are replaced with the + char-
acter and nontext characters (such as tabs and line breaks) are
replaced with their hexadecimal code values. Field names are
separated from their field values with an = symbol.
Used when sending files to a server. In this format, spaces and
nontext characters are preserved, and data elements are sepa-
rated using delimiter lines. The action type of the form element
must be set to post for this format.
Form data is transferred as plain text with no encoding of
spaces or nontext characters. This format is most often used
when the action type of the form element is set to mailto .
Alice tells you that your survey form will be processed by the CGI script located at
the URL (a fictional address) using the post
method. You do not have to specify a value for the enctype attribute because the default
value of application/x-www-form-urlencoded is appropriate. Add this information to
the form element now.
To add attributes to the form element:
1. Return to the survey.htm file and add the following attributes to the form
element, as shown in Figure 6-6:
figure 6-6
setting the form attributes
2. Save your changes to the file.
Because do es not correspond to a real CGI
script running on the Web and thus cannot process the survey form you'll create in
this tutorial, you'll add a JavaScript program named formsubmit.js to handle the form.
The purpose of this program is to intercept the contents of the form before the browser
attempts to contact the CGI script. The script also will report whether or not the data con-
tained in the survey form has been correctly filled out. You'll add a link to this script now.
Search WWH ::

Custom Search