CHAPTER 30 THE HTML 5 FORMS PROCESSING. LEARNING OBJECTIVES What the three form elements are How to use the HTML 5 tag to specify a list of words’ form.

Slides:



Advertisements
Similar presentations
Tutorial 6 Creating a Web Form
Advertisements

Ch3: Introduction to HTML5 part 2 Dr. Abdullah Almutairi ISC 340 Fall 2014.
JavaScript Forms Form Validation Cookies. What JavaScript can do  Control document appearance and content  Control the browser  Interact with user.
CHAPTER 6 GETTING USER INPUT WITH FORMS. LEARNING OBJECTIVES Use the and tag pair to define an HTML-based form Use the tag to create a text box for user.
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.
Python and Web Programming
Creating Web Page Forms
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.
Chapter 10 Form Basics Key Concepts Copyright © 2013 Terry Ann Morris, Ed.D 1.
Form Handling, Validation and Functions. Form Handling Forms are a graphical user interfaces (GUIs) that enables the interaction between users and servers.
Lesson 8 Creating Forms with JavaScript
CST JavaScript Validating Form Data with JavaScript.
HTML 5 Tutorial Chapter 9 Form Attributes. New Form Attributes HTML5 has several new elements and attributes for forms. New form attributes : autocomplete.
1 Web Developer & Design Foundations with XHTML Chapter 6 Key Concepts.
Internet & World Wide Web How to Program, 5/e Copyright © Pearson, Inc All Rights Reserved.
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.
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?
WEB FORM DESIGN. Creating forms for a web page For your web project you have to design a form for inclusion on your web site (the form information should.
Database-Driven Web Sites, Second Edition1 Chapter 8 Processing ASP.NET Web Forms and Working With Server Controls.
Chapter 6: Forms JavaScript - Introductory. Previewing the Product Registration Form.
 2003 Prentice Hall, Inc. All rights reserved. CHAPTER 3 JavaScript 1.
Neal Stublen Improvements  New form elements  Assist with validation  Consistency across sites  Changes reduce the need for common.
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.
Creating a Web Site to Gather Data and Conduct Research.
Section 17.1 Add an audio file using HTML Create a form using HTML Add text boxes using HTML Add radio buttons and check boxes using HTML Add a pull-down.
Tutorial 7 Creating Forms. Objectives Session 7.1 – Create an HTML form – Insert fields for text – Add labels for form elements – Create radio buttons.
 2003 Prentice Hall, Inc. All rights reserved. CHAPTER 3 JavaScript 1.
 Whether using paper forms or forms on the web, forms are used for gathering information. User enter information into designated areas, or fields. Forms.
HTML Forms.
LOGO FORMs in HTML CHAPTER 5 Eastern Mediterranean University School of Computing and Technology Department of Information Technology ITEC229 Client-Side.
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.
Creating Web Page Forms. Introducing Web Forms Web forms collect information from users Web forms include different control elements including: –Input.
Microsoft FrontPage 2003 Illustrated Complete Creating a Form.
1 HTML Forms
Chapter 4: Working with ASP.NET Server Controls OUTLINE  What ASP.NET Server Controls are  How the ASP.NET run time processes the server controls on.
HTML Forms. Slide 2 Forms (Introduction) The purpose of input forms Organizing forms with a and Using different element types to get user input A brief.
Copyright © Texas Education Agency, All rights reserved.1 Web Technologies Website Forms / Data Acquisition.
INT222 - Internet Fundamentals Shi, Yue (Sunny) Office: T2095 SENECA COLLEGE.
8 Chapter Eight Server-side Scripts. 8 Chapter Objectives Create dynamic Web pages that retrieve and display database data using Active Server Pages Process.
WEB FORM DESIGN. Creating forms for a web page For your web project you have to design a form for inclusion on your web site (the form information should.
HTML5 Forms Forms are used to capture user input …
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.
Department of Computer Science, Florida State University CGS 3066: Web Programming and Design Spring Forms, HTML5 layout.
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.)
03 – HTML (2) Informatics Department Parahyangan Catholic University.
Tutorial 6 Creating a Web Form
HTML FORM. Form HTML Forms are used to select different kinds of user input. HTML forms are used to pass data to a server. A form can contain input elements.
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.
Unit 4 Working with data. Form Element HTML forms are used to pass data to a server. A form can contain input elements like text fields, checkboxes, radio-buttons,
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.
Creating and Processing Web Forms
JavaScript, Sixth Edition
Objectives Design a form Create a form Create text fields
Basic XHTML Tables XHTML tables—a frequently used feature that organizes data into rows and columns. Tables are defined with the table element. Table.
IS333: MULTI-TIER APPLICATION DEVELOPMENT
Web Systems Development (CSC-215)
Using Templates and Library Items
HTML5 - 2 Forms, Frames, Graphics.
Presentation transcript:

CHAPTER 30 THE HTML 5 FORMS PROCESSING

LEARNING OBJECTIVES What the three form elements are How to use the HTML 5 tag to specify a list of words’ form fields to assist with autocomplete operations How to use the HTML 5 tag to generate a private and public encryption key pair How to use the HTML 5 tag to integrate the result of a calculation into a form’s display How to use the HTML 5 form attribute values What the HTML 5 input values are

HTML 5 FORM ELEMENTS A form element is a tag or tag pair that you can place within the and tag pair. HTML 5 adds three form elements to examine:,, and.

CREATING A DATA LIST A data list, in HTML 5, is a list of entries, similar to entries within a pull-down list, but without the pull-down. The browser uses the list to auto-complete user input as you type. Autocomplete is an input technique where a program, such as a browser, attempts to anticipate a user’s remaining input. To create a data list, you must specific options within the and tag pair: Alabama Arizona Arkansas California Nevada

STATES DATA LIST EXAMPLE Alabama Arizona Arkansas California Nevada State:

CREATING A PRIVATE AND PUBLIC KEY PAIR By default, unless you are using an connection, the content that a form sends to a remote server is not encrypted. To move toward encrypted content, HTML 5 has introduced the tag, which directs the browser to create and store a private key and to send a public key to the server. At the time of this writing, the tag is still in flux with varied browser support:

USING THE OUTPUT OF A CALCULATION The HTML 5 and tag pair lets you display the result, or output, of a calculation. The following HTML file, OutputDemo.html, illustrates the tag’s use: x y Addition: As you can see, the page displays two input fields. After you type values for each field, the form will display the results of an addition of the two values, as shown. Again, not all browsers may support the tag.

HTML 5 FORM ATTRIBUTES In addition to providing three new form elements, HTML 5 provides several attributes for either the or tags. The sections that follow examine each attribute. Again, before you use these attributes within a real world application, take time to test your code within a variety of browsers.

DIRECTING THE BROWSER TO AUTOCOMPLETE A FIELD OR FORM As you surf the Web, there may be times when your browser attempts to autocomplete text in fields as you type, based on your previous responses. Under HTML 5, you can enable or disable such processing for an entire form or for fields on a field-by-field basis:

DISABLING FORM VALIDATION By default, when you use different HTML 5 field types and attributes, your browser tries to validate form fields. Depending on the form’s purpose, you may want to disable such validation using the tag novalidate attribute:

SPECIFYING A FIELD TO RECEIVE THE INPUT FOCUS WITHIN A FORM By default, when you create an HTML form, the browser assigns the first field in the form with the keyboard focus. Using the HTML 5 autofocus attribute, you can specify the field that you desire to first receive the focus: Username: Password: Nickname:

USING THE TAG FORM ATTRIBUTE Normally, developers group a form’s tags within the and tag pair. If, for some reason, you have an tag that resides outside of a form, you can use the form attribute to specify the tag’s corresponding form: Nickname:

OVERRIDING A FORM’S SUBMIT-METHOD ATTRIBUTE As you have learned, when a browser submits a form’s data, the browser performs either a get or put operation: Depending on the processing you are performing, there may be times when you will want to override a form’s specified submission method. In such cases, use the tag formmethod attribute:

OVERRIDING A FORM’S VALIDATION PROCESSING As you have learned, HTML 5 provides the tag novalidate attribute that specifies whether or not the form’s contents should be validated. Depending on your form’s processing, there may be times when you will want to provide a button that allows submission without validation. In such cases, use the tag formnovalidate attribute: Field:

CONTROLLING THE DISPLAY OF A SERVER’S RESPONSE When you submit a form to a remote server, should the server send a response, the page displays the response. Depending on your form’s purpose, there may be times when you will want to display the server response within a different window. To do so, use the formTarget attribute. The following HTML file, FormTarget.html, uses the FormEcho script on this book’s companion website. The page provides a submit button, which will use the attribute to display the script’s results in a new window: Value:

SPECIFYING AN INPUT TAG’S HEIGHT AND WIDTH As you have learned, using an element’s height and width attributes, you can specify the item’s size within an HTML page. When you specify the HTML 5 type=”image” attribute, you can specify an tag’s height and width. The following HTML file, InputSize.html, specifies the size of an element:

SPECIFYING MIN AND MAX VALUES Often, a field will prompt a user for a numeric or date field for which you want to restrict the user to a range of values. Using the min and max attributes, you can specify the ranges, as shown here: Age:

SPECIFYING MULTIPLE VALUES FOR A FILE- UPLOAD OPERATION In Chapter 6, you learned that using the tag type=“file” attribute, you can allow the user to select a file for an upload operation. Using the HTML 5 multiple attribute, you can allow the user to select multiple files: File(s):

SPECIFYING A REGULAR EXPRESSION PATTERN FOR TEXT INPUT Often, when you prompt users for input using a form, such as a phone number or e- mail address, you will want them to put the data within a specific format. Using the HTML 5 pattern attribute, you can specify a regular expression the user’s input must meet in order to be considered valid. A regular expression is a sequence of characters that can be used to match an entry based upon predefined rules. The following statements, for example, illustrate how you might use the attribute for a phone number: Phone

USING A DATA LIST REFERENCE As you have learned, an HTML 5 data list defines a list of entries the browser uses to match keyboard input for a field. Using the list attribute, you can refer to a pre-existing data list: State:

SPECIFYING A FIELD PLACEHOLDER Normally, when a page displays a form, the browser displays blank values for each text field. The HTML 5 placeholder attribute lets you specify a value that the browser initially displays within a field. The value might, for example, show a sample of the data format the field expects. The following HTML file, UsePlaceholder.html, uses two placeholder values: Default: Placeholder:

SPECIFYING THAT A FIELD IS REQUIRED Most forms have one or more values for which the user must provide values. Normally, after the user submits the form, a JavaScript routine on the page detects missing fields and notifies you to provide them. HTML 5, in contrast, provides the required attribute, which tells the browser that a field is required. The following HTML 5 file, UseRequired.html, uses a required field: Default: Placeholder:

SPECIFYING A STEP ATTRIBUTE Depending on the type of values for which your form is prompting, there may be times when you want to specify a list of numbers separated by a specific value, such as 0, 5, 10, 15, and so on. Only a few browsers currently support the step attribute:

UNDERSTANDING HTML 5 INPUT As you have learned in Chapter 6, within an tag you can use the type attribute to specify the kind of value a field accepts, such as text, password, radio buttons, check boxes, and so on. HTML 5 adds the following tag types specified in Table 30.1.

REAL WORLD DESIGN – HTML 5 FORMS To help you get started with HTML 5 form attributes and elements, the W3Schools web site provides two excellent tutorials. The first, at examines HTML 5 form elements. The second, at presents form attributes introduced with HTML

SUMMARY Across the Web, sites make extensive use of forms to prompt you for input. Chapter 6, “Getting User Input With Forms,” examines form processing and user input operations in detail. This chapter introduces the form-based features provided in HTML 5. Unfortunately, many of these features are still evolving, and their support is varied. That said, the features provide you with insights to browser capabilities in the future. Should you use the techniques this chapter presents, it is important that you test each using a variety of browsers to ensure that your browser provides the necessary support.