| Goals for this chapter: | rpm packages covered in this chapter:
|
The World Wide Web opens different doors in business and communications.
An HTML page may present information, in a read-only mode, like we present in the previous chapters or also allow to interact with the user. These pages are called "forms" or HTML forms, like for example:

Inside these forms we can insert any "classical" input widget
| <form method="post" action="" enctype="multipart/form-data">
<p><input type="submit" name="Submit" value="Submit"> <p><input type="text" name="textfield"> <p><input type="checkbox" name="checkbox" value="checkbox"> <p><input type="radio" name="radiobutton" value="radiobutton"> <p><select name="select"><option selected>One</option><option>Two</option></select> <p><input type="file" name="file"><br></form> <p><textarea name="textfield"></textarea><br></form> |
From the Appendix
N: Netscape HTML Tag Reference in the FORM section we can find:
"INPUT
(input element in a form)
The INPUT tag defines a form element that can
receive user input. The TYPE attribute determines the specific sort of
form element to
be created. TYPE can be one of the following:
BUTTON
places a button on an HTML form. Use JavaScript code to make the button
perform an action you define. See INPUT
TYPE="BUTTON".
CHECKBOX
places a toggle switch on an HTML form, letting the user set a value on
or off. See INPUT
TYPE="CHECKBOX".
FILE places
an element on an HTML form letting the user supply a file as input. When
the form is submitted, the content of the
specified
file is sent to the server along with the other form data. See INPUT TYPE="FILE".
Navigator 2.0
HIDDEN
specifies an invisible text element. A hidden element is used for passing
information to the server when a form is
submitted.
See INPUT TYPE="HIDDEN".
IMAGE
places an image, serving as a custom button, on an HTML form. When a user
clicks an image element, the form is
submitted
to the server. See INPUT TYPE="IMAGE".
PASSWORD
places a text input field on an HTML form. Each character typed in the
field is displayed as a character such as *
or a
black dot to conceal the actual value. See INPUT TYPE="PASSWORD".
RADIO
places a radio button on an HTML form. Radio buttons can be grouped into
sets, and only one button per set can be
selected
at a time. See INPUT TYPE="RADIO".
RESET
places a reset button on an HTML form. When a user clicks a reset button,
all elements in the form are reset to their
default
values. See INPUT TYPE="RESET".
SUBMIT
places a submit button on an HTML form. When a user presses a submit button,
the form is submitted. See INPUT
TYPE="SUBMIT".
TEXT places
a single line text input field on an HTML form. A text field lets the user
enter text. See INPUT TYPE="TEXT".
In other words the same tag: INPUT, is used to radio button, for tex, for password input, for check buttons, to submit, to reset ... and any other input field.
All the tags that may be used for FORMS are the following: (This information was obtained from the Netscape Tag Guide - See Below).
INPUT
SELECTThis tag is used for input. You can use this tag and the combination: INPUT TYPE="INPUT_FORM_TYPE", where INPUT_FORM_TYPE may be:
- INPUT TYPE="BUTTON"
- INPUT TYPE="CHECKBOX"
- INPUT TYPE="FILE"
- INPUT TYPE="HIDDEN"
- INPUT TYPE="IMAGE"
- INPUT TYPE="PASSWORD"
- INPUT TYPE="RADIO"
- INPUT TYPE="RESET"
- INPUT TYPE="SUBMIT"
- INPUT TYPE="TEXT"
OPTIONThis tag present a list, and is used in with OPTION. We includes here some examples:MULTIPLE
specifies that multiple items can be selected. If this attribute is omitted, only one item can be selected from the list. If
multiple selection is enabled, the user usually needs to hold down the Shift key to select additional items.NAME="selectName"
specifies the name of the select element. This value is the name portion of the name/value pair sent to the invoked CGI
program when the form is submitted. The name is not displayed on the form.ONBLUR="blurJScode"
specifies JavaScript code to execute when the select element loses focus. For information about JavaScript, see theONCHANGE="changeJScode"
JavaScript Guide or the JavaScript Reference..specifies JavaScript code to execute when the select element loses focus and its value has been modified.ONCLICK="JScode"specifies JavaScript code to execute when a user clicks an item in the list.ONFOCUS="focusJScode"specifies JavaScript code to execute when the element gets focus.SIZE="ListLength"specifies the number of options visible when the form is displayed. If the list contains more options than specified by size,
the list is displayed with scrollbars.
TEXTAREAVALUE="OptionValue"specifies a value that is returned to the server when the option is selected and the form is submitted. When no VALUE
attribute is present, the value returned is the same as the text following the <OPTION> tag.SELECTED
specifies that the option is selected by default.
KEYGENCOLS="columns"ONCHANGE="JScode"defines the width (number of characters per line) the text area can accommodate without scrolling.
NAME="name"
specifies the name of the text area element. This value is the name portion of the name/value pair sent to the invoked CGI
program when the form is submitted. The name is not displayed on the form.
ONBLUR="JScode"
specifies JavaScript code to execute when the text area element loses focus. For information about JavaScript, see the
JavaScript Guide or the JavaScript Reference..specifies JavaScript code to execute when the text area element loses focus and its value has been modified..ROWS="rows"ONFOCUS="JScode
specifies JavaScript code to execute when a text area element receives focus.
ONSELECT="JScode"
specifies JavaScript code to execute when a user selects some of the text in the text area element.
defines the number of lines (number of rows) the text area can accommodate without scrolling.WRAP
specifies whether lines longer than the text area's column width wrap to the next line. Navigator 2.0.The value of WRAP can be one of the following:
OFF disables word wrap. Text the user types is displayed with the exact line breaks that the user types. If the
user explicitly inserts a line break, however, the break is included as part of the text area's value. The user has to
scroll horizontally to see the ends of lines that do not fit in the text area element.
HARD causes word wrap, and the line breaks are included when the form is submitted. The text wraps inside the
text area element, and that the user does not need to scroll horizontally.
SOFT causes word wrap, but the line breaks are not included when the form is submitted.
ISINDEXThe KEYGEN tag facilitates the generation of key material and submission of the public key as part of an HTML form.
The ISINDEX tag causes the web page to display a text entry field in which the user can type a string.
You can check the Appendix
N: Netscape HTML Tag Reference for more details.
In this section we will present some usefull examples.
Example 1: "Login and Password"
This first example presents a "classical"
| <!doctype html public "-//w3c//dtd html 4.0 transitional//en">
<html> <head> <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1"> <meta name="GENERATOR" content="Mozilla/4.76 [en] (X11; U; Linux 2.4.3 i686) [Netscape]"> </head> <body> <form method="post" action="" enctype="multipart/form-data"> Enter your login and password: <br> </br> <br> <b>Login : </b> <input type="text" name="textfield"> </br> <br> <b>Password: </b> <INPUT TYPE="PASSWORD" MAXLENGTH="20" SIZE=20 ></br> </form>
|
|
| Check the source on your browser: passwd.html |
Some customers prefer the login window, instead of the login inside a window.
For example you may have:
| ... a simple window login to connect to login inside the remote server (FTP) ... | ... or you may have login access |
![]() |
![]() |
Example 2: "Order your pizza"
Now, we will create a Web page to "order a Pizza". Of course we suppose
that the reader is a potential Webmaster that can develop Websites for
Pizza
| <!doctype html public "-//w3c//dtd html 4.0 transitional//en">
<html> <head> <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1"> <meta name="GENERATOR" content="Mozilla/4.76 [en] (X11; U; Linux 2.4.3 i686) [Netscape]"> </head> <body text="#FFFFFF"> <table BORDER COLS=1 WIDTH="100%" BGCOLOR="#CC0000" NOSAVE > <tr NOSAVE> <td NOSAVE> <center><b><font size=+4>Choose your Pizza: </font></b></center> <table BORDER COLS=2 WIDTH="100%" HEIGHT="281" BGCOLOR="#3333FF"
NOSAVE >
<td WIDTH="45%" HEIGHT="89">
<p><br>
<td VALIGN=TOP WIDTH="37%"><input type="checkbox" name="checkbox7"
value="checkbox">Mushrooms
<center>
<tr>
<td WIDTH="45%">
</body>
|
|
|||||||
| Check the source on your browser: orderpizza.html |
Example 3: Customer Data
This example
| <!doctype html public "-//w3c//dtd html 4.0 transitional//en">
<html> <head> <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1"> <meta name="GENERATOR" content="Mozilla/4.76 [en] (X11; U; Linux 2.4.3 i686) [Netscape]"> <title>ISP Signup Form</title> </head> <body text="#FFFFFF" bgcolor="#3333FF" link="#0000EF" vlink="#52188C" alink="#FF0000"> <form ACTION="/fcgi/signup.cgi" METHOD=POST><input TYPE="hidden" NAME="action" VALUE="process"><font color="#FFFFFF">Contact Information</font> <table BORDER=0 CELLSPACING=0 WIDTH="100%" BGCOLOR="#000066" NOSAVE > <tr NOSAVE> <th ALIGN=RIGHT><font color="#FFFFFF">*Contact name</font> <br><font color="#FFFFFF">(last, first)</font></th> <td COLSPAN="3" NOSAVE><input TYPE="text" NAME="last" VALUE=""><font color="#FFFFFF">, </font><input TYPE="text" NAME="first" VALUE=""></td> <td><!--
<td COLSPAN="2"><font color="#FFFFFF"> </font></td>
<tr>
<td COLSPAN="5"><input TYPE="text" NAME="company" SIZE=70 VALUE=""></td>
<tr>
<td COLSPAN="5"><input TYPE="text" NAME="address1" SIZE=70 VALUE=""></td>
<tr>
<td COLSPAN="5"><input TYPE="text" NAME="address2" SIZE=70 VALUE=""></td>
<tr NOSAVE>
<td><input TYPE="text" NAME="city" VALUE=""></td> <th ALIGN=RIGHT><font color="#FFFFFF">*State</font></th> <td NOWRAP NOSAVE><select name="state" ><option value="" SELECTED><option
value="AK"><font color="#FFFFFF">Alaska<option value="AL">Alabama<option
value="AR">Arkansas<option value="AZ">Arizona<option value="CA">California<option
value="CO">Colorado<option value="CT">Connecticut<option value="DC">District
<th><font color="#FFFFFF">*Zip</font></th> <td ALIGN=LEFT><input TYPE="text" NAME="zip" SIZE=10 VALUE=""></td>
<tr>
<td COLSPAN="5"><input TYPE="text" NAME="phone1" VALUE="" SIZE=18></td>
<tr>
<td COLSPAN="5"><input TYPE="text" NAME="phone2" VALUE="" SIZE=18></td>
<tr>
<td COLSPAN="5"><input TYPE="text" NAME="fax" VALUE="" SIZE=12></td>
<td><!--
<tr NOSAVE>
<tr>
<td><input TYPE="text" NAME="username" VALUE=""></td>
<tr>
<td><input TYPE="text" NAME="_password" VALUE=""></td>
<tr NOSAVE>
|
t
Billing information
*required fields for each billing type First package
|
|
|||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| Check the source on your browser: customer_data.html | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
Read the answers to the
exercises.
Check the Interactive Exam Cram WebMaster:
Internet Resources for this Chapter.