HTML 5 Form elements Basharat Mahmood, Department of Computer Science,CIIT,Islamabad, Pakistan. 1.

Slides:



Advertisements
Similar presentations
CSCI 6962: Server-side Design and Programming Input Validation and Error Handling.
Advertisements

Tutorial 6 Creating a Web Form
Internet & World Wide Web How to Program, 5/e Copyright © Pearson, Inc All Rights Reserved.
Internet & World Wide Web How to Program, 5/e Copyright © Pearson, Inc All Rights Reserved.
Ch3: Introduction to HTML5 part 2 Dr. Abdullah Almutairi ISC 340 Fall 2014.
Lesson 16 Enhancing Documents
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.
Tutorial 14 Working with Forms and Regular Expressions.
Validating user input Basharat Mahmood, Department of Computer Science,CIIT,Islamabad, Pakistan. 1.
Database Connectivity in PHP Basharat Mahmood, Department of Computer Science,CIIT,Islamabad, Pakistan. 1.
File uploading in PHP Basharat Mahmood, Department of Computer Science,CIIT,Islamabad, Pakistan. 1.
CS 174: Web Programming February 26 Class Meeting Department of Computer Science San Jose State University Spring 2015 Instructor: Ron Mak
Tables in HTML Basharat Mahmood, Department of Computer Science,CIIT,Islamabad, Pakistan. 1.
User Interface Design using jQuery Mobile CIS 136 Building Mobile Apps 1.
Form Handling, Validation and Functions. Form Handling Forms are a graphical user interfaces (GUIs) that enables the interaction between users and servers.
HTML 5 Tutorial Chapter 9 Form Attributes. New Form Attributes HTML5 has several new elements and attributes for forms. New form attributes : autocomplete.
Internet & World Wide Web How to Program, 5/e Copyright © Pearson, Inc All Rights Reserved.
HTML Forms What is a form.
Deleting and Updating Records in MySQL using PHP Basharat Mahmood, Department of Computer Science,CIIT,Islamabad, Pakistan. 1.
Building the User Interface by Using HTML5: Organization, Input, and Validation Lesson 3.
1 Creating Web Forms in HTML Web forms collect information from customers Web forms include different control elements including: –Input boxes –Selection.
Page Layout Basharat Mahmood, Department of Computer Science, CIIT, Islamabad, Pakistan 1.
Database-Driven Web Sites, Second Edition1 Chapter 8 Processing ASP.NET Web Forms and Working With Server Controls.
Tutorial 14 Working with Forms and Regular Expressions.
Telerik Software Academy ASP.NET Web Forms Data Validation, Data Validators, Validation Groups Telerik Software Academy
Neal Stublen Improvements  New form elements  Assist with validation  Consistency across sites  Changes reduce the need for common.
Web Application and Development Digital Media Department Unit Credit Value : 4 Essential Learning time : 120 hours Digital Media.
CHAP 3. FORM API.  Forms should still be encapsulated in a element where the basic submission attributes are set.  Forms still send the values of the.
History, Navigator, Screen and Form Objects Basharat Mahmood, Department of Computer Science, CIIT, Islamabad, Pakistan 1.
Robinson_CIS_285_2005 HTML FORMS CIS 285 Winter_2005 Instructor: Mary Robinson.
Working with background, images and date object Basharat Mahmood, Department of Computer Science, CIIT, Islamabad, Pakistan 1.
Adding Image, audio and video files to web pages Basharat Mahmood, Department of Computer Science,CIIT,Islamabad, Pakistan. 1.
TUTORIAL 10: PROGRAMMING WITH JAVASCRIPT Session 3.
Introduction to HTML 1 Basharat Mahmood, Department of Computer Science, CIIT, Islamabad, Pakistan.
Introduction to JavaScript Basharat Mahmood, Department of Computer Science, CIIT, Islamabad, Pakistan. 1.
Introduction to Cascading Style-sheets (CSS) Basharat Mahm ood, Department of Computer Science, CIIT,Islamabad, Pakistan 1.
CS 174: Web Programming September 30 Class Meeting Department of Computer Science San Jose State University Fall 2015 Instructor: Ron Mak
HTML Forms.
Introduction to HTML Part 3 Chapter 2. Learning Outcomes Identify how to design frames. Explain frames’ attributes. Describe the method on designing forms.
Modeling web applications
Copyright © Osmosys O S M O S Y SO S M O S Y S D e p l o y i n g E x p e r i e n c e & E x p e r t i s e™ HTML Training.
JavaScript and PHP Validation and Error Handling CHAPTER 17.
Retrieving data from MySQL using PHP Basharat Mahmood, Department of Computer Science,CIIT,Islamabad, Pakistan. 1.
IS2802 Introduction to Multimedia Applications for Business Lecture 5: JavaScript, form validation and browser detection Rob Gleasure
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.
Internet & World Wide Web How to Program, 5/e. Copyright © Pearson, Inc All Rights Reserved.2 Revised by Dr. T. Tran for CSI3140.
Web Technologies Lecture 3 Web forms. HTML5 forms A component of a webpage that has form controls – Text fields – Buttons – Checkboxes – Range controls.
INT222 - Internet Fundamentals Shi, Yue (Sunny) Office: T2095 SENECA COLLEGE.
HTML5 Forms Forms are used to capture user input …
HTML FORMS Basharat Mahmood, Department of Computer Science,CIIT,Islamabad,Pakistan. 1.
CSS properties Basharat Mahmood, Department of Computer Science, CIIT, Islamabad, Pakistan 1.
Form Validation. Create a form for the user to enter the data seen blow.
HTML DOM Basharat Mahmood, Department of Computer Science, CIIT, Islamabad, Pakistan 1.
An Introduction to Regular Expressions Specifying a Pattern that a String must meet.
HTML Links and navigation Basharat Mahmood, Department of Computer Science,CIIT,Islamabad, Pakistan. 1.
Tutorial 6 Creating a Web Form
Web Forms. Web Forms: A form allows our web visitors to submit information to us. Some examples uses for forms are to let the web user contact us, fill.
HTML Elements: Forms and Controls Chapter 9 B. Ramamurthy.
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.
>> Form Data Validation in JavaScript
JavaScript, Sixth Edition
Lesson 16 Enhancing Documents
CIIT-Human Computer Interaction-CSC456-Fall-2015-Mr
Lesson 16 Enhancing Documents
Passing variables between pages
Web Programming– UFCFB Lecture 17
IS333: MULTI-TIER APPLICATION DEVELOPMENT
Objectives Explore web forms Work with form servers
New Form Elements and Attributes
Murach's JavaScript and jQuery (3rd Ed.)
Presentation transcript:

