Creating Web Page Forms

Slides:



Advertisements
Similar presentations
Tutorial 6 Creating a Web Form
Advertisements

Multimedia and the World Wide Web HCI 201 Lecture Notes #5B.
XP 1 Creating Web Page Forms Designing a Product Registration Form Tutorial 6.
Creating Web Page Forms. Objectives Describe how Web forms can interact with a server-based program Insert a form into a Web page Create and format a.
Tutorial 6 Working with Web Forms
XP Tutorial 6: Creating Web Page Forms. XP An Example of a Form.
XP 1 New Perspectives on Creating Web Pages with HTML Tutorial 6: Creating Web Page Forms.
XP Creating Web Pages with HTML, 3e Prepared by: C. Hueckstaedt, Tutorial 6 1 New Perspectives on Creating Web Pages with HTML Tutorial 6: Creating Web.
Gathering Requirements What do users want?. Information Gathering Techniques Surveys Interviews Focus Groups.
Tutorial 6 Working with Web Forms. XP Objectives Explore how Web forms interact with Web servers Create form elements Create field sets and legends Create.
Tutorial 6 Forms Section A - Working with Forms in JavaScript.
HTML Tables and Forms Creating Web Pages with HTML CIS 133 Web Programming Concepts 1.
Web Development & Design Foundations with XHTML Chapter 9 Key Concepts.
CST JavaScript Validating Form Data with JavaScript.
Chapter 9 Collecting Data with Forms. A form on a web page consists of form objects such as text boxes or radio buttons into which users type information.
1 Web Developer & Design Foundations with XHTML Chapter 6 Key Concepts.
4-Sep-15 HTML Forms Mrs. Goins Web Design Class. Parts of a Web Form A Form is an area that can contain Form Control/Elements. Each piece of information.
XP Tutorial 6New Perspectives on Creating Web Pages with HTML, XHTML, and XML 1 Creating Web Page Forms Designing a Product Registration Form Tutorial.
XP Tutorial 6New Perspectives on HTML and XHTML, Comprehensive 1 Creating Web Page Forms Designing a Product Registration Form Tutorial 6.
1 Creating Web Forms in HTML Web forms collect information from customers Web forms include different control elements including: –Input boxes –Selection.
Forms and Form Controls Chapter What is a Form?
Web111a_chapt06.ppt HTML: Section 6 Forms HTML tags: define data input and/or output Define the Input and/or Output on the web page Do not process the.
Chapter 5 Java Script And Forms JavaScript, Third Edition.
Chapter 6: Forms JavaScript - Introductory. Previewing the Product Registration Form.
XHTML Introductory1 Forms Chapter 7. XHTML Introductory2 Objectives In this chapter, you will: Study elements Learn about input fields Use the element.
HTML II. Factors to consider in designing a website. Organizing your files. HTML Tables. Unordered Lists. Ordered Lists. HTML Forms. Learning Objectives.
XP 1 New Perspectives on Creating Web Pages with HTML Tutorial 6: Creating Web Page Forms.
Tutorial 7 Creating Forms. Objectives Session 7.1 – Create an HTML form – Insert fields for text – Add labels for form elements – Create radio buttons.
© 2010 Delmar, Cengage Learning Chapter 8 Collecting Data with Forms.
JavaScript, Fourth Edition Chapter 5 Validating Form Data with JavaScript.
 2008 Pearson Education, Inc. All rights reserved Introduction to XHTML.
