SlideShare a Scribd company logo
Introduction to new HTML5 Form
Input Types, Attributes and Validation
Chris Love
@ChrisLove
ProfessionalASPNET.com
Who Am I?
ASP.NET MVP
ASP Insider
Internet Explorer User Agent
Author
Speaker
Tweaker, Lover of Mobile Web, JavaScript, CSS & HTML5
Podcast Interviews
The Tablet Show
Chris Love Talks Surface Pro, Mobile Development and More
http://thetabletshow.com/?ShowNum=80
Chris Love Does Enterprise Mobility
http://thetabletshow.com/?ShowNum=22
Deep Fried Bytes
Mobile Web Is Not What The Other Guys Say It Is
http://deepfriedbytes.com/podcast/episode-74-mobile-web-is-not-what-the-other-guys-say-it-is/
Technology & Friends
Talking About Touch
http://technologyandfriends.com/ <- Coming out Monday
JavaScript Libraries
DeepTissueJS – A Touch Gesture Abstraction Library
http://deeptissuejs.com
PanoramaJS – JavaScript Library to Implement The Windows Phone Panorama Control in HTML5
https://github.com/docluv/panoramajs
ToolbarJS – JavaScript Library to Implement a Mobile AppBar, like Windows Phone
http://toolbarjs.com
Coming Soon!
SPA – Single Page Application Router, View Manager
Backpack – Markup Manager leveraging LocalStorage
FannyPack – Markup Manager leveraging on page markup
??????
Resources
Slide Deck – http://www.slideshare.net/docluv <- Only URL U
Need!
Source Code – https://github.com/docluv/html5inputs
Live Site - http://html5inputs.azurewebsites.net/
HTML5 Brings New Input Types!
Text
File
Password
Radio
Checkbox
Hidden
Submit
Image
Reset
Button
HTML5 Brings New Input Types!
URL
EMAIL
NUMBER
SEARCH
RANGE
DATETIME
TEL
COLOR
MONTH
WEEK
DATE
TIME
HTML5 Brings New Elements!
DATALIST
PROGRESS
HTML5 Brings New Input Attributes!
AUTOFOCUS
REQUIRED
PLACEHOLDER
PATTERN
AUTOCORRECT
AUTOCOMPLETE
MIN, MAX, STEP
FORMACTION
FORMENCTYPE
FORMMETHOD
FORMVALIDATE
FORMTARGET
READONLY
Sometimes You Just Do Not Want AutoCorrect
Why Is This All Important?
Native Functionality Always A Good Thing
Guided Input Good User Experience
Touch – Help Users Type Less
On Screen Keyboards
New Input Types Drive On Screen Keyboards
How FedEx.com Could Increase Customer
Satisfaction and Profits with 10 Minutes of HTML5
http://bit.ly/16pgnv3
E-Mail Keyboard
URL Keyboard
Number Keyboard
Pattern
Allows You To Define the Data Format Validation
Good For Overriding Native Validation & Behavior
Use Regular Expressions
http://html5pattern.com/
Placeholder
Allows You to Place a Message In The Input
Good For Guidance
Can Help Save Screen Real Estate on Phones ;)
Pattern=“Great Idea…”
Validation Bubbles!
Demo Time!
CSS Hooks
Pseudo Classes That Allow You To Overwrite Default Styles
:valid
:invalid
In WebKit Can Override Message Bubbles!
Demo Time!
Constraint Validation
Validation API
willValidate – Can Node Be Validated
validity – returns a ValidityState object
ValidatityState
valid – Does the Value meet criteria
customError – true if custom message set through setCustomValidity()
valueMissing – no value
typeMismatch – not valid based on input type
patternMismatch – does not match the supplied pattern
rangeOverflow & rangeUnderflow – Over or under the max and min attribute values
stepMismatch – invalid per step attribute
tooLong – exceeds maxLength value
checkValidity
Returns true if form node meets validity criteria
<form id="form-1">
<input id="input-1" type="text" required />
</form>
<script>
document.getElementById('form-1').checkValidity(); //false
document.getElementById('input-1').checkValidity(); //false
</script>
invalid Event
Fired Every Time An Input Field Fails Validation
document.getElementById('input-1').addEventListener('invalid', function() {
//Do Something Here...
}, false);
validationMessage
Contains the Message Displayed When Validity Check Fails
Pass Custom Message to setCustomValidity() method
Demo Time!
Dealing With Older Browsers
UPGRADE!!!!!!!
Dealing With Older Browsers
Use Polyfils
https://github.com/Modernizr/Modernizr/wiki/HTML5-Cross-Browser-Polyfills
jQuery Validation Plugin
http://bassistance.de/jquery-plugins/jquery-plugin-validation/ <- Should Kick In When
Needed