HTML 5 Form elements Basharat Mahmood, Department of Computer Science,CIIT,Islamabad, Pakistan. 1

Summary of the previous lecture Creating forms in HTML Adding form elements Basharat Mahmood, Department of Computer Science,CIIT,Islamabad, Pakistan. 2

Outline HTML5 enhancements in form Basharat Mahmood, Department of Computer Science,CIIT,Islamabad, Pakistan. 3

1. HTML-5 form enhancement HTML5 enhances the forms in two ways – Adding new attributes to exiting elements – New elements Basharat Mahmood, Department of Computer Science,CIIT,Islamabad, Pakistan. 4

1.1 The required attribute Required attribute: – tells the browser to only submit the form if the field in question is filled out – ensures that all necessary information is provided by the user – Basharat Mahmood, Department of Computer Science,CIIT,Islamabad, Pakistan. 5

1.1 The required attribute… Basharat Mahmood, Department of Computer Science,CIIT,Islamabad, Pakistan. 6 Input type Required attribute

1.1 The required attribute… Basharat Mahmood, Department of Computer Science,CIIT,Islamabad, Pakistan. 7 Error message

1.2 The placeholder attribute Placeholder attribute: – Allows a short hint to be displayed inside the form element – tell the user what data should be entered in that field – <input type=“text” name=“name” placeholder=“Only upper case letters” > Basharat Mahmood, Department of Computer Science,CIIT,Islamabad, Pakistan. 8

1.2 The placeholder attribute… Basharat Mahmood, Department of Computer Science,CIIT,Islamabad, Pakistan. 9 placeholder

1.2 The placeholder attribute… Basharat Mahmood, Department of Computer Science,CIIT,Islamabad, Pakistan. 10 Hint about data

1.3 The pattern attribute pattern attribute: – enables you to provide a regular expression that the user’s input must match in order to be considered valid – Basharat Mahmood, Department of Computer Science,CIIT,Islamabad, Pakistan. 11

1.3 The pattern attribute Basharat Mahmood, Department of Computer Science,CIIT,Islamabad, Pakistan. 12 Allowed characters Valid length Pattern attribute

1.3 The pattern attribute… Basharat Mahmood, Department of Computer Science,CIIT,Islamabad, Pakistan. 13 Invalid inputError message

