Tutorial 6 Working with Web Forms

Slides:



Advertisements
Similar presentations
WEB DESIGN TABLES, PAGE LAYOUT AND FORMS. Page Layout Page Layout is an important part of web design Why do you think your page layout is important?
Advertisements

Tutorial 6 Creating a Web Form
Technologies for web publishing Ing. Václav Freylich Lecture 4.
Supplement Creating Forms. Objectives Show how forms are used How to create the Form element HTML elements used for creating input fields.
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.
Forms Review. 2 Using Forms tag  Contains the form elements on a web page  Container tag tag  Configures a variety of form elements including text.
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.
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.
Creating Web Page Forms
Tutorial 6: Creating a Web form
Web Development & Design Foundations with XHTML Chapter 9 Key Concepts.
Form Handling, Validation and Functions. Form Handling Forms are a graphical user interfaces (GUIs) that enables the interaction between users and servers.
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.
Reading Data in Web Pages tMyn1 Reading Data in Web Pages A very common application of PHP is to have an HTML form gather information from a website's.
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?
Chapter 6: Forms JavaScript - Introductory. Previewing the Product Registration Form.
Project Four Forms Discuss form processing Describe the difference between client-side and server-side form processing Add a horizontal rule to a Web page.
XHTML Introductory1 Forms Chapter 7. XHTML Introductory2 Objectives In this chapter, you will: Study elements Learn about input fields Use the element.
การจัดรูปแบบเว็บด้วย CSS การเขียนโปรแกรมเว็บ. Selectors & cascading PatternMeaning *Universal selector: matches any element. EType selector: matches any.
XP 1 New Perspectives on Creating Web Pages with HTML Tutorial 6: Creating Web Page Forms.
Robinson_CIS_285_2005 HTML FORMS CIS 285 Winter_2005 Instructor: Mary Robinson.
Copyright © 2004 ProsoftTraining, All Rights Reserved. Lesson 7: Web 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.
Copyright © 2004 ProsoftTraining, All Rights Reserved. Lesson 7: Web Forms © 2007 Prosoft Learning Corporation All rights reserved ITD 110 Web Page Design.
 2008 Pearson Education, Inc. All rights reserved Introduction to XHTML.
Website Development with PHP and MySQL Saving Data.
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
1 © Netskills Quality Internet Training, University of Newcastle HTML Forms © Netskills, Quality Internet Training, University of Newcastle Netskills is.
Week 9 - Form Basics Key Concepts 1. 1.Describe common uses of forms on web pages 2.Create forms on web pages using the form, input, textarea, and select.
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.
Creating Web Page Forms. Introducing Web Forms Web forms collect information from users Web forms include different control elements including: –Input.
1 HTML Forms
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 (cont.)
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. 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,
Creating Forms on a Web Page. 2 Introduction  Forms allow Web developers to collect visitor feedback  Forms create an environment that invites people.
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
HTML III (Forms) Robin Burke ECT 270. Outline Where we are in this class Web applications HTML Forms Break Forms lab.
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.
FORMS Explained By: Jasdeep Kaur. Lecturer, Department of Computer Application, PGG.C.G., Sector: 42, Chandigarh.
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.
Designing Forms Lesson 10.
CNIT 131 HTML5 - Forms.
Lesson 6: Web Forms.
Chapter 6: Creating Web Page Forms. An Example of a Form.
HTML Forms
Presentation transcript:

Tutorial 6 Working with Web Forms

Objectives Explore how Web forms interact with Web servers Create form elements Create field sets and legends Create input boxes and form labels Creation option buttons Create selection lists Create check boxes New Perspectives on HTML, XHTML, and Dynamic HTML, 4e

Objectives Create text area boxes Apply styles to Web forms Work with form buttons Explore image elements and hidden fields Work with form actions and methods New Perspectives on HTML, XHTML, and Dynamic HTML, 4e

Introducing Web Forms Web forms collect information from Web site visitors. Web forms include different control elements including: Input boxes Option buttons or radio buttons Selection lists Drop-down lists boxes Check boxes Text areas New Perspectives on HTML, XHTML, and Dynamic HTML, 4e

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. New Perspectives on HTML, XHTML, and Dynamic HTML, 4e

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: ASP ColdFusion C/C++ PHP VBScript New Perspectives on HTML, XHTML, and Dynamic HTML, 4e

