Session 1 Chapter 10 - How to Work with Forms ITI 134: HTML5 Desktop and Mobile Level II www.profburnett.com.

Slides:



Advertisements
Similar presentations
Tutorial 6 Creating a Web Form
Advertisements

Ch3: Introduction to HTML5 part 2 Dr. Abdullah Almutairi ISC 340 Fall 2014.
Chapter 6 Basic forms 1. Forms and query string 2 form : a group of user input (UI) controls that accepts information from the user and sends the information.
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.
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.
Copyright © Terry Felke-Morris WEB DEVELOPMENT & DESIGN FOUNDATIONS WITH HTML5 Chapter 9 Key Concepts 1 Copyright © Terry Felke-Morris.
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.
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.
Tutorial #9 – Creating Forms. Tutorial #8 Review – Tables Borders (table, gridlines), Border-collapse: collapse; empty-cells: show; and rowspan, colspan.
CIS 1310 – HTML & CSS 9 Forms. CIS 1310 – HTML & CSS Learning Outcomes  Describe Common Uses of Forms on Web Pages  Create Forms on Web Pages  Associate.
XP Tutorial 6New Perspectives on Creating Web Pages with HTML, XHTML, and XML 1 Creating Web Page Forms Designing a Product Registration Form Tutorial.
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?
Neal Stublen Improvements  New form elements  Assist with validation  Consistency across sites  Changes reduce the need for common.
Tables and Forms HTML5 Tables and Forms. Table Overview table element ( ) Attributes: align (left, right, center), bgcolor, border, cellpadding, cellspacing,
Basics of Web Design 1 Copyright © 2016 Pearson Education, Inc., Hoboken NJ.
Session: 10. © Aptech Ltd. 2HTML Forms / Session 10  Describe HTML5 forms  Explain the working of new input types in HTML5  Explain the new Form attributes.
Copyright © Terry Felke-Morris WEB DEVELOPMENT & DESIGN FOUNDATIONS WITH HTML5 7 TH EDITION Chapter 9 Key Concepts 1 Copyright © Terry Felke-Morris.
HTML Forms.
LOGO FORMs in HTML CHAPTER 5 Eastern Mediterranean University School of Computing and Technology Department of Information Technology ITEC229 Client-Side.
Web Development & Design Foundations with XHTML Chapter 9 Key Concepts.
Copyright © Terry Felke-Morris WEB DEVELOPMENT & DESIGN FOUNDATIONS WITH HTML5 Chapter 9 Key Concepts 1 Copyright © Terry Felke-Morris.
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.
Creating Web Page Forms. Introducing Web Forms Web forms collect information from users Web forms include different control elements including: –Input.
Copyright © Terry Felke-Morris WEB DEVELOPMENT & DESIGN FOUNDATIONS WITH HTML5 7 TH EDITION Chapter 9 Key Concepts 1 Copyright © Terry Felke-Morris.
FORMS. Forms are used to receive information from the web surfer, such as: their name, address, credit card, etc. Form fields are objects that allow.
Web Development & Design Foundations with XHTML Chapter 9 Key Concepts.
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.
HTML Forms a form is a container for input elements on a web page input elements contain data that is sent to the web server for processing.
Copyright © Terry Felke-Morris HTML5: TEXT BOX Accepts text information in address format Common Attributes: ◦ type=“ ” ◦ name ◦ id ◦
INT222 - Internet Fundamentals Shi, Yue (Sunny) Office: T2095 SENECA COLLEGE.
Copyright © Terry Felke-Morris WEB DEVELOPMENT & DESIGN FOUNDATIONS WITH HTML5 Chapter 9 Key Concepts 1 Copyright © Terry Felke-Morris.
HTML Forms Forms, Controls, Fields, Inputs, Submission, Validation SoftUni Team Technical Trainers Software University
+ FORMS HTML forms are used to pass data to a server. begins and ends a form Forms are made up of input elements Every input element has a name and value.
HTML Forms.
Week 10: HTML Forms HNDIT11062 – Web Development.
03 – HTML (2) Informatics Department Parahyangan Catholic University.
1 Web Engineering Forms Lecture 05. FORMS Its how HTML does interactivity. There are quite new feature in HTML5. But the fundamental idea does not change.
expanded by J. Goetz, © Pearson Education Copyright (c) 2006 Prentice-Hall. All rights reserved.
Tutorial 6 Creating a Web Form
Session I How to Work with Forms Chapter 11 - How to Work with Formswww.profburnett.com.
XP Tutorial 6New Perspectives on HTML, XHTML, and DHTML, Comprehensive 1 Creating Web Page Forms Designing a Product Registration Form Tutorial 6.
Session I Chapter 11 - How to Work with Forms
>> Introduction to HTML: Forms
How to Write Web Forms By Mimi Opkins.
HTML Forms Pat Morin COMP 2405.
FORMS IN HTML.
>> More on HTML Forms
WHY FORMS? Explain: Mostly, when you need to collect data from a user you need a form Click: Google search form Click: Facebook login form Click:
ITE 115 Creating Web Page Forms
ARUSHA TECHNICAL COLLEGE WEB DESIGN(html forms)
IS333: MULTI-TIER APPLICATION DEVELOPMENT
Web Development & Design Foundations with HTML5 8th Edition
Designing Forms Lesson 10.
Objectives Explore web forms Work with form servers
Web Development & Design Foundations with H T M L 5
HTML5 Level II Session III
CYB 010 HTML Level II CyberAdvantage Seniors
CNIT 131 HTML5 - Forms.
Web Development & Design Foundations with H T M L 5
Session IV Chapter 10 – How to Work with Forms and Data Validation
Principles of Web Design 5th Edition
Basics of Web Design Chapter 10 Form Basics Key Concepts
Session III Chapter 10 – How to Work with Forms and Data Validation
Kanida Sinmai HTML Form Kanida Sinmai
ITI 133: HTML5 Desktop and Mobile Level I
Presentation transcript:

Session 1 Chapter 10 - How to Work with Forms ITI 134: HTML5 Desktop and Mobile Level II

Class Outline  How to Use Forms and Controls  Other Skills for Working with Forms  How to Use HTML5 for Data Validation  How to Use HTML5 Controls 2/25/ Copyright © Carl M. Burnett

2/25/ Copyright © Carl M. Burnett AttributeDescription type Type of control ie “button”, “text”, “checkbox” name Name of Code disabled Boolean that disables control readonly Boolean that means user can change control value Attributes - Input Elements Attributes of Form Element AttributeDescription name Name for code action URL of processing file method Get or Post target Where to open page

HTML for Form 2/25/ Copyright © Carl M. Burnett <form name=" _form" action="subscribe.php" method="post"> Please enter your address to subscribe to our newsletter. <input type="submit" name="submit" value="Subscribe"> subscribe.php? =zak%40modulemedia.com&submit=Subscribe URL when form submitted with “get” method Example

Attributes Input Element Buttons and Button Element 2/25/ Copyright © Carl M. Burnett AttributesDescriptions typeSubmit, Reset, button, or image valueText to display srcRelative or Absolute URL of image altAlternate Text heightPixels or Percent widthPixels or Percent

2/25/ Copyright © Carl M. Burnett <input type="image" src="images/submit.jpg" alt="Submit button" width="114" height="42"> Four buttons that are created by the input element <img src="images/addtocart.png" width="30" <img src="images/addtocart.png" width="30" height="23" alt="Add to Cart">Add to Cart height="23" alt="Add to Cart">Add to Cart</button> A button that is created by the button element Example

Attributes - Input Element Text Fields AttributesDescriptions type text, password, or hidden value Default value maxlength Max Characters size Width of the field in characters autofocus A boolean attribute to set focus on placeholder Puts a default value or hint in the field. Value is removed when user’s cursor enters the control 2/25/ Copyright © Carl M. Burnett

2/25/ Copyright © Carl M. Burnett Quantity:<input type="text" name="quantity" value="1" size="5" readonly> Username:<input type="text" name="username" autofocus> Password:<input type="password" name="password" maxlength="6" placeholder="Enter your password"> Hidden:<input type="hidden" name="productid" value="widget"> The HTML for text fields Example

Attributes of Radio Buttons and Check Boxes 2/25/ Copyright © Carl M. Burnett AttributesDescriptions type Radio or checkbox value Value Submitted checked Boolean Crust: Thin Crust Deep Dish Hand Tossed Toppings: Pepperoni Mushrooms Olives Example

