SlideShare uma empresa Scribd logo
1 de 29
Come to the dark side. We have cookies.

FORMS OF DOOM
Attributes
Input Types
JavaScript API
Styling

BEHOLD THE POWERS OF HTML5
Placeholder
Required
Autofocus
Autocomplete
Spellcheck
Pattern

ATTRIBUTES TO RULE THEM ALL
• Disappears as the user types.
• NOT a replacement for a proper label. I will hunt you down.
• Validated by supporting browsers.
• Gives the first field in the source order with autofocus focus on page
load.
• Will scroll the page to give it focus.
• Not supported by mobile browsers.
• Suggests to browsers that they not auto fill that form field.
• Suggested for use on form fields the browser will probably auto fill
    wrong. For example: Name when you want a pet’s name.
• Also accepts “true”.
• Tells the browser explicitly whether or not to spell check the field.
• Good for fields where the input is expected to be interpreted as a
     misspelling.
• Matches a regular expression.
• Only validates if something has been entered.
• Error message is non-specific. Some browsers will use title attribute to
     explain.
• Use the title attribute to add additional help text. Please.
    • This works with all the input types.
CODING IMPRESSIVE.
Download the sample form: stephaniehobson.ca/html5forms

Add:
• Placeholder
• Required
• Autofocus
•Autocomplete (to the nemesis name field – wouldn’t want to submit your
     own name as your nemesis, that’d be awkward)
•Spellcheck (to the nemesis name field)
• Pattern
Email
URL
Tel
Search
Number
Range
Date
Datalist

INPUT TYPES AND YOUR LITTLE
DOG TOO
• For email addresses.
• Gives email keyboard.
• Is validated as an email address.
•Special attribute:
    • multiple (enables acceptance of a comma separated list of addresses)
• For urls.
• Gives url keyboard.
• Is validated as a url – very loosely.
    • URL validation is actually really complicated.
    • Use in combination with pattern if you want something specific.
• For phone numbers.
• Gives number pad.
• Very loosely validated.
    • Handy since the nice big number pad is handy for inputting any number so
         you can use it for anything else you like. thisisourstop.com uses it for
         bus stop number.
    • Use with pattern if you have
         something specific in mind.
• No standard functionality.
•Remembered search terms on some.
• Rounded corners on some.
    • Over ride with -webkit-appearance:none;
• Little grey clear field “x” on some.
• For numbers. Also called a “spinbox”.
• Gives number keypad.
• Validated as a number (one day).
•Special attributes:
    • min
    • max
    • step
• Special pseudo classes:
    • :in-range { }
    • :out-of-range { }
• For numbers. Also called a “slider”.
• Exact number not displayed to user.
• Special attributes:
    • min
    • max
    • step
• Special pseudo classes:
    • :in-range { }
    • :out-of-range { }
• On focus displays a date picker.
• Configurable formats:
    •   type=“date”
    •   type=“datetime”
    •   type=“datetime-local”
    •   type=“month”
    •   type=“week”
    •   type=“time”
• Support for everything except
    type=“date” is spotty.
• Text box with filtered list of suggestions.
• Replaces a select box with an “other
    please specify” option.
• Entire list isn’t usually visible, appears as
    user types, filtered by what they’ve
    entered.
• Backwards compatible: http://goo.gl/GhfEl
CODING MOST IMPRESSIVE.
Using the same form change:

• Birth/death date to date
• Army size to range
• Nemesis to datalist (Use Jeremy Keiths’ backwards compatible version
http://goo.gl/GhfEl)
Compatibility Tables
•http://wufoo.com/html5/ In depth and up to date.
Fallbacks
• All new inputs fall back to text automatically. Isn’t that awesome!
    • That means if you have a form with no validation today, you have have
         validation for modern browsers with small changes! So cool! You should
         run home and do this.
• Backwards compatible datalist: http://adactio.com/journal/4272/
Shims
•https://github.com/ryanseddon/H5F
• In early 2012 not all played nice with jQuery form validation plug-ins.
     Not sure if this has changed.

SUPPORT DO YOU KNOW HOW I
GOT THESE SCARS?
FormData
Constraint Validation
A Few More Elements

JAVASCRIPT API WITH FRICKIN
LASER BEAMS
• Create and send a virtual form. No need to create DOM elements.

varformData = new FormData();
formData.append(“weapon”, “Death Ray”);
formData.append(“cybernetics”, “eye, left arm”)

varxhr = new XMLHttpRequest();
xhr.open("POST", "http://goci.com/submission.php");
xhr.send(formData);
• Can also be used to append data to an existing form before sending.

varformElement = document.getElementById(”myForm");
varformData = new FormData(formElement);
formData.append(”Sidekick", "Harley Quinn,");

varxhr = new XMLHttpRequest();
xhr.open("POST", "http://goci.com/submission.php");
xhr.send(formData);
• Form elements have an object you can access with several attributes
that will tell you if and how a form field is failing validation.

el.validity.valid
el.validity.valueMissing
el.validity.typeMismatch
el.validity.patternMismatch
el.validity.tooLong
el.validity.rangeUnderflow and rangeOverflow
el.validity.stepMismatch
el.validity.customError

• Yes, custom errors! You can create your own errors using their API.
• Create a custom error message. Like, checking two email addresses match.

<input type="email" id="email_addr" name="email_addr">
<input type="email" id="email_addr_repeat" name="email_addr_repeat"
oninput="check(this)">

<script>
function check(input) {
  if (input.value != document.getElementById('email_addr').value) {
input.setCustomValidity('The two email addresses must match.');
  } else {
    // input is valid -- reset the error message
input.setCustomValidity('');
  }
}
</script>
CODING
Add the code to check the email address (I hate these but it *is* an evil
application form after all).

You can copy and paste the code from here:
http://www.html5rocks.com/en/tutorials/forms/html5forms/
:required
:optional
:valid
:invalid
:default

[attribute]

STYLING CUSTOM BABY SEAL
LEATHER BOOTS ANYONE?
Basic Introductions
•http://diveintohtml5.info/forms.html
•http://24ways.org/2009/have-a-field-day-with-html5-forms/
•http://www.html5rocks.com/en/tutorials/forms/html5forms/
•http://www.alistapart.com/articles/forward-thinking-form-validation/
CSS
•http://html5doctor.com/css3-pseudo-classes-and-html5-forms/
Compatibility Specifics
• http://wufoo.com/html5/
• http://miketaylr.com/code/input-type-attr.html

RESOURCES I SEE YOU BROUGHT A
FRIEND.

Mais conteĂşdo relacionado

Mais procurados

#SPSLondon - Session 2 JSLink for IT Pros
#SPSLondon - Session 2 JSLink for IT Pros#SPSLondon - Session 2 JSLink for IT Pros
#SPSLondon - Session 2 JSLink for IT ProsPaul Hunt
 
Web Safe Fonts are Dead Series | Part 1: Web Typography Reincarnated
Web Safe Fonts are Dead Series | Part 1: Web Typography ReincarnatedWeb Safe Fonts are Dead Series | Part 1: Web Typography Reincarnated
Web Safe Fonts are Dead Series | Part 1: Web Typography ReincarnatedExtensis
 
The Ebook Developer's Toolbox - ebookcraft 2016 - Sanders Kleinfeld
The Ebook Developer's Toolbox - ebookcraft 2016 - Sanders Kleinfeld The Ebook Developer's Toolbox - ebookcraft 2016 - Sanders Kleinfeld
The Ebook Developer's Toolbox - ebookcraft 2016 - Sanders Kleinfeld BookNet Canada
 
Ebook Accessibility: Why, How, and What For - ebookcraft 2016 - Laura Brady
Ebook Accessibility: Why, How, and What For - ebookcraft 2016 - Laura BradyEbook Accessibility: Why, How, and What For - ebookcraft 2016 - Laura Brady
Ebook Accessibility: Why, How, and What For - ebookcraft 2016 - Laura BradyBookNet Canada
 
JavaScript : A trending scripting language
JavaScript : A trending scripting languageJavaScript : A trending scripting language
JavaScript : A trending scripting languageAbhayDhupar
 
You Want to Go XML-First: Now What? Building an In-House XML-First Workflow -...
You Want to Go XML-First: Now What? Building an In-House XML-First Workflow -...You Want to Go XML-First: Now What? Building an In-House XML-First Workflow -...
You Want to Go XML-First: Now What? Building an In-House XML-First Workflow -...BookNet Canada
 
SPSTC - SharePoint & jQuery Essentials
SPSTC - SharePoint & jQuery EssentialsSPSTC - SharePoint & jQuery Essentials
SPSTC - SharePoint & jQuery EssentialsMark Rackley
 
Is it time to start using HTML 5
Is it time to start using HTML 5Is it time to start using HTML 5
Is it time to start using HTML 5Ravi Raj
 

Mais procurados (8)

#SPSLondon - Session 2 JSLink for IT Pros
#SPSLondon - Session 2 JSLink for IT Pros#SPSLondon - Session 2 JSLink for IT Pros
#SPSLondon - Session 2 JSLink for IT Pros
 
Web Safe Fonts are Dead Series | Part 1: Web Typography Reincarnated
Web Safe Fonts are Dead Series | Part 1: Web Typography ReincarnatedWeb Safe Fonts are Dead Series | Part 1: Web Typography Reincarnated
Web Safe Fonts are Dead Series | Part 1: Web Typography Reincarnated
 
The Ebook Developer's Toolbox - ebookcraft 2016 - Sanders Kleinfeld
The Ebook Developer's Toolbox - ebookcraft 2016 - Sanders Kleinfeld The Ebook Developer's Toolbox - ebookcraft 2016 - Sanders Kleinfeld
The Ebook Developer's Toolbox - ebookcraft 2016 - Sanders Kleinfeld
 
Ebook Accessibility: Why, How, and What For - ebookcraft 2016 - Laura Brady
Ebook Accessibility: Why, How, and What For - ebookcraft 2016 - Laura BradyEbook Accessibility: Why, How, and What For - ebookcraft 2016 - Laura Brady
Ebook Accessibility: Why, How, and What For - ebookcraft 2016 - Laura Brady
 
JavaScript : A trending scripting language
JavaScript : A trending scripting languageJavaScript : A trending scripting language
JavaScript : A trending scripting language
 
You Want to Go XML-First: Now What? Building an In-House XML-First Workflow -...
You Want to Go XML-First: Now What? Building an In-House XML-First Workflow -...You Want to Go XML-First: Now What? Building an In-House XML-First Workflow -...
You Want to Go XML-First: Now What? Building an In-House XML-First Workflow -...
 
SPSTC - SharePoint & jQuery Essentials
SPSTC - SharePoint & jQuery EssentialsSPSTC - SharePoint & jQuery Essentials
SPSTC - SharePoint & jQuery Essentials
 
Is it time to start using HTML 5
Is it time to start using HTML 5Is it time to start using HTML 5
Is it time to start using HTML 5
 

Semelhante a HTML5 Forms OF DOOM

Nsc 2013 06-17 - random rants on 2013
Nsc 2013 06-17 - random rants on 2013Nsc 2013 06-17 - random rants on 2013
Nsc 2013 06-17 - random rants on 2013Mikael Svenson
 
Web design training , Web Design Training In Kolkata
Web design training , Web Design Training In KolkataWeb design training , Web Design Training In Kolkata
Web design training , Web Design Training In KolkataW3webschool
 
Web development basics (Part-3)
Web development basics (Part-3)Web development basics (Part-3)
Web development basics (Part-3)Rajat Pratap Singh
 
Learning to run
Learning to runLearning to run
Learning to rundominion
 
Build a modern data platform.pptx
Build a modern data platform.pptxBuild a modern data platform.pptx
Build a modern data platform.pptxIke Ellis
 
How To Use Selenium Successfully
How To Use Selenium SuccessfullyHow To Use Selenium Successfully
How To Use Selenium SuccessfullyDave Haeffner
 
Harness SharePoint and jQuery to Make Dynamic Displays and Applications
 Harness SharePoint and jQuery to Make Dynamic Displays and Applications Harness SharePoint and jQuery to Make Dynamic Displays and Applications
Harness SharePoint and jQuery to Make Dynamic Displays and ApplicationsInnoTech
 
Embracing a Taxonomy of Types to Simplify Machine Learning with Leah McGuire
Embracing a Taxonomy of Types to Simplify Machine Learning with Leah McGuireEmbracing a Taxonomy of Types to Simplify Machine Learning with Leah McGuire
Embracing a Taxonomy of Types to Simplify Machine Learning with Leah McGuireDatabricks
 
Solr and Image Module Extensions of Magnolia
Solr and Image Module Extensions of MagnoliaSolr and Image Module Extensions of Magnolia
Solr and Image Module Extensions of Magnoliabkraft
 
Wordcamp St. Louis - Clean Coding
Wordcamp St. Louis - Clean CodingWordcamp St. Louis - Clean Coding
Wordcamp St. Louis - Clean Codinginspector_fegter
 
How to Use Selenium, Successfully
How to Use Selenium, SuccessfullyHow to Use Selenium, Successfully
How to Use Selenium, SuccessfullySauce Labs
 
Abhilash front end ppt.pdf
Abhilash front end ppt.pdfAbhilash front end ppt.pdf
Abhilash front end ppt.pdfvinodpatil406281
 
Web forms and html (lect 4)
Web forms and html (lect 4)Web forms and html (lect 4)
Web forms and html (lect 4)Salman Memon
 
Write Generic Code with the Tooling API
Write Generic Code with the Tooling APIWrite Generic Code with the Tooling API
Write Generic Code with the Tooling APIAdam Olshansky
 
saikiran front end ppt.pptx
saikiran front end ppt.pptxsaikiran front end ppt.pptx
saikiran front end ppt.pptxvinodpatil406281
 
The web standards gentleman: a matter of (evolving) standards)
The web standards gentleman: a matter of (evolving) standards)The web standards gentleman: a matter of (evolving) standards)
The web standards gentleman: a matter of (evolving) standards)Chris Mills
 