More Related Content

What's hot (20)

PPTX
10 things to make you a Great Mobile Web Developer
Chris Love
 
PDF
Single Page Application Best practices
Tarence DSouza
 
PPTX
J query
Chalermpon Areepong
 
PDF
Websocket in iOS application to create real-time applications
Roman Barzyczak
 
PDF
CSS vs. JavaScript - Trust vs. Control
Christian Heilmann
 
PDF
HTML5@电子商务.com
kaven yan
 
PPT
Best And Worst Practices Building Ria with Adobe and Microsoft
Josh Holmes
 
PPT
Joomla wireframing Template - Joomladay Netherlands 2014 #jd14nl
Philip Locke
 
PDF
Intro to Web Development from Bloc.io
Douglas Wright
 
PDF
Leveling up your JavaScipt - DrupalJam 2017
Christian Heilmann
 
PDF
Progressive Web Apps – the return of the web?
Christian Heilmann
 
PDF
VT2019 - DA355A - Responsiv webbutveckling
Anton Tibblin
 
PPTX
5 Skills Needed to be a Successful WebVR Developer
Yoni Binstock
 
PPT
Creating Yahoo Mobile Widgets
Ricardo Varela
 
PPTX
Sucuri Webinar: Beginner's Guide to CDNs
Sucuri
 
PPTX
CC 2015 Single Page Applications for the ASPNET Developer
Allen Conway
 
PPT
Progressive Enhancement
Bruce Morrison
 
PPTX
Building a resposive slider plugin for WordPress theme
codebangla
 
PDF
[jqconatx] Adaptive Images for Responsive Web Design
Christopher Schmitt
 
10 things to make you a Great Mobile Web Developer
Chris Love
 
Single Page Application Best practices
Tarence DSouza
 
Websocket in iOS application to create real-time applications
Roman Barzyczak
 
CSS vs. JavaScript - Trust vs. Control
Christian Heilmann
 
HTML5@电子商务.com
kaven yan
 
Best And Worst Practices Building Ria with Adobe and Microsoft
Josh Holmes
 
Joomla wireframing Template - Joomladay Netherlands 2014 #jd14nl
Philip Locke
 
Intro to Web Development from Bloc.io
Douglas Wright
 
Leveling up your JavaScipt - DrupalJam 2017
Christian Heilmann
 
Progressive Web Apps – the return of the web?
Christian Heilmann
 
VT2019 - DA355A - Responsiv webbutveckling
Anton Tibblin
 
5 Skills Needed to be a Successful WebVR Developer
Yoni Binstock
 
Creating Yahoo Mobile Widgets
Ricardo Varela
 
Sucuri Webinar: Beginner's Guide to CDNs
Sucuri
 
CC 2015 Single Page Applications for the ASPNET Developer
Allen Conway
 
Progressive Enhancement
Bruce Morrison
 
Building a resposive slider plugin for WordPress theme
codebangla
 
[jqconatx] Adaptive Images for Responsive Web Design
Christopher Schmitt
 

Similar to Html5 inputs (20)

PPT
php
bhuvana553
 
PDF
Bd conf sencha touch workshop
James Pearce
 
PPTX
Rapid development & integration of real time communication in websites
Chetan Giridhar
 
PPSX
Familiar Tools, New Possibilities: Leveraging the Power of the Adobe Web Pub...
John Hartley
 
PPTX
Doing Modern Web, aka JavaScript and HTML5 in the Enterprise NYC Code Camp
Chris Love
 
PPTX
Serverless by Examples and Case Studies
Srushith Repakula
 
PPTX
Serverless by examples and case studies
CodeOps Technologies LLP
 
PPT
Web Attacks - Top threats - 2010
Shreeraj Shah
 
PDF
Core Web Standards and Competencies - WritersUA East 2015, Scott DeLoach, Cli...
Scott DeLoach
 
PPTX
W3 conf hill-html5-security-realities
Brad Hill
 
PPT
HTML5 WebSocket: The New Network Stack for the Web
Peter Lubbers
 
PPT
Top Ten Tips For Tenacious Defense In Asp.Net
alsmola
 
PPT
Automated Testing Of Web Applications Using XML
diongillard
 
PPT
presentation slides
webhostingguy
 