Attributes of Optgroup and Option Element 2/25/ Copyright © Carl M. Burnett ElementAttributesDescriptions optgroupLabel Text used to identify group optionvalue Value sent to server optionselected Boolean value Style: 10" 12" 16" 10" 12" 16" Example

Attributes of Select Element for List Boxes 2/25/ Copyright © Carl M. Burnett AttributesDescriptions size Number if item to display multiple Boolean for multiple select Pepperoni Sausage Mushrooms Black olives Onions Canadian bacon Pineapple Example

Attributes of Textarea Element 2/25/ Copyright © Carl M. Burnett AttributesDescriptions rows Approximate number of rows cols Approximate number of columns wrap Text wrap specifications: hard | soft (default) CSS for Text Area HTML for Text Area Comments: textarea { height: 5em; width: 25em; font-family: Arial, Helvetica, sans-serif; } Example

The HTML for a form with label elements 2/25/ Copyright © Carl M. Burnett AttributesDescriptions for Set the id of the related control. id required for form that use labels for attributes. Quantity: <input type="text" name="quantity" id="quantity" value="1" size="5"> Crust: <input type="radio" name="crust" id="crust1" value="thin"> Thin Crust <input type="radio" name="crust" id="crust2" value="deep"> Deep Dish <input type="radio" name="crust" id="crust3" value="hand"> Hand Tossed Example

HTML that uses fieldset and legend elements 2/25/ Copyright © Carl M. Burnett Crust <input type="radio" name="crust" id="crust1" value="thin"> Thin Crust <input type="radio" name="crust" id="crust2" value="deep"> Deep Dish <input type="radio" name="crust" id="crust3" value="hand"> Hand Tossed Example

Attributes of the input element for a file upload control AttributesDescriptions accept The types of files accepted for upload. multiple Boolean attribute to upload more than one file. <form name="upload_form" action="send .php" method="post" enctype="multipart/form-data"> Attach an image: <input type="file" name="fileupload" accept="image/jpeg, image/gif"> HTML for a file upload control Example 2/25/ Copyright © Carl M. Burnett

Aligned label, text box, and button controls First name: <input type="text" name="firstname" id="firstname" autofocus> Last name: Address: City: State: Zip code: <input type="submit" name="register" id="button" value="Register"> Example The CSS for the controls The HTML for the controls label { float: left; width: 5em; text-align: right;} input { margin-left: 1em; margin-bottom:.5em;} #button { margin-left: 7em;} 2/25/ Copyright © Carl M. Burnett

The CSS for the enhanced form body { font: 90% Arial, Helvetica, sans-serif; margin: 20px; } label { color: navy; float: left; width: 8em; font-weight: bold; text-align: right;} input { width: 15em; margin-left: 1em; margin-bottom:.5em;} input:focus { border: 2px solid navy; } #button, #reset { width: 7em; box-shadow: 2px 2px 0 navy; background-color: silver; } #button { margin-left: 9.5em; } Example 2/25/ Copyright © Carl M. Burnett

The attributes for tab order and access keys AttributesDescriptions tabindex Sets the tab order of the control accesskey Keyboard and control key Accessibility guideline - Setting a proper tab order and providing access keys improves the accessibility for users who can’t use a mouse. F irst name: <input type="text" name="firstname" id="firstname" accesskey="F"> L ast name: <input type="text" name="lastname" id="lastname" accesskey="L"> E mail: <input type="text" name=" " id=" " accesskey="E The HTML for the controls <label for="firstname" accesskey="F"> F irst name: <label for="lastname" accesskey="L"> L ast name: E mail: Another way to define the access keys Example 2/25/ Copyright © Carl M. Burnett

The HTML5 attributes for data validation AttributesDescriptions autocomplete Set attribute to off – disables auto-completion required Boolean attribute – Form submitted empty browser display error message novalidate Boolean attribute to tell browser not to validate form Name: Address: <input type="text" name="address" novalidate> Zip: Phone: <input type="text" name="phone" required autocomplete="off"> HTML that uses the validation attributes Example :valid :invalid input[required] :required Selector for controls with required attribute The CSS3 pseudo-classes for validation 2/25/ Copyright © Carl M. Burnett