Quick & Easy SharePoint Forms with StratusForms
Quick & Easy SharePoint Forms with StratusFormsQuick & Easy SharePoint Forms with StratusForms
Quick & Easy SharePoint Forms with StratusFormsApril Dunnam
 
gdscWorkShopJavascriptintroductions.pptx
gdscWorkShopJavascriptintroductions.pptxgdscWorkShopJavascriptintroductions.pptx
gdscWorkShopJavascriptintroductions.pptxsandeshshahapur
 
Dapper: the microORM that will change your life
Dapper: the microORM that will change your lifeDapper: the microORM that will change your life
Dapper: the microORM that will change your lifeDavide Mauri
 

Semelhante a HTML5 Forms OF DOOM (20)

Nsc 2013 06-17 - random rants on 2013
Nsc 2013 06-17 - random rants on 2013Nsc 2013 06-17 - random rants on 2013
Nsc 2013 06-17 - random rants on 2013
 
Web design training , Web Design Training In Kolkata
Web design training , Web Design Training In KolkataWeb design training , Web Design Training In Kolkata
Web design training , Web Design Training In Kolkata
 
Web development basics (Part-3)
Web development basics (Part-3)Web development basics (Part-3)
Web development basics (Part-3)
 
Learning to run
Learning to runLearning to run
Learning to run
 
