Java Reference
In-Depth Information
Some <form> elements will not contain an action attribute. If this is the case, then
the request will be sent back to the same page that contains the form. For example, the fol-
lowing <form> tag would specify to post back to the page that contains the form.
<form method="post">
This is a very common practice. Often, the page that contains the <form> is also ca-
pable of processing the data that returns from the form.
<input> Tags
Most form elements are expressed as <input> tags. The input tag contains a type
property that tells what type of <input> tag this is. Table 7.1 summarizes the different
<input> tag types.
Table 7.1: Common <input> Tag Types
Tag Type
Purpose
button
Buttons are used to perform JavaScript actions.
checkbox
Checkboxes allow the form to capture true/false data.
file
The file type allows files to be uploaded with a multipart form.
hidden
Hidden controls hold a value, but cannot be seen or interacted with.
image
Images are like buttons, except their appearance is governed by the
image.
password
Password fields work just like text fields, except you cannot see
what is typed.
radio
Radio buttons allow a multi-choice input.
reset
The reset button sends no data to the web server. It allows you to
reset all of the form's controls back to their default values.
submit
The submit button submits the form's data to the web server.
text
Text fields allow the user to enter single-line text information.
In the next few sections, each of the controls that can be placed on a form will be ex-
plored.
Search WWH ::




Custom Search