Creating a Web Form Forms are created using the form element, structured as follows: <form attributes> elements </form> Where attributes are the attributes that control how the form is processed and elements are elements places within the form. Notes: This example illustrates a common use of frames: displaying a table of contents in one frame, while showing individual pages from the site in another. New Perspectives on HTML, XHTML, and Dynamic HTML, 4e

Creating a Web Form Form attributes usually tell the browser the location of the server-based program to be applied to the form’s data. Always specify an id or name for the form. Two attributes are available to identify the form: id and name. Notes: This example illustrates a common use of frames: displaying a table of contents in one frame, while showing individual pages from the site in another. New Perspectives on HTML, XHTML, and Dynamic HTML, 4e

Creating a Web Form The syntax of the id and name attributes are as follows: <form name=“name” id=“id”>… </form> Where name is the name of the form and id is the id of the form. Notes: This example illustrates a common use of frames: displaying a table of contents in one frame, while showing individual pages from the site in another. New Perspectives on HTML, XHTML, and Dynamic HTML, 4e

Creating a Field Set HTML and XHTML allow you to organize option buttons into a group of fields called field sets. <fieldset id=“id”> controls </fieldset> where id identifies the field set and controls are the control elements associated with fields within the field set New Perspectives on HTML, XHTML, and Dynamic HTML, 4e

Creating a Field Set To add a caption to a field set, add the following tag after the opening <fieldset> tag: <legend>text</legend> Where text is the text of the field set caption. New Perspectives on HTML, XHTML, and Dynamic HTML, 4e

Creating Input Boxes The general syntax of input elements is as follows: <input type=“type” name=“name” id=“id” /> Where type specifies the type of input control, and the name and id attributes provide the control’s name and id. New Perspectives on HTML, XHTML, and Dynamic HTML, 4e

Creating Input Boxes New Perspectives on HTML, XHTML, and Dynamic HTML, 4e

Working with Field 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: <label for=“id”>label text</label> Where id is the value of the id attribute for a field’s control element, and label text is the text of the label. Notes: New Perspectives on HTML, XHTML, and Dynamic HTML, 4e

Setting the Width of an Input Box To change the width of an input box, use the width attribute, which is displayed as follows: #id {width: value} Where id is the id of the control and value is the width you want to apply to the input box New Perspectives on HTML, XHTML, and Dynamic HTML, 4e

Setting the Width of an Input Box New Perspectives on HTML, XHTML, and Dynamic HTML, 4e

Creating Option Buttons Option buttons, or radio buttons allow users to make selections. Unlike selection lists, option buttons only allow the user to select one option at a time. New Perspectives on HTML, XHTML, and Dynamic HTML, 4e

Creating a Group of Option Buttons To create a group of option buttons associated with a single field, add the elements: <input type="radio" name="name" id="id1" value="value1" /> <input type="radio" name="name" id="id2" value="value2" /> <input type="radio" name="name" id="id3" value="value3" /> to the Web form, where name identifies the field associated with the collection of option buttons; id1, id2, id3, etc. identify the specific options; and value1, value2, value3, etc. are the field values associated with each option. To specify the default option, add the following attribute to the <input> tag: checked="checked" New Perspectives on HTML, XHTML, and Dynamic HTML, 4e

Creating a Selection List A selection list is a list box from which a user selects a particular field value or set of field 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 <select> element. You can specify each individual selection item using the <option> element. New Perspectives on HTML, XHTML, and Dynamic HTML, 4e

Setting the Selection List Size You can change the number of options displayed in the selection list by modifying the size attribute. The syntax is as follows: <select size= “value”>… </select> Where value is the number of items that the selection list displays in the form. New Perspectives on HTML, XHTML, and Dynamic HTML, 4e

Setting the Selection List Size New Perspectives on HTML, XHTML, and Dynamic HTML, 4e

Making Multiple Selections Add the multiple attribute to the select element to create multiple selections: <select multiple=“multiple”>… </select> New Perspectives on HTML, XHTML, and Dynamic HTML, 4e

Working with Check Boxes To create a check box, use: <input type=“checkbox” name=“name” id=“id” value=“value” /> Where the name and id attributes identify the check box controls and the value attribute specifies the value sent to the server if the check box is selected. To specify that a check box be selected by default, use the checked attribute as follows: <input type=“checkbox” checked=“checked” /> New Perspectives on HTML, XHTML, and Dynamic HTML, 4e