Build a modern data platform.pptx
Build a modern data platform.pptxBuild a modern data platform.pptx
Build a modern data platform.pptx
 
How To Use Selenium Successfully
How To Use Selenium SuccessfullyHow To Use Selenium Successfully
How To Use Selenium Successfully
 
Refactoring
RefactoringRefactoring
Refactoring
 
Harness SharePoint and jQuery to Make Dynamic Displays and Applications
 Harness SharePoint and jQuery to Make Dynamic Displays and Applications Harness SharePoint and jQuery to Make Dynamic Displays and Applications
Harness SharePoint and jQuery to Make Dynamic Displays and Applications
 
Embracing a Taxonomy of Types to Simplify Machine Learning with Leah McGuire
Embracing a Taxonomy of Types to Simplify Machine Learning with Leah McGuireEmbracing a Taxonomy of Types to Simplify Machine Learning with Leah McGuire
Embracing a Taxonomy of Types to Simplify Machine Learning with Leah McGuire
 
Solr and Image Module Extensions of Magnolia
Solr and Image Module Extensions of MagnoliaSolr and Image Module Extensions of Magnolia
Solr and Image Module Extensions of Magnolia
 
Wordcamp St. Louis - Clean Coding
Wordcamp St. Louis - Clean CodingWordcamp St. Louis - Clean Coding
Wordcamp St. Louis - Clean Coding
 
How to Use Selenium, Successfully
How to Use Selenium, SuccessfullyHow to Use Selenium, Successfully
How to Use Selenium, Successfully
 
Abhilash front end ppt.pdf
Abhilash front end ppt.pdfAbhilash front end ppt.pdf
Abhilash front end ppt.pdf
 
Web forms and html (lect 4)
Web forms and html (lect 4)Web forms and html (lect 4)
Web forms and html (lect 4)
 
Write Generic Code with the Tooling API
Write Generic Code with the Tooling APIWrite Generic Code with the Tooling API
Write Generic Code with the Tooling API
 
saikiran front end ppt.pptx
saikiran front end ppt.pptxsaikiran front end ppt.pptx
saikiran front end ppt.pptx
 
The web standards gentleman: a matter of (evolving) standards)
The web standards gentleman: a matter of (evolving) standards)The web standards gentleman: a matter of (evolving) standards)
The web standards gentleman: a matter of (evolving) standards)
 
Quick & Easy SharePoint Forms with StratusForms
Quick & Easy SharePoint Forms with StratusFormsQuick & Easy SharePoint Forms with StratusForms
Quick & Easy SharePoint Forms with StratusForms
 
gdscWorkShopJavascriptintroductions.pptx
gdscWorkShopJavascriptintroductions.pptxgdscWorkShopJavascriptintroductions.pptx
gdscWorkShopJavascriptintroductions.pptx
 
Dapper: the microORM that will change your life
Dapper: the microORM that will change your lifeDapper: the microORM that will change your life
Dapper: the microORM that will change your life
 

Mais de Stephanie Hobson

Writing for Every Reader - Design and Content
Writing for Every Reader - Design and ContentWriting for Every Reader - Design and Content
Writing for Every Reader - Design and ContentStephanie Hobson
 
Flipping Tables: Displaying Data on Small Screens
Flipping Tables: Displaying Data on Small ScreensFlipping Tables: Displaying Data on Small Screens
Flipping Tables: Displaying Data on Small ScreensStephanie Hobson
 
Writing for Every Reader
Writing for Every ReaderWriting for Every Reader
Writing for Every ReaderStephanie Hobson
 