1.3 The pattern attribute… Writing Regular Expression: – [ ]: makes a class of characters – -: means a range of characters [a-z],[0-9] – [^ ]: negates the class of character [^0-9] – {n}: matches a character, class or sub-pattern for n times – { n, m}: matches a character, class or sub-pattern for minimum n times and maximum m times Basharat Mahmood, Department of Computer Science,CIIT,Islamabad, Pakistan. 14

1.3 The pattern attribute… Example patterns: – – <input type=“text” pattern=“[a-zA-Z]{1,20} [ ] [a-zA-Z]{1,20}”> Basharat Mahmood, Department of Computer Science,CIIT,Islamabad, Pakistan. 15 Only alphabets Allowed length Only alphabets Allowed length Space is allowed Last name Allowed length

1.3 The pattern attribute… Example patterns: – Basharat Mahmood, Department of Computer Science,CIIT,Islamabad, Pakistan. 16 Only digits Allowed length Only digits Allowed length - symbol

1.4 The disabled attribute disabled attribute: – have the content grayed out in the browser – prohibit the user from focusing on a form control that has the disabled – Basharat Mahmood, Department of Computer Science,CIIT,Islamabad, Pakistan. 17

1.4 The disabled attribute… Basharat Mahmood, Department of Computer Science,CIIT,Islamabad, Pakistan. 18 Input field is disabled

1.4 The disabled attribute… Basharat Mahmood, Department of Computer Science,CIIT,Islamabad, Pakistan. 19 Input field is disabled Disabled field

1.5 The readonly attribute readonly attribute: – it makes it impossible for the user to edit the form field – the field can receive focus – Basharat Mahmood, Department of Computer Science,CIIT,Islamabad, Pakistan. 20

1.6 The autocomplete attribute Basharat Mahmood, Department of Computer Science,CIIT,Islamabad, Pakistan. 21 The autocomplete attribute: – this will be a drop-down list that appears when the user begins typing –

1.6 The autocomplete attribute… Basharat Mahmood, Department of Computer Science,CIIT,Islamabad, Pakistan. 22 autocomplete

1.7 The datalist element Basharat Mahmood, Department of Computer Science,CIIT,Islamabad, Pakistan. 23 The datalist element: – a text field with a set of predefined autocomplete options – First we define an input field with list attribute – Then we define the datalist – Red

1.7 The datalist element… Basharat Mahmood, Department of Computer Science,CIIT,Islamabad, Pakistan. 24 List attribute Datalist starts options Datalist ends

1.7 The datalist element… Basharat Mahmood, Department of Computer Science,CIIT,Islamabad, Pakistan. 25

2. HTML 5 new elements Basharat Mahmood, Department of Computer Science,CIIT,Islamabad, Pakistan. 26 element Date element Number element Color element

2.1 element Basharat Mahmood, Department of Computer Science,CIIT,Islamabad, Pakistan. 27 The element: – It ensures that user enters a valid address –

2.1 element Basharat Mahmood, Department of Computer Science,CIIT,Islamabad, Pakistan. 28 Input type

2.2 Date element Basharat Mahmood, Department of Computer Science,CIIT,Islamabad, Pakistan. 29 The date element: – It shows a calendar to user to select a date –

2.2 Date element… Basharat Mahmood, Department of Computer Science,CIIT,Islamabad, Pakistan. 30

2.3 Color element Basharat Mahmood, Department of Computer Science,CIIT,Islamabad, Pakistan. 31 The color element: – It facilitate the user to choose a color –

2.3 Color element…. Basharat Mahmood, Department of Computer Science,CIIT,Islamabad, Pakistan. 32

2.3 Color element…. Basharat Mahmood, Department of Computer Science,CIIT,Islamabad, Pakistan. 33

2.4 Number element Basharat Mahmood, Department of Computer Science,CIIT,Islamabad, Pakistan. 34 The number element: – It ensures that user enters only a numeric value –

2.4 Number element… Basharat Mahmood, Department of Computer Science,CIIT,Islamabad, Pakistan. 35

2.4 Number element… Basharat Mahmood, Department of Computer Science,CIIT,Islamabad, Pakistan. 36

Summary Basharat Mahmood, Department of Computer Science,CIIT,Islamabad, Pakistan. 37 New attributes to existing form elements New form elements in HTML5

Chapter 4, Beginning HTML, XHTML,CSS, and JavaScript, by Jon Duckett, Wiley Publishing; 2009, ISBN: Basharat Mahmood, Department of Computer Science, CIIT, Islamabad, Pakistan. References