Java Reference
In-Depth Information
Text Controls
There are several types of form text controls that web servers can make use of. The
HTML necessary to create each of these control types is shown here.
<input type="password" name="password" value="Password">
<input type="text" name="text" value="Text">
<input type="file" name="file" value="File">
<textarea rows="3" cols="20" name="textarea">Text area.</textarea>
<input type="hidden" name="hidden" value="Hidden">
The text control displays a rectangular field for the user to enter text into. The
password control works the same way; however, the user is not allowed to see what is
entered. The hidden control is simply a name-value pair that is sent directly to the web
server. The user cannot see or change a hidden control.
The file control allows a file to be uploaded. The file control works considerably
different than any of the other control types, as it requires the form to be posted in a multi-
part format. HTTP file uploads will be discussed later in this chapter.
Text controls are also sent to the server as a name-value pair. For example, consider the
following text control.
<input type="text" name="userid">
If you were to enter the user id of “jeff”, the following would be sent to the web server.
userid=jeff
Even the password control is transmitted this way. Passwords from web sites are
transmitted in a clear-text format. Of course, the best way to secure the password is to use
HTTPS so that everything is encrypted.
Selection Controls
There are several types of form selection lists that web servers can make use of. The
HTML necessary to create each of these control types is shown here:
<input type="radio" name="radio" value="1">Radio Button 1<br>
<input type="radio" name="radio" value="2">Radio Button 2<br>
<input type="radio" name="radio" value="3">Radio Button 3<br>
The above controls are radio buttons. Only one radio button can be selected at
a time. Radio buttons are good for a multi-choice type of question and work just like every
other control type, in that they return a name-value pair. For example, if the second radio
control from the above list was selected, the following name-value pair would be returned to
the server:
radio=radio2
Search WWH ::




Custom Search