Attributes for using regular expressions AttributesDescriptions pattern Specifies regular expression to valid entry title Test that is displayed in tooltip Patterns for common entries Used ForPattern Password (6+ alphanumeric) [a-zA-Z0-9]{6,} Zip code (99999 or ) \d{5}([\-]\d{4})? Phone number ( ) \d{3}[\-]\d{3}[\-]\d{4} Date (MM/DD/YYYY) [01]?\d\/[0-3]\d\/\d{4} URL (starting with or https?://.+ Credit card ( ) ^\d{4}-\d{4}-\d{4}-\d{4}$ 2/25/ Copyright © Carl M. Burnett

HTML that uses regular expressions Name: <input type="text" name="name" required autofocus> Zip: <input type="text" name="zip" required pattern="\d{5}([\-]\d{4})?" title="Must be or "> Phone: <input type="text" name="phone" required pattern="\d{3}[\-]\d{3}[\-]\d{4}" title="Must be "> Example 2/25/ Copyright © Carl M. Burnett

Attributes for the option elements within a datalist element AttributesDescriptions value The value of the option in the datalist. Left aligned label Description of item Our company is conducting a survey. Please answer the question below. What is your preferred search engine: <option value=" label="Google"> <option value=" label="Dogpile"> Example 2/25/ Copyright © Carl M. Burnett

The type attribute for , url, and tel controls AttributesDescriptions A control for receiveing address (Implies Validation) url A control for receiving a URL (Implies Validation) tel A control for receiving a telephone number (Does not Imply Validation) <form name=" _form" action="survey.php" method="post"> Your information: Your address: <input type=" " name=" " id=" " required> Your web site: <input type="url" name="link" id="link" list="links"> Your phone number: <input type="tel" name="phone" id="phone" required> <input type="submit" name="submit" value="Submit Survey"> Example 2/25/ Copyright © Carl M. Burnett

Attributes for the number and range controls AttributesDescriptions min Minimum value max Maximum value step The increase and decrease by user clicks or up and down arrow keys Your information: Monthly investment: <input type="number" name="investment" id="investment" min="100" max="1000" step="100" value="300"> Rate the book from 1 to 5: <input type="range" name="book" id="book" min="1" max="5" step="1"> <input type="submit" name="submit" value="Submit Survey"> Example 2/25/ Copyright © Carl M. Burnett

Attributes for the date and time controls AttributesDescriptions min Minimum value max Maximum value Date and time: Local date and time: <input type="datetime-local" name="datetimelocal"> Month: Week: Time: Date: Example In Opera 2/25/ Copyright © Carl M. Burnett

A search function that uses a search control <input type="search" name="q" size="30" maxlength="255"> <input type="hidden" name="domains" value=" <input type="hidden" name="sitesearch" value=" Example 2/25/ Copyright © Carl M. Burnett

The HTML for a color control Choose your first background color: Example In Opera 2/25/ Copyright © Carl M. Burnett

An attribute for the output element AttributeDescriptions for Can be used to associate output element with one or more controls Enter numbers in both fields and click the Calculate button. <input name="x" type="number" min="100" step="5" value="100"> + <input name="y" type="number" min="100" step="5" value="100"> <input type="button" value="Calculate" onClick="result.value = parseInt(x.value) + parseInt(y.value)"> Total: Example In Safari 2/25/ Copyright © Carl M. Burnett

Attributes for the progress and meter elements AttributesDescriptions high High point low Low point min Lowest limit max Maximum limit optimum Optimum value value Current value Progress Element Progress set by JavaScript on page load: <progress id="progressBar" max="100" value="0"> Meter Element Meter set by JavaScript on page load: <meter id="meterBar" max="100" value="0" optimum="50" high="60"> Example In Opera 2/25/ Copyright © Carl M. Burnett

A web page that uses HTML5 data validation (Opera) HTML CSS Example In Opera 2/25/ Copyright © Carl M. Burnett

Student Exercise 2  Complete Exercise 8-1 on page 372 using Dreamweaver.  Upload your HTML pages and CSS files to the live site to preview. 2/25/2014 Copyright © Carl M. Burnett 31

Class Review  How to Use Forms and Controls  Other Skills for Working with Forms  How to Use HTML5 for Data Validation  How to Use HTML5 Controls 2/25/ Copyright © Carl M. Burnett Next – Chapter 11 - How to add audio and video to your web site