Specifying the Tab Order Users typically navigate through a form with the tab key. You can specify an alternate tab order by adding the tabindex attribute to any control element in your form. The syntax is as follows: <input name=“fname” id=“firstName” tabindex=“1” /> This syntax assigns the tab index number “1” to the fname field from the registration form. New Perspectives on HTML, XHTML, and Dynamic HTML, 4e

Working with Text Area Control Text area boxes allow users to enter comments. An input box would be too small to accommodate the length of text for this use. New Perspectives on HTML, XHTML, and Dynamic HTML, 4e

Working with Text Area Control To create a text area box, use the textarea element: <textarea rows="value" cols="value"> ... </textarea> Where the rows and cols attributes define the dimensions of the input box and the rows attribute indicates the number of lines in the input box. New Perspectives on HTML, XHTML, and Dynamic HTML, 4e

Working with Text Area Control New Perspectives on HTML, XHTML, and Dynamic HTML, 4e

Working with Text Area Control New Perspectives on HTML, XHTML, and Dynamic HTML, 4e

Working with Form Buttons Buttons are a type of control element that performs an action. Types of buttons: Command button Submit button Reset button New Perspectives on HTML, XHTML, and Dynamic HTML, 4e

Creating a Command button Command buttons are created using the <input> tag: <input type=“button” value=“text” /> Submit buttons submit forms to the server for processing when clicked. Syntax is as follows: <input type=“submit” value=“text” /> Reset buttons reset forms to their original (default) values. Syntax is as follows: <input type=“reset” value=“text” /> New Perspectives on HTML, XHTML, and Dynamic HTML, 4e

Completed Form New Perspectives on HTML, XHTML, and Dynamic HTML, 4e

Designing a Custom Button Use the button element for greater artistic control over the appearance of a button. <button name=“name” id=“id” value=“value” type=“type”> content </button> Where the name and value attributes specify the name of the button and the value sent to a server-based program, the id attribute specifies the button’s id, the type attribute specifies the button type, and the content is page content displayed within the button. New Perspectives on HTML, XHTML, and Dynamic HTML, 4e

Creating File Buttons File buttons are used to select files so that their contents can be submitted for processing to a program. New Perspectives on HTML, XHTML, and Dynamic HTML, 4e

Working with Hidden Fields Hidden fields are added to a form, but not displayed in the Web page. The syntax is as follows: <input type=“hidden” name=“name” id=“id” value=“value” /> New Perspectives on HTML, XHTML, and Dynamic HTML, 4e

Working with Form Attributes After adding the elements to your form, you’ll need to specify where to send the form data and how to send it. Use the following attributes: <form action=“url”method=“type”enctype=“type”>… </form> Where url specifies the filename and location of the program that processes the form and the method attribute specifies how your Web browser sends data to the server. The enctype attribute specifies the format of the data stored in the form’s field. New Perspectives on HTML, XHTML, and Dynamic HTML, 4e

Working with Form Attributes The method attribute can have one of two values: Post Get The get method is the default; get appends the form data to the end of the URL specified in the action attribute. The post method sends form data in a separate data stream, allowing the Web server to receive the data through “standard input.” New Perspectives on HTML, XHTML, and Dynamic HTML, 4e

Using the mailto Action The mailto action accesses the user’s own e-mail program and uses it to mail form information to a specified e-mail address. Bypasses the need for server-based programs. The syntax is as follows: <form action-mailto:e-mail method=“post” enctype=“text/plain”> … </form> Where e-mail_address is the e-mail address of the recipient in the form. New Perspectives on HTML, XHTML, and Dynamic HTML, 4e

Tips for Creating Effective Forms Mark fields that are required, but also limit the number of unrequired fields. Don’t overwhelm your users with requests for information that is not really essential. Keep your forms short and to the point. If you need to collect a lot of information, break the form into manageable sections spread out over several pages. Allow users to easily move backward and forward through the forms without losing data. New Perspectives on HTML, XHTML, and Dynamic HTML, 4e

Tips for Creating Effective Forms Provide detailed instructions about what users are expected to do. Don’t assume that your form is self-explanatory. If you ask for personal data and financial information, provide clear assurances that the data will be secure. If possible, provide a link to a Web page describing your security practices. Clearly indicate what users will receive once the form is submitted, and provide feedback on the Web site and through e-mail that tells them when their data has been successfully submitted. New Perspectives on HTML, XHTML, and Dynamic HTML, 4e