Chapter 8 Collecting Data with Forms. Chapter 8 Lessons Introduction 1.Plan and create a form 2.Edit and format a form 3.Work with form objects 4.Test.
HTML Forms.
LOGO FORMs in HTML CHAPTER 5 Eastern Mediterranean University School of Computing and Technology Department of Information Technology ITEC229 Client-Side.
1 HTML Forms
ITCS373: Internet Technology Lecture 5: More HTML.
Tutorial 6 Working with Web Forms. XP Objectives Explore how Web forms interact with Web servers Create form elements Create field sets and legends Create.
Tutorial 6 Working with Web Forms. 2New Perspectives on HTML, XHTML, and XML, Comprehensive, 3rd Edition Objectives Explore how Web forms interact with.
1 HTML Forms
Microsoft FrontPage 2003 Illustrated Complete Creating a Form.
1 HTML Forms
XP 1 Tutorial 6 Creating Web Page Forms. XP 2 Tutorial Objectives  Describe how Web forms can interact with a server-based program  Review the various.
1 HTML Forms
©SoftMooreSlide 1 Introduction to HTML: Forms ©SoftMooreSlide 2 Forms Forms provide a simple mechanism for collecting user data and submitting it to.
Tutorial 6 Working with Web Forms. 2New Perspectives on HTML, XHTML, and XML, Comprehensive, 3rd Edition Objectives Explore how Web forms interact with.
Creating Web Page Forms COE 201- Computer Proficiency.
HTML Forms.
Basic Webpage Design HTML Forms. Objectives Learn how to use HTML to create a form. Explain the concept of forms Know the difference of GET and POST Discuss.
HTML Forms. A form is simply an area that can contain form fields. Form fields are objects that allow the visitor to enter information - for example text.
COS 125 DAY 17. Agenda  Assignment 7 not finished grading  Assignment 8 posted Due April 9  Capstone progress reports due  Quiz 2 Corrected 2 A’s,
1 HTML Forms
Copyright (c) 2004 Prentice-Hall. All rights reserved. 1 Committed to Shaping the Next Generation of IT Experts. Project 6: Creating XHTML Forms Kelly.
1 HTML forms (cont.)
Internet & World Wide Web How to Program, 5/e Copyright © Pearson, Inc All Rights Reserved.
Tutorial 6 Creating a Web Form
Lesson 5 Introduction to HTML Forms. Lesson 5 Forms A form is an area that can contain form elements. Form elements are elements that allow the user to.
HTML Structure II (Form) WEEK 2.2. Contents Table Form.
Ashima Wadhwa Java Script And Forms. Introduction Forms: –One of the most common Web page elements used with JavaScript –Typical forms you may encounter.
XP Tutorial 6New Perspectives on HTML, XHTML, and DHTML, Comprehensive 1 Creating Web Page Forms Designing a Product Registration Form Tutorial 6.
2440: 141 Web Site Administration Web Forms Instructor: Joseph Nattey.
Tutorial 6 Working with Web Forms
ITE 115 Creating Web Page Forms
Basic XHTML Tables XHTML tables—a frequently used feature that organizes data into rows and columns. Tables are defined with the table element. Table.
New Perspectives on Creating Web Pages with HTML
Introducing Forms.
CNIT 131 HTML5 - Forms.
Chapter 6: Creating Web Page Forms. An Example of a Form.
HTML Forms
Unit 5 Create Forms.
Presentation transcript:

Creating Web Page Forms CS 112 http://www.mountaindragon.com/html/forms.htm http://www.w3schools.com/html/tryit.asp?filename=tryhtml_input http://www.december.com/html/demo/form.html

Objectives CGI scripts The various parts of an online form Create form elements Create a hidden field on a form Work with form attributes Sending data from form to CGI script Sending form information without CGI scripts

Working with CGI Scripts Tags for creating forms HTML does not process the information. CGI (Common Gateway Interface) scripts process form information. Web page designers may not be able to create or edit CGI scripts.

CGI Scripts CGI scripts can work with: online database catalogues for ordering and purchasing databases with product support information number of times a Web page has been accessed server-side image maps message boards for online discussion e-mail for discussion groups

CGI Script Restrictions Reasons to restrict direct access to CGI scripts: CGI scripts are running programs on server security risks from computer hackers drain on system resources System administration maintain strict control

CGI Scripts and Computer Languages CGI scripts can be written in a variety of different computer languages. Some of the most commonly used languages are: ASP C/C++ Perl UNIX shell Visual Basic The language depends on the server

Form Control Elements text boxes selection lists for lists of options usually appear in a drop-down list box radio buttons check boxes groups boxes text areas buttons

Field User enter information in a field. Information entered into a field is called the field value (or value) http://www.w3schools.com/tags/tag_input.asp