Flipping Tables: Displaying Data on Small Screens (2016-08)
Flipping Tables: Displaying Data on Small Screens (2016-08)Flipping Tables: Displaying Data on Small Screens (2016-08)
Flipping Tables: Displaying Data on Small Screens (2016-08)Stephanie Hobson
 
Flipping Tables: Displaying Data on Small Screens (2016-02)
Flipping Tables: Displaying Data on Small Screens (2016-02)Flipping Tables: Displaying Data on Small Screens (2016-02)
Flipping Tables: Displaying Data on Small Screens (2016-02)Stephanie Hobson
 
Web Accessibility: 
Making Websites Better for Everyone
Web Accessibility: 
Making Websites Better for EveryoneWeb Accessibility: 
Making Websites Better for Everyone
Web Accessibility: 
Making Websites Better for EveryoneStephanie Hobson
 
Mobile First Is Performance First
Mobile First Is Performance FirstMobile First Is Performance First
Mobile First Is Performance FirstStephanie Hobson
 
Accessibility with CSS: Making Websites Better for Everyone
Accessibility with CSS: Making Websites Better for EveryoneAccessibility with CSS: Making Websites Better for Everyone
Accessibility with CSS: Making Websites Better for EveryoneStephanie Hobson
 

Mais de Stephanie Hobson (9)

Writing for Every Reader - Design and Content
Writing for Every Reader - Design and ContentWriting for Every Reader - Design and Content
Writing for Every Reader - Design and Content
 
Flipping Tables: Displaying Data on Small Screens
Flipping Tables: Displaying Data on Small ScreensFlipping Tables: Displaying Data on Small Screens
Flipping Tables: Displaying Data on Small Screens
 
Writing for Every Reader
Writing for Every ReaderWriting for Every Reader
Writing for Every Reader
 
Flipping Tables: Displaying Data on Small Screens (2016-08)
Flipping Tables: Displaying Data on Small Screens (2016-08)Flipping Tables: Displaying Data on Small Screens (2016-08)
Flipping Tables: Displaying Data on Small Screens (2016-08)
 
Flipping Tables: Displaying Data on Small Screens (2016-02)
Flipping Tables: Displaying Data on Small Screens (2016-02)Flipping Tables: Displaying Data on Small Screens (2016-02)
Flipping Tables: Displaying Data on Small Screens (2016-02)
 
Web Accessibility: 
Making Websites Better for Everyone
Web Accessibility: 
Making Websites Better for EveryoneWeb Accessibility: 
Making Websites Better for Everyone
Web Accessibility: 
Making Websites Better for Everyone
 
Mobile First Is Performance First
Mobile First Is Performance FirstMobile First Is Performance First
Mobile First Is Performance First
 
Accessibility with CSS: Making Websites Better for Everyone
Accessibility with CSS: Making Websites Better for EveryoneAccessibility with CSS: Making Websites Better for Everyone
Accessibility with CSS: Making Websites Better for Everyone
 
Geolocation
GeolocationGeolocation
Geolocation
 

Último

Automating Google Workspace (GWS) & more with Apps Script
Automating Google Workspace (GWS) & more with Apps ScriptAutomating Google Workspace (GWS) & more with Apps Script
Automating Google Workspace (GWS) & more with Apps Scriptwesley chun
 
Understanding Discord NSFW Servers A Guide for Responsible Users.pdf
Understanding Discord NSFW Servers A Guide for Responsible Users.pdfUnderstanding Discord NSFW Servers A Guide for Responsible Users.pdf
Understanding Discord NSFW Servers A Guide for Responsible Users.pdfUK Journal
 
08448380779 Call Girls In Greater Kailash - I Women Seeking Men
08448380779 Call Girls In Greater Kailash - I Women Seeking Men08448380779 Call Girls In Greater Kailash - I Women Seeking Men
08448380779 Call Girls In Greater Kailash - I Women Seeking MenDelhi Call girls
 
🐬 The future of MySQL is Postgres 🐘
🐬  The future of MySQL is Postgres   🐘🐬  The future of MySQL is Postgres   🐘
🐬 The future of MySQL is Postgres 🐘RTylerCroy
 
Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...
Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...
Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...Drew Madelung
 
Data Cloud, More than a CDP by Matt Robison
Data Cloud, More than a CDP by Matt RobisonData Cloud, More than a CDP by Matt Robison
Data Cloud, More than a CDP by Matt RobisonAnna Loughnan Colquhoun
 
Slack Application Development 101 Slides
Slack Application Development 101 SlidesSlack Application Development 101 Slides
Slack Application Development 101 Slidespraypatel2
 
IAC 2024 - IA Fast Track to Search Focused AI Solutions
IAC 2024 - IA Fast Track to Search Focused AI SolutionsIAC 2024 - IA Fast Track to Search Focused AI Solutions
IAC 2024 - IA Fast Track to Search Focused AI SolutionsEnterprise Knowledge
 
