SlideShare a Scribd company logo
HTML5 Forms - KISS time
Forms
Thou shalt make things simple
HTML5 workshop, forms
HTML5 workshop, forms
HTML5 workshop, forms
Types
New form types


<input type="color">             <input type="range">

<input type="date">              <input type="search"
                                    results="5"
<input type="datetime">             autosave="saved-searches">

<input type="datetime-local">    <input type="tel">

<input type="email">             <input type="time">

<input type="month">             <input type="url">

<input type="number">            <input type="week">
HTML5 workshop, forms
HTML5 workshop, forms
Attributes
New form attributes

<input type="text" autocomplete="off">

<input type="text" autofocus>

<input type="submit" formaction="http://example.org/save" value="Save">

<input type="submit" formenctype="application/x-www-form-urlencoded"
       value="Save with enctype">

<input type="submit" formmethod="POST" value="Send as POST">

<input type="submit" formnovalidate value="Don't validate">

<input type="submit" formtarget="_blank" value="Post to new tab/window">
<input type="text" list="data-list">

<input type="range" max="95">

<input type="range" min="2">

<input type="file" multiple>

<input type="text" readonly>

<input type="text" required>

<input type="text" pattern="[A-Z]*">

<input type="text" placeholder="E.g. Robocop">

<input type="text" spellcheck="true">

<input type="number" step="5">
<input type="text" mozactionhint="Next">
Elements
New form elements



<input type="text" list="data-list">

<datalist id="data-list">
    <option value="Hugo Reyes">
    <option value="Jack Shephard">
    <option value="James 'Sawyer' Ford">
    <option value="John Locke">
    <option value="Sayid Jarrah">
</datalist>
<keygen></keygen>

<meter min="0" max="10" value="7"></meter>

<input type="range" id="range">
<output for="range" id="output"></output>

<progress max="100" value="70">70%</progress>
<input type="range" id="da-range">
<output id="da-range-output"></output>
<script>
    (function () {
         var range = document.getElementById("da-range"),
             output = document.getElementById("da-range-output");
          range.addEventListener("input", function () {
              output.value = this.value;
          }, false);
    })();
