HTML and CSS Reference
In-Depth Information
Finally, you might want to consider validating form input through scripting. Using
JavaScript, you can embed small programs in your web pages. One common use for
JavaScript is writing programs that verify a user's input is correct before she submits a
form. I discuss JavaScript in more detail in Lesson 14.
Summary
As you can see, the wonderful world of forms is full of different types of form controls
for your visitors. This truly is a way to make your web pages interactive.
Be cautious, however. Web surfers who are constantly bombarded with forms are likely
to get tired of all that typing and move on to another site. You need to give them a reason
for playing!
Table 11.1 summarizes the HTML tags used today. Remember these points and you can't
go wrong:
Use the form element to create your forms.
n
Always assign an action to a form.
n
Create form controls with the input element or the other form control elements.
n
Test your forms extensively.
n
TABLE 11.1
HTML Tags Used in this Lesson
Tag
Use
Creates an HTML form. You can have multiple forms within a docu-
ment, but you cannot nest the forms.
<form>
An attribute of <form> that indicates the server-side script (with a
URL path) that processes the form data.
action
An attribute of the <form> tag that specifies how form data is
encoded before being sent to the server.
enctype
An attribute of <form> that defines how the form data is sent to the
server. Possible values are get and post .
method
A <form> element that creates controls for user input.
<input>
An attribute of <input> that indicates the type of form control.
Possible values are shown in the following list:
type
Creates a single-line text entry field.
text
Creates a single-line text entry field that masks user input.
password
Creates a Submit button that sends the form data to a server-side
script.
submit
 
 
 
Search WWH ::




Custom Search