Boost PC performance: How more available memory can improve productivity
Boost PC performance: How more available memory can improve productivityBoost PC performance: How more available memory can improve productivity
Boost PC performance: How more available memory can improve productivityPrincipled Technologies
 
Driving Behavioral Change for Information Management through Data-Driven Gree...
Driving Behavioral Change for Information Management through Data-Driven Gree...Driving Behavioral Change for Information Management through Data-Driven Gree...
Driving Behavioral Change for Information Management through Data-Driven Gree...Enterprise Knowledge
 
Breaking the Kubernetes Kill Chain: Host Path Mount
Breaking the Kubernetes Kill Chain: Host Path MountBreaking the Kubernetes Kill Chain: Host Path Mount
Breaking the Kubernetes Kill Chain: Host Path MountPuma Security, LLC
 
Presentation on how to chat with PDF using ChatGPT code interpreter
Presentation on how to chat with PDF using ChatGPT code interpreterPresentation on how to chat with PDF using ChatGPT code interpreter
Presentation on how to chat with PDF using ChatGPT code interpreternaman860154
 
How to convert PDF to text with Nanonets
How to convert PDF to text with NanonetsHow to convert PDF to text with Nanonets
How to convert PDF to text with Nanonetsnaman860154
 
Apidays Singapore 2024 - Building Digital Trust in a Digital Economy by Veron...
Apidays Singapore 2024 - Building Digital Trust in a Digital Economy by Veron...Apidays Singapore 2024 - Building Digital Trust in a Digital Economy by Veron...
Apidays Singapore 2024 - Building Digital Trust in a Digital Economy by Veron...apidays
 
04-2024-HHUG-Sales-and-Marketing-Alignment.pptx
04-2024-HHUG-Sales-and-Marketing-Alignment.pptx04-2024-HHUG-Sales-and-Marketing-Alignment.pptx
04-2024-HHUG-Sales-and-Marketing-Alignment.pptxHampshireHUG
 
Handwritten Text Recognition for manuscripts and early printed texts
Handwritten Text Recognition for manuscripts and early printed textsHandwritten Text Recognition for manuscripts and early printed texts
Handwritten Text Recognition for manuscripts and early printed textsMaria Levchenko
 
Boost Fertility New Invention Ups Success Rates.pdf
Boost Fertility New Invention Ups Success Rates.pdfBoost Fertility New Invention Ups Success Rates.pdf
Boost Fertility New Invention Ups Success Rates.pdfsudhanshuwaghmare1
 
The Codex of Business Writing Software for Real-World Solutions 2.pptx
The Codex of Business Writing Software for Real-World Solutions 2.pptxThe Codex of Business Writing Software for Real-World Solutions 2.pptx
The Codex of Business Writing Software for Real-World Solutions 2.pptxMalak Abu Hammad
 
08448380779 Call Girls In Civil Lines Women Seeking Men
08448380779 Call Girls In Civil Lines Women Seeking Men08448380779 Call Girls In Civil Lines Women Seeking Men
08448380779 Call Girls In Civil Lines Women Seeking MenDelhi Call girls
 
Artificial Intelligence: Facts and Myths
Artificial Intelligence: Facts and MythsArtificial Intelligence: Facts and Myths
Artificial Intelligence: Facts and MythsJoaquim Jorge
 

Último (20)

Automating Google Workspace (GWS) & more with Apps Script
Automating Google Workspace (GWS) & more with Apps ScriptAutomating Google Workspace (GWS) & more with Apps Script
Automating Google Workspace (GWS) & more with Apps Script
 
Understanding Discord NSFW Servers A Guide for Responsible Users.pdf
Understanding Discord NSFW Servers A Guide for Responsible Users.pdfUnderstanding Discord NSFW Servers A Guide for Responsible Users.pdf
Understanding Discord NSFW Servers A Guide for Responsible Users.pdf
 
08448380779 Call Girls In Greater Kailash - I Women Seeking Men
08448380779 Call Girls In Greater Kailash - I Women Seeking Men08448380779 Call Girls In Greater Kailash - I Women Seeking Men
08448380779 Call Girls In Greater Kailash - I Women Seeking Men
 
🐬 The future of MySQL is Postgres 🐘
🐬  The future of MySQL is Postgres   🐘🐬  The future of MySQL is Postgres   🐘
🐬 The future of MySQL is Postgres 🐘
 
Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...
Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...
Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...
 
Data Cloud, More than a CDP by Matt Robison
Data Cloud, More than a CDP by Matt RobisonData Cloud, More than a CDP by Matt Robison
Data Cloud, More than a CDP by Matt Robison
 
Slack Application Development 101 Slides
Slack Application Development 101 SlidesSlack Application Development 101 Slides
Slack Application Development 101 Slides
 