The <form> Tag A page can include several different forms Can not nest one form inside another. <form attributes> form elements and layout tags </form> Use HTML tags to specify the form’s appearance.

The <form> Tag Continued A Web page can contain many forms <form> tag includes a name attribute. Name identifies each form on the page. also needed for programs that retrieve values from the form.

Input Types

Working with Text Boxes Text boxes are created using the <input> <input type=“type” name=“name” id=“id”> type specifies the type of input field name and id identifies the input field for the CGI script Default (no type attribute) is text box. <input type=“text”>

The name and id Attribute The name and id attributes of the <input> tag identifies the input field for the CGI script. The name attribute is older standard deprecated in HTML 4.01, however some CGI scripts still recognize only name attribute New standard uses the id attribute. id attribute is required, if a form contains form labels. It is best to duplicate the information by using both the name and id attributes.

Creating a Text Box To create a text box: <input name=“name” id=“id” value=“value” size=“value” maxlength=“value”> name and id attributes identify the field value assigns a default value to the text box size defines width of the text box (# of char) maxlength attribute defines the maximum number of characters allowed in the field

Controlling the Size of a Text Box By default, all text boxes are 20 characters wide. The syntax for changing the size of a text box is: <input size=“value”> value is the size of the text box in characters

Setting the Maximum Length for Text Input Setting the width of a text box does not limit the number of characters the box can hold. if a user enters text longer than the box’s width, the text scrolls to the left the user cannot see the entire text, but all of it is sent to the CGI script for processing The syntax for setting the maximum length for field input is: <input maxlength=“value”> value is the maximum number of characters that can be stored in the field

Setting a Default Value for a Field When the same value is entered into a field, it may make sense to define a default value for a field. Default values can save time and increase accuracy for users of a Web site. To define a default value, use the following syntax: <input value=“value”> value is the default text or number that is displayed in the field

Creating a Password Field password field is a text box in which the char typed by the user are displayed as bullets or asterisks <input type=“password”> Using a password field does not mean a secure connection. The password itself is not encrypted. The password field only acts as a mask for a field entry.

Working with Form Labels HTML allows you to formally link a label with an associated text element for scripting purposes. The syntax for creating a form label is: <label for=“id”>label text</label> id is the value of the id attribute for a field on the form label text is the text of the label you must bind the label to the id attribute of the field and not the name attribute

Working with Form Labels Labels can simplify the data entry process by allowing a user to click on either the control element or the element’s label to enter data. Labels allow users to write scripts to modify their content for interactive forms. The <label> tag is part of the HTML 4.0 Some Netscape browsers, and IE before 4.0 ignore the <label> tag, but still display the label text.

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 good to use when there is a fixed set of possible responses. Selection lists help prevent spelling mistakes and erroneous entries. A selection list is created using the <select> tag. The <option> tag is used to specify individual selection items.

Using the <select> and <option> Tags <select name=“name” id=“id”> <option> item1 <option> item2 …… </select> name and id attribute identify the selection field each <option> tag represents an individual item in the selection list the text in the selection list is indicated by the text in item1, item2, and so forth The <option> tag is a singleton tag (singlet)

Modifying the Appearance of a Selection List HTML provides several attributes to modify the appearance and behavior of selection lists and options. By default, the <select> tag displays one option from the selection list, along with a list arrow to view additional selection options. The number of options displayed can be modified with the size attribute. The syntax of the size attribute is: <select size=“value”>

Making Multiple Selections multiple attribute allows multiple selections <select multiple> In Windows, multiple selections can be made contiguous selection noncontiguous selection

Working with Option Values By default, a form sends the values that are displayed in the selection list to the CGI script. Instead of sending an entire text string, an abbreviation or code can be sent to the CGI script. Specify the value that is sent to the CGI script with the value attribute. Use the selected attribute to specify which item in the selection is selected, or highlighted, when the form is displayed.

Working with Option Groups The most recent releases of HTML allows you to organize selection lists into distinct groups called option groups. The syntax for creating an option group is: <optgroup label=“label”> label is the label assigned to the option group the text for the label appears in the selection list above each group of items but is not a selectable item from the list

Selection Lists or Radio Buttons If you have a long list of options Selection list. If you want to allow users to select more than one option Selection list with the multiple attribute. If you have a short list of options, and only one option is allowed at a time Radio buttons.

Creating a Group Box A group box labels an entire collection of radio buttons. A group box is a box placed around a set of fields that indicates that they belong to a common group. <fieldset> <legend align=“align”>legend text</legend> collection of fields </fieldset>

Creating a Group Box Continued the <legend> tag is used to display a legend on the group box legend text specifies the text for that legend align attribute specifies where the legend is placed in the box align values are “top” (the default), “bottom”, “left”, and “right” browsers only support “top” and “right” options at this time

Group Box Size There is no attribute to control the size of a group box. The box’s height will be large enough to accommodate the fields and labels in the field set. The width is the width of whatever space remains on the Web page. To set the width to a specific value use a table cell to place the group box and set the width of the cell. group boxes cannot extend across table cells; all of the fields in the field set must be placed within a single cell

Working with Check Boxes A check box is either selected or not, there is only one check box per field. Check boxes are created using the following syntax: <input type=“checkbox” name=“name” id=“id” value=“value”> name and id attribute identify the check box the value attribute specifies the value that is sent to the CGI script when the check box is selected The <input> tag for a check box does not display any text. Check boxes are not selected by default. to do this, add the checked attribute to the <input> tag

Creating a Text Area To create a larger text area for a text box, use the tag: <textarea name=“name” id=“id” rows=“value” cols=“value”> default text </textarea> rows and cols attributes define the dimensions of the text box the rows attribute indicates the number of lines in the text box Default text can be specified in the text box when the form is initially displayed.

The wrap Attribute for Text Set the value of the wrap attribute to either “soft” or “hard” to allow text to wrap within the text box. the “hard” setting preserves any line wrapping that takes place in the text box and the “soft” setting does not. If no value for the wrap attribute is specified, a value of “soft” is used. For comment fields, use the <textarea> tag with the wrap attribute set to “soft” so that the user’s comments wrap to the next line in the box.

Creating Form Buttons Another type of control element is one that performs an action. In forms, this is usually done with a button. Buttons can be clicked to: run programs submit forms reset the form to its original state

Creating a Push Button One type of button, called a push button, is created using the <input> tag as follows: <input type=“button” value=“text”> text is the text that appears on the button By themselves, push buttons perform no actions in the Web page. To create an action, write a script or program that runs automatically when the button is clicked.

Creating Submit and Reset Buttons A submit button is a button that submits the form to the CGI script for processing. A reset button resets the form to its original (default) values. The syntax for creating these two buttons is: <input type=“submit” value=“text”> <input type=“reset” value=“text”> value attribute defines the text that appears on the button

The name and value Attributes The name and value attributes can be used for push, submit, and reset buttons. Use these attributes when the form contains multiple buttons and a program that processes the form needs to distinguish one button from another. for example, a Web page advertising a shareware program might include three buttons: one used to download the program another used to retrieve information the third to cancel the form

Creating Buttons with the <button> Tag Buttons created with the <input> tag do not allow the Web page designer to control the appearance of the button. For greater artistic control over the appearance of the button, use the <button> tag. The syntax of the <button> tag is: <button name=“name” value=“value” type=“option”> button text and HTML tags </button> name attribute specifies the name of the button value attribute sends to a CGI script type attribute specifies the button type (submit, reset, or button)

Using the <button> Tag You can create a button that contains formatted text and an inline image. The default value for the type attribute is “button” but within the <button> tags you can place any HTML tags you wish including inline images. Example of Formatted text AND inline image <!--Default value is "button" --> <button name="back" type= "button"> <img src="back.gif align="absmiddle"> Go to <font color = "blue"><b>Western Site</b></font> </button> <p>

Working with Hidden Fields A hidden field is added to the form but not displayed in the Web page. Because the field is hidden, it can be placed anywhere between the opening and closing <form> tags. The syntax for creating a hidden field is: <input type=“hidden” name=“name” value=“value> Place all hidden fields in one location to make it easier to read and interpret the HTML code. Include a comment describing the purpose of the field.