PPTX
Building appsinsilverlight4 part_1
Dennis Perlot
 
ODP
What's Our Software Doing With All That User Input
Kim Carter
 
PPTX
DODN2009 - Jump Start Silverlight
Clint Edmonson
 
PPT
Top Ten Web Hacking Techniques – 2008
Jeremiah Grossman
 
PPT
Web Services Security
amiable_indian
 
PPT
Blog Enhancing through Extensions
Jure Cuhalev
 
Bd conf sencha touch workshop
James Pearce
 
Rapid development & integration of real time communication in websites
Chetan Giridhar
 
Familiar Tools, New Possibilities: Leveraging the Power of the Adobe Web Pub...
John Hartley
 
Doing Modern Web, aka JavaScript and HTML5 in the Enterprise NYC Code Camp
Chris Love
 
Serverless by Examples and Case Studies
Srushith Repakula
 
Serverless by examples and case studies
CodeOps Technologies LLP
 
Web Attacks - Top threats - 2010
Shreeraj Shah
 
Core Web Standards and Competencies - WritersUA East 2015, Scott DeLoach, Cli...
Scott DeLoach
 
W3 conf hill-html5-security-realities
Brad Hill
 
HTML5 WebSocket: The New Network Stack for the Web
Peter Lubbers
 
Top Ten Tips For Tenacious Defense In Asp.Net
alsmola
 
Automated Testing Of Web Applications Using XML
diongillard
 
presentation slides
webhostingguy
 
Building appsinsilverlight4 part_1
Dennis Perlot
 
What's Our Software Doing With All That User Input
Kim Carter
 
DODN2009 - Jump Start Silverlight
Clint Edmonson
 
Top Ten Web Hacking Techniques – 2008
Jeremiah Grossman
 
Web Services Security
amiable_indian
 
Blog Enhancing through Extensions
Jure Cuhalev
 
Ad

More from Chris Love (20)

PPTX
Quick Fetch API Introduction
Chris Love
 
PPTX
Introduction to Progressive Web Applications
Chris Love
 
PPTX
Introduction to Progressive Web Applications
Chris Love
 
PPTX
Lazy load Website Assets
Chris Love
 
PPTX
Progressive Web Apps for Education
Chris Love
 
PPTX
The server is dead going serverless to create a highly scalable application y...
Chris Love
 
PPTX
A Day Building Fast, Responsive, Extensible Single Page Applications
Chris Love
 
PPTX
Real World Lessons in Progressive Web Application & Service Worker Caching
Chris Love
 
PPTX
Disrupting the application eco system with progressive web applications
Chris Love
 
PPTX
Service workers your applications never felt so good
Chris Love
 
PPTX
Develop a vanilla.js spa you and your customers will love
Chris Love
 
PPTX
JavaScript front end performance optimizations
Chris Love
 
PPTX
Advanced front end debugging with ms edge and ms tools
Chris Love
 
PPTX
Html5 Fit: Get Rid of Love Handles
Chris Love
 
PPTX
Using Responsive Web Design To Make Your Web Work Everywhere - Updated
Chris Love
 
PPTX
Implementing a Responsive Image Strategy
Chris Love
 
PPTX
Using Responsive Web Design To Make Your Web Work Everywhere
Chris Love
 
PPTX
10 things you can do to speed up your web app today 2016
Chris Love
 
PPT
Css best practices style guide and tips
Chris Love
 
PPTX
Using Responsive Web Design To Make Your Web Work Everywhere
Chris Love
 
Quick Fetch API Introduction
Chris Love
 
Introduction to Progressive Web Applications
Chris Love
 
Introduction to Progressive Web Applications
Chris Love
 
Lazy load Website Assets
Chris Love
 
Progressive Web Apps for Education
Chris Love
 
The server is dead going serverless to create a highly scalable application y...
Chris Love
 
A Day Building Fast, Responsive, Extensible Single Page Applications
Chris Love
 
Real World Lessons in Progressive Web Application & Service Worker Caching
Chris Love
 
Disrupting the application eco system with progressive web applications
Chris Love
 
Service workers your applications never felt so good
Chris Love
 
Develop a vanilla.js spa you and your customers will love
Chris Love
 
JavaScript front end performance optimizations
Chris Love
 
Advanced front end debugging with ms edge and ms tools
Chris Love
 
Html5 Fit: Get Rid of Love Handles
Chris Love
 
Using Responsive Web Design To Make Your Web Work Everywhere - Updated
Chris Love
 