IAC 2024 - IA Fast Track to Search Focused AI Solutions
IAC 2024 - IA Fast Track to Search Focused AI SolutionsIAC 2024 - IA Fast Track to Search Focused AI Solutions
IAC 2024 - IA Fast Track to Search Focused AI Solutions
 
Boost PC performance: How more available memory can improve productivity
Boost PC performance: How more available memory can improve productivityBoost PC performance: How more available memory can improve productivity
Boost PC performance: How more available memory can improve productivity
 
Driving Behavioral Change for Information Management through Data-Driven Gree...
Driving Behavioral Change for Information Management through Data-Driven Gree...Driving Behavioral Change for Information Management through Data-Driven Gree...
Driving Behavioral Change for Information Management through Data-Driven Gree...
 
Breaking the Kubernetes Kill Chain: Host Path Mount
Breaking the Kubernetes Kill Chain: Host Path MountBreaking the Kubernetes Kill Chain: Host Path Mount
Breaking the Kubernetes Kill Chain: Host Path Mount
 
Presentation on how to chat with PDF using ChatGPT code interpreter
Presentation on how to chat with PDF using ChatGPT code interpreterPresentation on how to chat with PDF using ChatGPT code interpreter
Presentation on how to chat with PDF using ChatGPT code interpreter
 
How to convert PDF to text with Nanonets
How to convert PDF to text with NanonetsHow to convert PDF to text with Nanonets
How to convert PDF to text with Nanonets
 
Apidays Singapore 2024 - Building Digital Trust in a Digital Economy by Veron...
Apidays Singapore 2024 - Building Digital Trust in a Digital Economy by Veron...Apidays Singapore 2024 - Building Digital Trust in a Digital Economy by Veron...
Apidays Singapore 2024 - Building Digital Trust in a Digital Economy by Veron...
 
04-2024-HHUG-Sales-and-Marketing-Alignment.pptx
04-2024-HHUG-Sales-and-Marketing-Alignment.pptx04-2024-HHUG-Sales-and-Marketing-Alignment.pptx
04-2024-HHUG-Sales-and-Marketing-Alignment.pptx
 
Handwritten Text Recognition for manuscripts and early printed texts
Handwritten Text Recognition for manuscripts and early printed textsHandwritten Text Recognition for manuscripts and early printed texts
Handwritten Text Recognition for manuscripts and early printed texts
 
Boost Fertility New Invention Ups Success Rates.pdf
Boost Fertility New Invention Ups Success Rates.pdfBoost Fertility New Invention Ups Success Rates.pdf
Boost Fertility New Invention Ups Success Rates.pdf
 
The Codex of Business Writing Software for Real-World Solutions 2.pptx
The Codex of Business Writing Software for Real-World Solutions 2.pptxThe Codex of Business Writing Software for Real-World Solutions 2.pptx
The Codex of Business Writing Software for Real-World Solutions 2.pptx
 
08448380779 Call Girls In Civil Lines Women Seeking Men
08448380779 Call Girls In Civil Lines Women Seeking Men08448380779 Call Girls In Civil Lines Women Seeking Men
08448380779 Call Girls In Civil Lines Women Seeking Men
 
Artificial Intelligence: Facts and Myths
Artificial Intelligence: Facts and MythsArtificial Intelligence: Facts and Myths
Artificial Intelligence: Facts and Myths
 

