•Creating Web Page Forms
•Designing a Product Registration Form
•Objectives
•Describe how Web forms can interact with a server-based program
•Insert a form into a Web page
•Create and format an input box for simple text data
•Add a form label and link it to a control element
•Objectives
•Set up a selection list for a predefined list of data values
•Create option buttons for a list of possible field values
•Organize fields into field sets
•Insert a text area box for multiple lines of text data
•Objectives
•Generate form buttons to submit or reset a form
•Describe how data is sent from a Web form to a server
•Understand how to create image fields, hidden fields, and file buttons
•Apply tab indices and access keys to control elements
•Introducing Web Forms
•Web forms collect information from customers
•Web forms include different control elements including:
–Input boxes
–Selection lists
–Drop-down lists boxes
–Option buttons or radio buttons
–Check boxes
–Group boxes
–Text areas
–Form buttons
•Forms and Server-Based Programs
•While HTML supports the creation of forms, it does not include tools to process the information
•The information can be processed through a program running on a Web server
•Forms and Server-Based Programs
•Server-based programs are written in many languages
•The earliest and most commonly used are Common Gateway Interface (CGI) scripts that are written in perl
•Other popular languages include:
–AppleScript - PHP
–ASP - TCL
–ColdFusion - the Unix shell
–C/C++ - Visual Basic
•Creating the Form Element
•Creating the Form Element
•Creating the Form Element
•Creating Input Boxes
•The general syntax of input elements is as follows:
Where type specifies the type of input field,
and the name and id attributes provide the
field’s name and id.
•Creating Input Boxes
•Input types:
type=“button”
Displays a button that can be clicked to perform an action from a script
type=“checkbox
Displays a check box
type=“file”
Displays a browse button to locate and select a file
type=“hidden”
Creates a hidden field, not viewable on the form
•Creating Input Boxes
•Input types:
type=“image”
Displays an input image that can be clicked to perform an action from a script
type=“password”
Displays an input box that hides text entered by the use
type=“radio”
Displays an option button
•Creating Input Boxes
•Input types:
type-”reset”
Displays a button that resets the form when clicked
type=“submit”
Displays a button that submits the form when clicked
type=“text”
Displays an input box that displays text entered by the user
•Setting the Size of an Input Box
•By default, an input box displays at 20 characters of text
•To change the width of an input box, use the size attribute which is displayed as follows:
Where value is the size of the input box in characters.
•Setting the Size of an Input Box
•Creating a Password Field
•A password field is an input box where characters typed by the user are displayed as bullets or asterisks to protect private or sensitive information on a Web site
•The syntax for creating a Password field is as follows:
•Creating an input box
•To create an input box, use the following HTML code:
value=“value” size=“value”
maxlength=“value’ />
Where the name and id attributes identify the field, the value
attribute assigns the field’s default value, the size attribute
defines the width of the input box in characters, and the
maxlength attribute specifies the maximum number of
characters that a user can enter into the field.
•Working with Form Labels
•You can also expressly link a label with an associated text element for scripting purposes
•The syntax for creating a form label is as follows:
Where id is the value of the id attribute for a field on the form, and label text is the text of the label.
•Creating a Selection List
•A selection list is a list box from which a user selects a particular value or set of values
–Selection lists are useful when there are a fixed set of possible responses from the user
•You can create a selection list using the
No comments:
Post a Comment