Implementing a Responsive Image Strategy
Chris Love
 
Using Responsive Web Design To Make Your Web Work Everywhere
Chris Love
 
10 things you can do to speed up your web app today 2016
Chris Love
 
Css best practices style guide and tips
Chris Love
 
Using Responsive Web Design To Make Your Web Work Everywhere
Chris Love
 
Ad

Recently uploaded (20)

PDF
The Future of Product Management in AI ERA.pdf
Alyona Owens
 
PDF
Salesforce Summer '25 Release Frenchgathering.pptx.pdf
yosra Saidani
 
PDF
LLM Search Readiness Audit - Dentsu x SEO Square - June 2025.pdf
Nick Samuel
 
PDF
From Chatbot to Destroyer of Endpoints - Can ChatGPT Automate EDR Bypasses (1...
Priyanka Aash
 
PDF
Python Conference Singapore - 19 Jun 2025
ninefyi
 
PDF
FME as an Orchestration Tool with Principles From Data Gravity
Safe Software
 
PDF
My Journey from CAD to BIM: A True Underdog Story
Safe Software
 
PDF
2025_06_18 - OpenMetadata Community Meeting.pdf
OpenMetadata
 
PDF
EIS-Webinar-Engineering-Retail-Infrastructure-06-16-2025.pdf
Earley Information Science
 
PDF
Redefining Work in the Age of AI - What to expect? How to prepare? Why it mat...
Malinda Kapuruge
 
PPTX
Curietech AI in action - Accelerate MuleSoft development
shyamraj55
 
PDF
5 Things to Consider When Deploying AI in Your Enterprise
Safe Software
 
PPTX
Paycifi - Programmable Trust_Breakfast_PPTXT
FinTech Belgium
 
PDF
Open Source Milvus Vector Database v 2.6
Zilliz
 
DOCX
Daily Lesson Log MATATAG ICT TEchnology 8
LOIDAALMAZAN3
 
PDF
Kubernetes - Architecture & Components.pdf
geethak285
 
PPTX
MARTSIA: A Tool for Confidential Data Exchange via Public Blockchain - Poster...
Michele Kryston
 
PDF
Database Benchmarking for Performance Masterclass: Session 1 - Benchmarking F...
ScyllaDB
 
PDF
Plugging AI into everything: Model Context Protocol Simplified.pdf
Abati Adewale
 
PDF
Cracking the Code - Unveiling Synergies Between Open Source Security and AI.pdf
Priyanka Aash
 
The Future of Product Management in AI ERA.pdf
Alyona Owens
 
Salesforce Summer '25 Release Frenchgathering.pptx.pdf
yosra Saidani
 
LLM Search Readiness Audit - Dentsu x SEO Square - June 2025.pdf
Nick Samuel
 
From Chatbot to Destroyer of Endpoints - Can ChatGPT Automate EDR Bypasses (1...
Priyanka Aash
 
Python Conference Singapore - 19 Jun 2025
ninefyi
 
FME as an Orchestration Tool with Principles From Data Gravity
Safe Software
 
My Journey from CAD to BIM: A True Underdog Story
Safe Software
 
2025_06_18 - OpenMetadata Community Meeting.pdf
OpenMetadata
 
EIS-Webinar-Engineering-Retail-Infrastructure-06-16-2025.pdf
Earley Information Science
 
Redefining Work in the Age of AI - What to expect? How to prepare? Why it mat...
Malinda Kapuruge
 
Curietech AI in action - Accelerate MuleSoft development
shyamraj55
 
5 Things to Consider When Deploying AI in Your Enterprise
Safe Software
 
Paycifi - Programmable Trust_Breakfast_PPTXT
FinTech Belgium
 
Open Source Milvus Vector Database v 2.6
Zilliz
 
Daily Lesson Log MATATAG ICT TEchnology 8
LOIDAALMAZAN3
 
Kubernetes - Architecture & Components.pdf
geethak285
 
MARTSIA: A Tool for Confidential Data Exchange via Public Blockchain - Poster...
Michele Kryston
 
Database Benchmarking for Performance Masterclass: Session 1 - Benchmarking F...
ScyllaDB
 
Plugging AI into everything: Model Context Protocol Simplified.pdf
Abati Adewale
 
Cracking the Code - Unveiling Synergies Between Open Source Security and AI.pdf
Priyanka Aash
 

Html5 inputs

  • 1. Introduction to new HTML5 Form Input Types, Attributes and Validation Chris Love @ChrisLove ProfessionalASPNET.com
  • 2. Who Am I? ASP.NET MVP ASP Insider Internet Explorer User Agent Author Speaker Tweaker, Lover of Mobile Web, JavaScript, CSS & HTML5
  • 3. Podcast Interviews The Tablet Show Chris Love Talks Surface Pro, Mobile Development and More http://thetabletshow.com/?ShowNum=80 Chris Love Does Enterprise Mobility http://thetabletshow.com/?ShowNum=22 Deep Fried Bytes Mobile Web Is Not What The Other Guys Say It Is http://deepfriedbytes.com/podcast/episode-74-mobile-web-is-not-what-the-other-guys-say-it-is/ Technology & Friends Talking About Touch http://technologyandfriends.com/ <- Coming out Monday
  • 4. JavaScript Libraries DeepTissueJS – A Touch Gesture Abstraction Library http://deeptissuejs.com PanoramaJS – JavaScript Library to Implement The Windows Phone Panorama Control in HTML5 https://github.com/docluv/panoramajs ToolbarJS – JavaScript Library to Implement a Mobile AppBar, like Windows Phone http://toolbarjs.com Coming Soon! SPA – Single Page Application Router, View Manager Backpack – Markup Manager leveraging LocalStorage FannyPack – Markup Manager leveraging on page markup ??????
  • 5. Resources Slide Deck – http://www.slideshare.net/docluv <- Only URL U Need! Source Code – https://github.com/docluv/html5inputs Live Site - http://html5inputs.azurewebsites.net/
  • 6. HTML5 Brings New Input Types! Text File Password Radio Checkbox Hidden Submit Image Reset Button
  • 7. HTML5 Brings New Input Types! URL EMAIL NUMBER SEARCH RANGE DATETIME TEL COLOR MONTH WEEK DATE TIME
  • 8. HTML5 Brings New Elements! DATALIST PROGRESS
  • 9. HTML5 Brings New Input Attributes! AUTOFOCUS REQUIRED PLACEHOLDER PATTERN AUTOCORRECT AUTOCOMPLETE MIN, MAX, STEP FORMACTION FORMENCTYPE FORMMETHOD FORMVALIDATE FORMTARGET READONLY
  • 10. Sometimes You Just Do Not Want AutoCorrect
  • 11. Why Is This All Important? Native Functionality Always A Good Thing Guided Input Good User Experience Touch – Help Users Type Less
  • 12. On Screen Keyboards New Input Types Drive On Screen Keyboards
  • 13. How FedEx.com Could Increase Customer Satisfaction and Profits with 10 Minutes of HTML5 http://bit.ly/16pgnv3
  • 17. Pattern Allows You To Define the Data Format Validation Good For Overriding Native Validation & Behavior Use Regular Expressions http://html5pattern.com/
  • 18. Placeholder Allows You to Place a Message In The Input Good For Guidance Can Help Save Screen Real Estate on Phones ;) Pattern=“Great Idea…”
  • 21. CSS Hooks Pseudo Classes That Allow You To Overwrite Default Styles :valid :invalid In WebKit Can Override Message Bubbles!
  • 23. Constraint Validation Validation API willValidate – Can Node Be Validated validity – returns a ValidityState object
  • 24. ValidatityState valid – Does the Value meet criteria customError – true if custom message set through setCustomValidity() valueMissing – no value typeMismatch – not valid based on input type patternMismatch – does not match the supplied pattern rangeOverflow & rangeUnderflow – Over or under the max and min attribute values stepMismatch – invalid per step attribute tooLong – exceeds maxLength value
  • 25. checkValidity Returns true if form node meets validity criteria <form id="form-1"> <input id="input-1" type="text" required /> </form> <script> document.getElementById('form-1').checkValidity(); //false document.getElementById('input-1').checkValidity(); //false </script>
  • 26. invalid Event Fired Every Time An Input Field Fails Validation document.getElementById('input-1').addEventListener('invalid', function() { //Do Something Here... }, false);
  • 27. validationMessage Contains the Message Displayed When Validity Check Fails Pass Custom Message to setCustomValidity() method
  • 29. Dealing With Older Browsers UPGRADE!!!!!!!
  • 30. Dealing With Older Browsers Use Polyfils https://github.com/Modernizr/Modernizr/wiki/HTML5-Cross-Browser-Polyfills jQuery Validation Plugin http://bassistance.de/jquery-plugins/jquery-plugin-validation/ <- Should Kick In When Needed