HTML5 Forms OF DOOM

  • 1. Come to the dark side. We have cookies. FORMS OF DOOM
  • 4. • Disappears as the user types. • NOT a replacement for a proper label. I will hunt you down.
  • 5. • Validated by supporting browsers.
  • 6. • Gives the first field in the source order with autofocus focus on page load. • Will scroll the page to give it focus. • Not supported by mobile browsers.
  • 7. • Suggests to browsers that they not auto fill that form field. • Suggested for use on form fields the browser will probably auto fill wrong. For example: Name when you want a pet’s name.
  • 8. • Also accepts “true”. • Tells the browser explicitly whether or not to spell check the field. • Good for fields where the input is expected to be interpreted as a misspelling.
  • 9. • Matches a regular expression. • Only validates if something has been entered. • Error message is non-specific. Some browsers will use title attribute to explain. • Use the title attribute to add additional help text. Please. • This works with all the input types.
  • 10. CODING IMPRESSIVE. Download the sample form: stephaniehobson.ca/html5forms Add: • Placeholder • Required • Autofocus •Autocomplete (to the nemesis name field – wouldn’t want to submit your own name as your nemesis, that’d be awkward) •Spellcheck (to the nemesis name field) • Pattern
  • 12. • For email addresses. • Gives email keyboard. • Is validated as an email address. •Special attribute: • multiple (enables acceptance of a comma separated list of addresses)
  • 13. • For urls. • Gives url keyboard. • Is validated as a url – very loosely. • URL validation is actually really complicated. • Use in combination with pattern if you want something specific.
  • 14. • For phone numbers. • Gives number pad. • Very loosely validated. • Handy since the nice big number pad is handy for inputting any number so you can use it for anything else you like. thisisourstop.com uses it for bus stop number. • Use with pattern if you have something specific in mind.
  • 15. • No standard functionality. •Remembered search terms on some. • Rounded corners on some. • Over ride with -webkit-appearance:none; • Little grey clear field “x” on some.
  • 16. • For numbers. Also called a “spinbox”. • Gives number keypad. • Validated as a number (one day). •Special attributes: • min • max • step • Special pseudo classes: • :in-range { } • :out-of-range { }
  • 17. • For numbers. Also called a “slider”. • Exact number not displayed to user. • Special attributes: • min • max • step • Special pseudo classes: • :in-range { } • :out-of-range { }
  • 18. • On focus displays a date picker. • Configurable formats: • type=“date” • type=“datetime” • type=“datetime-local” • type=“month” • type=“week” • type=“time” • Support for everything except type=“date” is spotty.
  • 19. • Text box with filtered list of suggestions. • Replaces a select box with an “other please specify” option. • Entire list isn’t usually visible, appears as user types, filtered by what they’ve entered. • Backwards compatible: http://goo.gl/GhfEl
  • 20. CODING MOST IMPRESSIVE. Using the same form change: • Birth/death date to date • Army size to range • Nemesis to datalist (Use Jeremy Keiths’ backwards compatible version http://goo.gl/GhfEl)
  • 21. Compatibility Tables •http://wufoo.com/html5/ In depth and up to date. Fallbacks • All new inputs fall back to text automatically. Isn’t that awesome! • That means if you have a form with no validation today, you have have validation for modern browsers with small changes! So cool! You should run home and do this. • Backwards compatible datalist: http://adactio.com/journal/4272/ Shims •https://github.com/ryanseddon/H5F • In early 2012 not all played nice with jQuery form validation plug-ins. Not sure if this has changed. SUPPORT DO YOU KNOW HOW I GOT THESE SCARS?
  • 22. FormData Constraint Validation A Few More Elements JAVASCRIPT API WITH FRICKIN LASER BEAMS
  • 23. • Create and send a virtual form. No need to create DOM elements. varformData = new FormData(); formData.append(“weapon”, “Death Ray”); formData.append(“cybernetics”, “eye, left arm”) varxhr = new XMLHttpRequest(); xhr.open("POST", "http://goci.com/submission.php"); xhr.send(formData);
  • 24. • Can also be used to append data to an existing form before sending. varformElement = document.getElementById(”myForm"); varformData = new FormData(formElement); formData.append(”Sidekick", "Harley Quinn,"); varxhr = new XMLHttpRequest(); xhr.open("POST", "http://goci.com/submission.php"); xhr.send(formData);
  • 25. • Form elements have an object you can access with several attributes that will tell you if and how a form field is failing validation. el.validity.valid el.validity.valueMissing el.validity.typeMismatch el.validity.patternMismatch el.validity.tooLong el.validity.rangeUnderflow and rangeOverflow el.validity.stepMismatch el.validity.customError • Yes, custom errors! You can create your own errors using their API.
  • 26. • Create a custom error message. Like, checking two email addresses match. <input type="email" id="email_addr" name="email_addr"> <input type="email" id="email_addr_repeat" name="email_addr_repeat" oninput="check(this)"> <script> function check(input) { if (input.value != document.getElementById('email_addr').value) { input.setCustomValidity('The two email addresses must match.'); } else { // input is valid -- reset the error message input.setCustomValidity(''); } } </script>
  • 27. CODING Add the code to check the email address (I hate these but it *is* an evil application form after all). You can copy and paste the code from here: http://www.html5rocks.com/en/tutorials/forms/html5forms/

Notas do Editor

  1. Mobile vs DesktopSome can be used today
  2. These apply to almost all input types, existing and new
  3. You are WEB MASTER for the Guild of Calamitous Intent
  4. Use pattern if you want it in a certain format
  5. Apple’s baby so Safari handles it best.Some remember last few searches.Some give little grey X.Can be combined with datalist to provide search suggestions
  6. Support for this one is really spotty
  7. You are WEB MASTER for the Guild of Calamitous Intent
  8. Fallbacks – to text! Isn’t that awesome!ShimsThese do not place nice with many existing jQuery plug ins :(
  9. Create a form altogether. Virtually in JavaSript. No need to create hidden forms in the DOM.
  10. Append to an existing form
  11. New attribute called validityReturns the validityState object which has several boolean attributes (basically a series of true/false tests)
  12. You are WEB MASTER for the Guild of Calamitous Intent
  13. Some of the problems with timing.