</script>
Validation
<input type="text" required>
HTML5 workshop, forms
Only spaces are regarded as input :-(
<input type="text" required
style="visibility: hidden">
No dialog, won't submit form


Dialog at element


No dialog, won't submit form


Dialog at top left of screen (not
browser)
<input type="email" required>
HTML5 workshop, forms
No support for international
characters, i.e.
röja@kissonline.com won't work
<input type="text" pattern="d{2}-d{5}">
HTML5 workshop, forms
Empty fields are seen as valid
<input type="text" title="So you tried
to skip me?" required>
HTML5 workshop, forms
<input type="text" pattern="d{2}-d{5}"
x-moz-errormessage="PLEASE, just do it
right!">
HTML5 workshop, forms
elm.setCustomValidity("No, that's wrong!");
HTML5 workshop, forms
Remove custom validation message
by setting it to an empty string...
elm.setCustomValidity("");
Using setCustomValidity totally
kills the checkValidity method
HTML5 workshop, forms
HTML5 workshop, forms
(function () {
    var oninvalidTest = document.getElementById("oninvalid-test");
    oninvalidTest.addEventListener("input", function () {
        this.setCustomValidity("");
    }, false);

    oninvalidTest.addEventListener("invalid", function () {
        this.setCustomValidity("No, that's wrong!");
    }, false);
})();
Styling
input:required {
    border: 1px solid #00f;
}
HTML5 workshop, forms
input:valid {
    border: 1px solid #0f0;
}

input:invalid {
    border: 1px solid #f00;
}

input:out-of-range {
    border: 1px solid #f00;
}
HTML5 workshop, forms
HTML5 workshop, forms
input:focus:invalid {
    border: 1px solid #f00;
}
input:-moz-ui-valid {
    border: 1px solid #0f0;
}

input:-moz-ui-invalid {
    border: 1px solid #f00;
}
input:-moz-placeholder {
    color: #f00;
    background: yellow;
}

input::-webkit-input-placeholder {
    color: #f00;
    background: yellow;
}
HTML5 workshop, forms
Works in Safari, but only with the
text color, not the background
input::-webkit-validation-bubble-message {
    color: #f00;
    background: #000;
    border: 10px solid #f00;
    -webkit-box-shadow: 0 0 0 0;
}

input::-webkit-validation-bubble-arrow {
    background: #ff3456;
    border-color: orange;
    -webkit-box-shadow: 0 0 0 0;
}
HTML5 workshop, forms
HTML5 workshop, forms
HTML5 workshop, forms
http://www.quirksmode.org/
                          html5/inputs.html

                          http://www.quirksmode.org/
                          html5/inputs_mobile.html




http://wufoo.com/html5/
HTML5 workshop, forms
HTML5 workshop, forms
HTML5 workshop, forms
Robert Nyman
robertnyman.com/speaking/ robnyman@mozilla.com
robertnyman.com/html5/    Twitter: @robertnyman
robertnyman.com/css3/

More Related Content

PDF
Introduction to Open Source GIS
SANGHEE SHIN
 
PDF
Angular
Lilia Sfaxi
 
PDF
2.28.17 Introducing DSpace 7 Webinar Slides
DuraSpace
 
PDF
You code sucks, let's fix it
Rafael Dohms
 
PPTX
Authenticating Angular Apps with JWT
Jennifer Estrada
 
PPT
OAuth 2.0 and OpenId Connect
Saran Doraiswamy
 
PDF
Deep dive into Vue.js
선협 이
 
PDF
Introduction to Docker and all things containers, Docker Meetup at RelateIQ
dotCloud
 
Introduction to Open Source GIS
SANGHEE SHIN
 
Angular
Lilia Sfaxi
 
2.28.17 Introducing DSpace 7 Webinar Slides
DuraSpace
 
You code sucks, let's fix it
Rafael Dohms
 
Authenticating Angular Apps with JWT
Jennifer Estrada
 
OAuth 2.0 and OpenId Connect
Saran Doraiswamy
 
Deep dive into Vue.js
선협 이
 
Introduction to Docker and all things containers, Docker Meetup at RelateIQ
dotCloud
 

What's hot (20)

PDF
React js
Rajesh Kolla
 
PDF
Vector Tiles with GeoServer and OpenLayers
Jody Garnett
 
PPTX
[IGC 2016] 엔씨소프트 김종원 - 모바일 테스트 자동화 시스템
강 민우
 
PDF
퍼블리싱 협의 체크리스트
규연 황
 
PPTX
Vue js for beginner
Chandrasekar G
 
PDF
DockerでCKANを動かそう
Takayuki Goto
 
PPTX
LDAP - Lightweight Directory Access Protocol
S. Hasnain Raza
 
PDF
What Is React | ReactJS Tutorial for Beginners | ReactJS Training | Edureka
Edureka!
 
PDF
Nuxt.js - Introduction
Sébastien Chopin
 
PDF
PostGIS 2.0 한국어 사용자 설명서
SANGHEE SHIN
 
PPTX
Rest api with node js and express
GirlsInTechnology Nepal
 
PDF
스타트업 나홀로 데이터 엔지니어: 데이터 분석 환경 구축기 - 천지은 (Tappytoon) :: AWS Community Day Onlin...
AWSKRUG - AWS한국사용자모임
 
PPTX
ASP.MVC Training
Mahesh Sikakolli
 
PDF
How browser work
Manish Trivedi
 
PPTX
.Net Core
Bertrand Le Roy
 
PDF
Oracle Application Express (APEX) and Microsoft Sharepoint integration
Dimitri Gielis
 
PPT
JAVA SCRIPT
Go4Guru
 
PDF
DDD로 복잡함 다루기
beom kyun choi
 
PPTX
Introduction to Node.js
Vikash Singh
 
PPTX
Open Source GIS 기초교육 4일차 - GeoServer 기초 2014년 7월판
BJ Jang
 
React js
Rajesh Kolla
 
Vector Tiles with GeoServer and OpenLayers
Jody Garnett
 
[IGC 2016] 엔씨소프트 김종원 - 모바일 테스트 자동화 시스템
강 민우
 
퍼블리싱 협의 체크리스트
규연 황
 
Vue js for beginner
Chandrasekar G
 
DockerでCKANを動かそう
Takayuki Goto
 
LDAP - Lightweight Directory Access Protocol
S. Hasnain Raza
 
What Is React | ReactJS Tutorial for Beginners | ReactJS Training | Edureka
Edureka!
 
Nuxt.js - Introduction
Sébastien Chopin
 
PostGIS 2.0 한국어 사용자 설명서
SANGHEE SHIN
 
Rest api with node js and express
GirlsInTechnology Nepal
 
스타트업 나홀로 데이터 엔지니어: 데이터 분석 환경 구축기 - 천지은 (Tappytoon) :: AWS Community Day Onlin...
AWSKRUG - AWS한국사용자모임
 
ASP.MVC Training
Mahesh Sikakolli
 
How browser work
Manish Trivedi
 
.Net Core
Bertrand Le Roy
 
Oracle Application Express (APEX) and Microsoft Sharepoint integration
Dimitri Gielis
 
JAVA SCRIPT
Go4Guru
 
DDD로 복잡함 다루기
beom kyun choi
 
Introduction to Node.js
Vikash Singh
 
Open Source GIS 기초교육 4일차 - GeoServer 기초 2014년 7월판
BJ Jang
 
Ad

Similar to HTML5 workshop, forms (20)

PDF
HTML5 Forms - KISS time - Fronteers
Robert Nyman
 
PPTX
HTML5 Forms OF DOOM
Stephanie Hobson
 
PPT
HTML5 Mullet: Forms & Input Validation
Todd Anglin
 
DOCX
Html5 forms input types
sinhacp
 
PPTX
Html5 inputs
Chris Love
 
PPTX
html 5 new form attribute
Priyanka Rasal
 
PDF
Forms
Aaron Maturen
 
KEY
HTML5 Form Validation
Ian Oxley
 
PDF
Html5 Forms in Squiz Matrix - Dave Letorey
Squiz
 
PDF
Web Forms People Don't Hate
cliener
 
KEY
Building & Breaking Web Forms with Quaid-JS
cliener
 
PPTX
Forms with html5
Suvarna Pappu
 
PPTX
Forms with html5 (1)
Anada Kale
 
PPTX
New Form Element in HTML5
Zahra Rezwana
 
PPTX
Accessible dynamic forms
Dylan Barrell
 
PPTX
form_validation_with_html5
Ryan Williams
 
PPT
ch3.ppt
EnghamzaKhalailah
 
PDF
Moving to the client - HTML5 is here
Christian Heilmann
 
PDF
JavaScript - Chapter 14 - Form Handling
WebStackAcademy
 
PPTX
Data validation in web applications
srkirkland
 
HTML5 Forms - KISS time - Fronteers
Robert Nyman
 
HTML5 Forms OF DOOM
Stephanie Hobson
 
HTML5 Mullet: Forms & Input Validation
Todd Anglin
 
Html5 forms input types
sinhacp
 
Html5 inputs
Chris Love
 
html 5 new form attribute
Priyanka Rasal
 
HTML5 Form Validation
Ian Oxley
 
Html5 Forms in Squiz Matrix - Dave Letorey
Squiz
 
Web Forms People Don't Hate
cliener
 
Building & Breaking Web Forms with Quaid-JS
cliener
 
Forms with html5
Suvarna Pappu
 
Forms with html5 (1)
Anada Kale
 
New Form Element in HTML5
Zahra Rezwana
 
Accessible dynamic forms
Dylan Barrell
 
form_validation_with_html5
Ryan Williams
 
Moving to the client - HTML5 is here
Christian Heilmann
 
JavaScript - Chapter 14 - Form Handling
WebStackAcademy
 
Data validation in web applications
srkirkland
 
Ad

More from Robert Nyman (20)

PDF
Have you tried listening?
Robert Nyman
 
PDF
Building for Your Next Billion - Google I/O 2017
Robert Nyman
 
PDF
Introduction to Google Daydream
Robert Nyman
 
PDF
Predictability for the Web
Robert Nyman
 
PDF
The Future of Progressive Web Apps - View Source conference, Berlin 2016
Robert Nyman
 
PDF
The Future of the Web - Cold Front conference 2016
Robert Nyman
 
PDF
The Future of Progressive Web Apps - Google for Indonesia
Robert Nyman
 
PDF
Google tech & products
Robert Nyman
 
PDF
Introduction to Progressive Web Apps, Google Developer Summit, Seoul - South ...
Robert Nyman
 
PDF
Progressive Web Apps keynote, Google Developer Summit, Tokyo, Japan
Robert Nyman
 
PDF
The web - What it has, what it lacks and where it must go - keynote at Riga D...
Robert Nyman
 
PDF
The web - What it has, what it lacks and where it must go - Bulgaria Web Summ...
Robert Nyman
 
PDF
The web - What it has, what it lacks and where it must go - Istanbul
Robert Nyman
 
PDF
The web - What it has, what it lacks and where it must go
Robert Nyman
 
PDF
Google, the future and possibilities
Robert Nyman
 
PDF
Developer Relations in the Nordics
Robert Nyman
 
PDF
What is Developer Relations?
Robert Nyman
 
PDF
Android TV Introduction - Stockholm Android TV meetup
Robert Nyman
 
PDF
New improvements for web developers - frontend.fi, Helsinki
Robert Nyman
 
PDF
Mobile phone trends, user data & developer climate - frontend.fi, Helsinki
Robert Nyman
 
Have you tried listening?
Robert Nyman
 
Building for Your Next Billion - Google I/O 2017
Robert Nyman
 
Introduction to Google Daydream
Robert Nyman
 
Predictability for the Web
Robert Nyman
 
The Future of Progressive Web Apps - View Source conference, Berlin 2016
Robert Nyman
 
The Future of the Web - Cold Front conference 2016
Robert Nyman
 
The Future of Progressive Web Apps - Google for Indonesia
Robert Nyman
 
Google tech & products
Robert Nyman
 
Introduction to Progressive Web Apps, Google Developer Summit, Seoul - South ...
Robert Nyman
 
Progressive Web Apps keynote, Google Developer Summit, Tokyo, Japan
Robert Nyman
 
The web - What it has, what it lacks and where it must go - keynote at Riga D...
Robert Nyman
 
The web - What it has, what it lacks and where it must go - Bulgaria Web Summ...
Robert Nyman
 
The web - What it has, what it lacks and where it must go - Istanbul
Robert Nyman
 
The web - What it has, what it lacks and where it must go
Robert Nyman
 
Google, the future and possibilities
Robert Nyman
 
Developer Relations in the Nordics
Robert Nyman
 
What is Developer Relations?
Robert Nyman
 
Android TV Introduction - Stockholm Android TV meetup
Robert Nyman
 
New improvements for web developers - frontend.fi, Helsinki
Robert Nyman
 
Mobile phone trends, user data & developer climate - frontend.fi, Helsinki
Robert Nyman
 

Recently uploaded (20)

PPTX
Coupa-Overview _Assumptions presentation
annapureddyn
 
PDF
CIFDAQ'S Market Insight: BTC to ETH money in motion
CIFDAQ
 
PDF
Best ERP System for Manufacturing in India | Elite Mindz
Elite Mindz
 
PDF
Cloud-Migration-Best-Practices-A-Practical-Guide-to-AWS-Azure-and-Google-Clou...
Artjoker Software Development Company
 
PPTX
Smart Infrastructure and Automation through IoT Sensors
Rejig Digital
 
PPTX
What-is-the-World-Wide-Web -- Introduction
tonifi9488
 
PDF
Orbitly Pitch Deck|A Mission-Driven Platform for Side Project Collaboration (...
zz41354899
 
PDF
Chapter 2 Digital Image Fundamentals.pdf
Getnet Tigabie Askale -(GM)
 
PPTX
Comunidade Salesforce São Paulo - Desmistificando o Omnistudio (Vlocity)
Francisco Vieira Júnior
 
PDF
Software Development Company | KodekX
KodekX
 
PDF
AI Unleashed - Shaping the Future -Starting Today - AIOUG Yatra 2025 - For Co...
Sandesh Rao
 
PPT
L2 Rules of Netiquette in Empowerment technology
Archibal2
 
PDF
Oracle AI Vector Search- Getting Started and what's new in 2025- AIOUG Yatra ...
Sandesh Rao
 
PPTX
cloud computing vai.pptx for the project
vaibhavdobariyal79
 
PPTX
ChatGPT's Deck on The Enduring Legacy of Fax Machines
Greg Swan
 
PDF
Event Presentation Google Cloud Next Extended 2025
minhtrietgect
 
PDF
Google I/O Extended 2025 Baku - all ppts
HusseinMalikMammadli
 
PDF
Why Your AI & Cybersecurity Hiring Still Misses the Mark in 2025
Virtual Employee Pvt. Ltd.
 
PDF
Accelerating Oracle Database 23ai Troubleshooting with Oracle AHF Fleet Insig...
Sandesh Rao
 
PDF
A Day in the Life of Location Data - Turning Where into How.pdf
Precisely
 
Coupa-Overview _Assumptions presentation
annapureddyn
 
CIFDAQ'S Market Insight: BTC to ETH money in motion
CIFDAQ
 
Best ERP System for Manufacturing in India | Elite Mindz
Elite Mindz
 
Cloud-Migration-Best-Practices-A-Practical-Guide-to-AWS-Azure-and-Google-Clou...
Artjoker Software Development Company
 
Smart Infrastructure and Automation through IoT Sensors
Rejig Digital
 
What-is-the-World-Wide-Web -- Introduction
tonifi9488
 
Orbitly Pitch Deck|A Mission-Driven Platform for Side Project Collaboration (...
zz41354899
 
Chapter 2 Digital Image Fundamentals.pdf
Getnet Tigabie Askale -(GM)
 
Comunidade Salesforce São Paulo - Desmistificando o Omnistudio (Vlocity)
Francisco Vieira Júnior
 
Software Development Company | KodekX
KodekX
 
AI Unleashed - Shaping the Future -Starting Today - AIOUG Yatra 2025 - For Co...
Sandesh Rao
 
L2 Rules of Netiquette in Empowerment technology
Archibal2
 
Oracle AI Vector Search- Getting Started and what's new in 2025- AIOUG Yatra ...
Sandesh Rao
 
cloud computing vai.pptx for the project
vaibhavdobariyal79
 
ChatGPT's Deck on The Enduring Legacy of Fax Machines
Greg Swan
 
Event Presentation Google Cloud Next Extended 2025
minhtrietgect
 
Google I/O Extended 2025 Baku - all ppts
HusseinMalikMammadli
 
Why Your AI & Cybersecurity Hiring Still Misses the Mark in 2025
Virtual Employee Pvt. Ltd.
 
Accelerating Oracle Database 23ai Troubleshooting with Oracle AHF Fleet Insig...
Sandesh Rao
 
A Day in the Life of Location Data - Turning Where into How.pdf
Precisely
 

HTML5 workshop, forms