SlideShare ist ein Scribd-Unternehmen logo
1 von 49
Web Forms 2.0 New form elements & Attributes in HTML5 Estelle Weyl www.Standardista.com@estellevw
HTML 4 <Input> Types button checkbox file hidden image password radio reset submit text <input type="…
<Input> Types New in HTML5 color date  datetime datetime-local  email  month  number  range  search tel time  url week
<Input> Attributes in HTML4  name   disabled*   type  maxlength readonly size  value   alt src  height  width  checked* align * CSS pseudoclasses
New <Input> Attributes in HTML5  form readonly autocomplete  autofocus   list   pattern   required   placeholder  multiple  list  min  max  step formaction formenctype formmethod formtarget formnovalidate
Other Form Elements New  <datalist>  <output>  <meter>  <progress>  <keygen> Old  <form>  <fieldset>  <legend>  <textarea>  <label>  <select>  <option>  <optgroup>* * Optgroups are nestable in HTML5
<p>       <label for="inputID">Label: </label>       <input id="inputID" name="inputName" type="text" /> </p>
Attribute Soup! <p>       <label for="inputID">Label: </label>       <input id="inputID" name="inputName"   placeholder="placeholder text"   pattern="{6,9}"   required      autofocus  type="text" /> </p> http://standardista.com/webkit/ch4/input.html
<label> <p>       <label for="inputID">Label: </label>       <input id="inputID" name="inputName"   placeholder="placeholder text"   pattern="{6,9}"   required      autofocus  type="text" /> </p>
Placeholder Attribute <p>       <label for="inputID">Label: </label>       <input id="inputID" name="inputName"   placeholder="placeholder text"   pattern="{6,9}"   required      autofocus  type="text" /> </p> 4
Graceful Degredation $("input[placeholder]").each(function(){ if($(this).val()==""){     $(this).val($(this).attr("placeholder"));     $(this).focus(function(){ if($(this).val()==$(this).attr("placeholder")) $(this).val("");     });     $(this).blur(function(){ if($(this).val()==""){          $(this).val($(this).attr("placeholder"));       }      });   } }); // on submit ensure: $(this).val() != $(this).attr("placeholder"))
Pattern Attribute <p>       <label for="inputID">Label: </label>       <input id="inputID" name="inputName"   placeholder="placeholder text"   pattern="{6,9}"   required      autofocus  type="text" /> </p>
Required Attribute <p>       <label for="inputID">Label: </label>       <input id="inputID" name="inputName"   placeholder="placeholder text"   pattern="{6,9}"   required      autofocus  type="text" /> </p>
Graceful Degredation		Without Touching HTML! // use regExp from pattern to validate! // if has attribute required, can not be empty.
Targeting In CSS		Without Touching HTML! :default :valid :invalid :in-range :out-of-range :required :optional :read-only :read-write input[type=checkbox] input[required] input:not([required])
Autofocus Attribute <p>       <label for="inputID">Label: </label>       <input id="inputID" name="inputName"   placeholder="placeholder text"   pattern="{6,9}"   required      autofocus  type="text" /> </p>
Type Attribute <p>       <label for="inputID">Label: </label>       <input id="inputID" name="inputName"   placeholder="placeholder text"   pattern="{6,9}"   required      autofocus  type="text" /> </p>
HTML 4 <Input> Types button- checkbox. file* hidden image. password. radio reset- submit text
13 New <Input> Types in HTML5 color  url tel email number range search  date  datetime datetime-local month  time week
color <input type="color" …>
Color on Blackberry Color: <input type="color" id="txtColor" value="#FF0000"/>
color <input type="color"  pattern="#[a-fA-F0-9]{6}" <input id="color" name="color" type="color"       placeholder="#FFFFFF"        pattern="#(?:[0-9A-Fa-f]{6}|[0-9A-Fa-f]{3})"       required /> http://standardista.com/webkit/ch4/color.html
URL <input type="url" …>
URL <input id="url" name="url" type="url" placeholder="http://www.x.com" pattern="^http(s)?://.*" required /> http://standardista.com/webkit/ch4/url.html
Datalist
<p>     <label for="url">Web Address: </label>     <input id="url" name="url"	type="url"  		placeholder="http://www.domain.com"  		required   		list="mydatalist"/ > </p> <datalist id="mydatalist">     <option value="http://www.standardista.com"/> <option value="http://www.apress.com" /><option value="http://www.evotech.net" /> </datalist>   http://standardista.com/webkit/ch4/datalist.html
<datalist id="mydatalist">  <option value="http://www.standardista.com" label="standardista" /> <option value="http://www.apress.com" label="apress" /> <option value="http://www.evotech.net" label="Evotech"/> </datalist>   http://standardista.com/webkit/ch4/datalist.html
<p> <label for="url">Web Address:</label> 	<input id="url"  name="url"  		type="url"  		placeholder="http://www.domain.com" 		list="datalist" /> </p> <datalist id="datalist">   <label>or select one from the following list: <select name="url4">	 <option value="http://www.standardista.com" /> <option value="http://www.apress.com" /> <option value="http://www.evotech.net" />  </select> </label> </datalist> http://standardista.com/webkit/ch4/datalist.html
Phone Numbers <input type="tel" …>
Phone Numbers <input type="tel" …>
Phone Numbers <label for="tel">Telephone: </label> <input id="tel" type="tel" name="tel" placeholder="XXX-XXX-XXXX"   pattern="[0-9]{3}-[0-9]{3}-[0-9]{4}"    required /> http://standardista.com/webkit/ch4/phone.html
Email Addresses <label for="email">Email: </label> <input id="email" name="email" type="email" placeholder="you@domain.com"  multiple    required /> http://standardista.com/webkit/ch4/email.html
Email Addresses http://standardista.com/webkit/ch4/email.html
Number  <input name="n" type="number"/>  min  max  step http://standardista.com/webkit/ch4/number.html
 <inputid="nickels" name="nickels"  type="number"  placeholder="0, 5, 10 &hellip;"  pattern="[0-9]*[05]"    min="0"    max="1000"    step="5"    required /> http://standardista.com/webkit/ch4/number.html safari
 <inputid="nickels" name="nickels"  type="number"  placeholder="0, 5, 10 &hellip;"  pattern="[0-9]*[05]"    min="0"    max="1000"    step="5"    required /> Because all presentations are better  with cats and unicorns http://standardista.com/webkit/ch4/number.html
http://standardista.com/webkit/ch4/number.html
Range <input id="range" name="range" type="range" placeholder="0 to 10" pattern="[0-9]|10" min="0" max="10" step="1" required /> http://standardista.com/webkit/ch4/range.html
Search <input id="search" name="search" type="search"   placeholder="search terms" required /> http://standardista.com/webkit/ch4/search.html
Date Time <Input> Types date 			2010-08-26 datetime 		2010-08-26 19:00 datetime-local	2010-08-26 19:00 month 			2010-08 time	19:00 week			2010-W34
Date Time <Input> Types date 			http://www.standardista.com/webkit/ch4/date.html datetimehttp://www.standardista.com/webkit/ch4/datetime.html datetime-localhttp://www.standardista.com/webkit/ch4/datetime-loca.html month 		http://www.standardista.com/webkit/ch4/month.html Timehttp://www.standardista.com/webkit/ch4/time.html weekhttp://www.standardista.com/webkit/ch4/month.html
Other Attributes Form Autofocus Autocomplete
Other Elements <meter> <progress> <keygen> <output>
Test Everything http://standardista.com/sandbox/html5formelements.html
Thanks @estellevw http://www.standardista.com http://evotech.net/blog
Credits Ma1974http://www.flickr.com/photos/ma1974/358477814/ Cornifyhttp://cornify.com

Weitere ähnliche Inhalte

Was ist angesagt?

Php Form
Php FormPhp Form
Php Form
lotlot
 
Html basics 10 form
Html basics 10 formHtml basics 10 form
Html basics 10 form
H K
 

Was ist angesagt? (20)

HTML Forms
HTML FormsHTML Forms
HTML Forms
 
Html Guide
Html GuideHtml Guide
Html Guide
 
html 5 new form attribute
html 5 new form attributehtml 5 new form attribute
html 5 new form attribute
 
Web engineering - HTML Form
Web engineering -  HTML FormWeb engineering -  HTML Form
Web engineering - HTML Form
 
HTML Forms
HTML FormsHTML Forms
HTML Forms
 
Html form tag
Html form tagHtml form tag
Html form tag
 
HTML frames and HTML forms
HTML frames and HTML formsHTML frames and HTML forms
HTML frames and HTML forms
 
New Form Element in HTML5
New Form Element in HTML5New Form Element in HTML5
New Form Element in HTML5
 
Html tables, forms and audio video
Html tables, forms and audio videoHtml tables, forms and audio video
Html tables, forms and audio video
 
Fiverr html5 test answers 2020
Fiverr html5 test answers 2020Fiverr html5 test answers 2020
Fiverr html5 test answers 2020
 
Web I - 04 - Forms
Web I - 04 - FormsWeb I - 04 - Forms
Web I - 04 - Forms
 
Html form
Html formHtml form
Html form
 
Html forms
Html formsHtml forms
Html forms
 
HTML Forms Tutorial
HTML Forms TutorialHTML Forms Tutorial
HTML Forms Tutorial
 
Php Form
Php FormPhp Form
Php Form
 
Html basics 10 form
Html basics 10 formHtml basics 10 form
Html basics 10 form
 
5.1 html lec 5
5.1 html lec 55.1 html lec 5
5.1 html lec 5
 
html for beginners
html for beginnershtml for beginners
html for beginners
 
4.1 html lec 4
4.1 html lec 44.1 html lec 4
4.1 html lec 4
 
The complete-html-cheat-sheet
The complete-html-cheat-sheetThe complete-html-cheat-sheet
The complete-html-cheat-sheet
 

Andere mochten auch

Building Mobile Apps with HTML, CSS, and JavaScript
Building Mobile Apps with HTML, CSS, and JavaScriptBuilding Mobile Apps with HTML, CSS, and JavaScript
Building Mobile Apps with HTML, CSS, and JavaScript
Jonathan Stark
 
AWS Summit Berlin 2012 Talk on Web Data Commons
AWS Summit Berlin 2012 Talk on Web Data CommonsAWS Summit Berlin 2012 Talk on Web Data Commons
AWS Summit Berlin 2012 Talk on Web Data Commons
Hannes Mühleisen
 
Sistema de drenaje pleural
Sistema de drenaje pleuralSistema de drenaje pleural
Sistema de drenaje pleural
chentu
 
Mobile App Development
Mobile App DevelopmentMobile App Development
Mobile App Development
Chris Morrell
 
Aspiracion de secreciones
Aspiracion de secrecionesAspiracion de secreciones
Aspiracion de secreciones
David Manuel
 

Andere mochten auch (20)

Web Forms The Right Way
Web Forms The Right WayWeb Forms The Right Way
Web Forms The Right Way
 
Web Development for Mobile: GTUG Talk at Google
Web Development for Mobile: GTUG Talk at GoogleWeb Development for Mobile: GTUG Talk at Google
Web Development for Mobile: GTUG Talk at Google
 
iPhone Web Applications: HTML5, CSS3 & dev tips for iPhone development
iPhone Web Applications: HTML5, CSS3 & dev tips for iPhone developmentiPhone Web Applications: HTML5, CSS3 & dev tips for iPhone development
iPhone Web Applications: HTML5, CSS3 & dev tips for iPhone development
 
Building Mobile Apps with HTML, CSS, and JavaScript
Building Mobile Apps with HTML, CSS, and JavaScriptBuilding Mobile Apps with HTML, CSS, and JavaScript
Building Mobile Apps with HTML, CSS, and JavaScript
 
AWS Summit Berlin 2012 Talk on Web Data Commons
AWS Summit Berlin 2012 Talk on Web Data CommonsAWS Summit Berlin 2012 Talk on Web Data Commons
AWS Summit Berlin 2012 Talk on Web Data Commons
 
Sello de agua y toracotomia
Sello de agua y toracotomia Sello de agua y toracotomia
Sello de agua y toracotomia
 
Sistema de drenaje pleural
Sistema de drenaje pleuralSistema de drenaje pleural
Sistema de drenaje pleural
 
Aspiracion de secresiones en circuito cerrado
Aspiracion de secresiones en circuito cerradoAspiracion de secresiones en circuito cerrado
Aspiracion de secresiones en circuito cerrado
 
Aspiracion de secreciones
Aspiracion de secrecionesAspiracion de secreciones
Aspiracion de secreciones
 
sello de agua
sello de aguasello de agua
sello de agua
 
Information Architecture On A Large Scale
Information Architecture On A Large ScaleInformation Architecture On A Large Scale
Information Architecture On A Large Scale
 
Mobile App Development
Mobile App DevelopmentMobile App Development
Mobile App Development
 
2013 11 mobile eating the world
2013 11 mobile eating the world2013 11 mobile eating the world
2013 11 mobile eating the world
 
Cuidado Enfermeria Oxigenoterapia Sistemas Alto Y Bajo Flujo
Cuidado Enfermeria Oxigenoterapia Sistemas Alto Y Bajo FlujoCuidado Enfermeria Oxigenoterapia Sistemas Alto Y Bajo Flujo
Cuidado Enfermeria Oxigenoterapia Sistemas Alto Y Bajo Flujo
 
Exposicion Oxigenoterapia
Exposicion OxigenoterapiaExposicion Oxigenoterapia
Exposicion Oxigenoterapia
 
Oxigenoterapia
OxigenoterapiaOxigenoterapia
Oxigenoterapia
 
Oxigenoterapia
OxigenoterapiaOxigenoterapia
Oxigenoterapia
 
Web Form Design Best Practices
Web Form Design Best Practices Web Form Design Best Practices
Web Form Design Best Practices
 
Aspiracion Secreciones
Aspiracion SecrecionesAspiracion Secreciones
Aspiracion Secreciones
 
Aspiracion de secreciones
Aspiracion de secrecionesAspiracion de secreciones
Aspiracion de secreciones
 

Ähnlich wie HTML5 Web Forms

We9 Struts 2.0
We9 Struts 2.0We9 Struts 2.0
We9 Struts 2.0
wangjiaz
 
Php Basic Security
Php Basic SecurityPhp Basic Security
Php Basic Security
mussawir20
 
Getting the Most Out of OpenSocial Gadgets
Getting the Most Out of OpenSocial GadgetsGetting the Most Out of OpenSocial Gadgets
Getting the Most Out of OpenSocial Gadgets
Atlassian
 

Ähnlich wie HTML5 Web Forms (20)

KMUTNB - Internet Programming 3/7
KMUTNB - Internet Programming 3/7KMUTNB - Internet Programming 3/7
KMUTNB - Internet Programming 3/7
 
Lecture3
Lecture3Lecture3
Lecture3
 
JSP Custom Tags
JSP Custom TagsJSP Custom Tags
JSP Custom Tags
 
Quick Referance to WML
Quick Referance to WMLQuick Referance to WML
Quick Referance to WML
 
Forum Presentation
Forum PresentationForum Presentation
Forum Presentation
 
Lecture 2 - Comm Lab: Web @ ITP
Lecture 2 - Comm Lab: Web @ ITPLecture 2 - Comm Lab: Web @ ITP
Lecture 2 - Comm Lab: Web @ ITP
 
We9 Struts 2.0
We9 Struts 2.0We9 Struts 2.0
We9 Struts 2.0
 
JQuery 101
JQuery 101JQuery 101
JQuery 101
 
ASP_NET Features
ASP_NET FeaturesASP_NET Features
ASP_NET Features
 
Php Basic Security
Php Basic SecurityPhp Basic Security
Php Basic Security
 
Zend framework 04 - forms
Zend framework 04 - formsZend framework 04 - forms
Zend framework 04 - forms
 
Ajax ons2
Ajax ons2Ajax ons2
Ajax ons2
 
Getting the Most Out of OpenSocial Gadgets
Getting the Most Out of OpenSocial GadgetsGetting the Most Out of OpenSocial Gadgets
Getting the Most Out of OpenSocial Gadgets
 
Microsoft ASP.NET 4.0 : What's Next?
Microsoft ASP.NET 4.0 : What's Next?Microsoft ASP.NET 4.0 : What's Next?
Microsoft ASP.NET 4.0 : What's Next?
 
Everything You Always Wanted To Know About XML But Were Afraid To Ask
Everything You Always Wanted To Know About XML But Were Afraid To AskEverything You Always Wanted To Know About XML But Were Afraid To Ask
Everything You Always Wanted To Know About XML But Were Afraid To Ask
 
Grddl In A Nutshell V1
Grddl In A Nutshell V1Grddl In A Nutshell V1
Grddl In A Nutshell V1
 
Web APIs & Google APIs
Web APIs & Google APIsWeb APIs & Google APIs
Web APIs & Google APIs
 
Front End on Rails
Front End on RailsFront End on Rails
Front End on Rails
 
From "Username and Password" to InfoCard
From "Username and Password" to InfoCardFrom "Username and Password" to InfoCard
From "Username and Password" to InfoCard
 
Terms of endearment - the ElasticSearch Query DSL explained
Terms of endearment - the ElasticSearch Query DSL explainedTerms of endearment - the ElasticSearch Query DSL explained
Terms of endearment - the ElasticSearch Query DSL explained
 

Kürzlich hochgeladen

+971581248768>> SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHA...
+971581248768>> SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHA...+971581248768>> SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHA...
+971581248768>> SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHA...
?#DUbAI#??##{{(☎️+971_581248768%)**%*]'#abortion pills for sale in dubai@
 

Kürzlich hochgeladen (20)

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...
 
The 7 Things I Know About Cyber Security After 25 Years | April 2024
The 7 Things I Know About Cyber Security After 25 Years | April 2024The 7 Things I Know About Cyber Security After 25 Years | April 2024
The 7 Things I Know About Cyber Security After 25 Years | April 2024
 
Apidays New York 2024 - Scaling API-first by Ian Reasor and Radu Cotescu, Adobe
Apidays New York 2024 - Scaling API-first by Ian Reasor and Radu Cotescu, AdobeApidays New York 2024 - Scaling API-first by Ian Reasor and Radu Cotescu, Adobe
Apidays New York 2024 - Scaling API-first by Ian Reasor and Radu Cotescu, Adobe
 
How to Troubleshoot Apps for the Modern Connected Worker
How to Troubleshoot Apps for the Modern Connected WorkerHow to Troubleshoot Apps for the Modern Connected Worker
How to Troubleshoot Apps for the Modern Connected Worker
 
presentation ICT roal in 21st century education
presentation ICT roal in 21st century educationpresentation ICT roal in 21st century education
presentation ICT roal in 21st century education
 
TrustArc Webinar - Stay Ahead of US State Data Privacy Law Developments
TrustArc Webinar - Stay Ahead of US State Data Privacy Law DevelopmentsTrustArc Webinar - Stay Ahead of US State Data Privacy Law Developments
TrustArc Webinar - Stay Ahead of US State Data Privacy Law Developments
 
Exploring the Future Potential of AI-Enabled Smartphone Processors
Exploring the Future Potential of AI-Enabled Smartphone ProcessorsExploring the Future Potential of AI-Enabled Smartphone Processors
Exploring the Future Potential of AI-Enabled Smartphone Processors
 
Developing An App To Navigate The Roads of Brazil
Developing An App To Navigate The Roads of BrazilDeveloping An App To Navigate The Roads of Brazil
Developing An App To Navigate The Roads of Brazil
 
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
 
A Year of the Servo Reboot: Where Are We Now?
A Year of the Servo Reboot: Where Are We Now?A Year of the Servo Reboot: Where Are We Now?
A Year of the Servo Reboot: Where Are We Now?
 
Bajaj Allianz Life Insurance Company - Insurer Innovation Award 2024
Bajaj Allianz Life Insurance Company - Insurer Innovation Award 2024Bajaj Allianz Life Insurance Company - Insurer Innovation Award 2024
Bajaj Allianz Life Insurance Company - Insurer Innovation Award 2024
 
Scaling API-first – The story of a global engineering organization
Scaling API-first – The story of a global engineering organizationScaling API-first – The story of a global engineering organization
Scaling API-first – The story of a global engineering organization
 
Axa Assurance Maroc - Insurer Innovation Award 2024
Axa Assurance Maroc - Insurer Innovation Award 2024Axa Assurance Maroc - Insurer Innovation Award 2024
Axa Assurance Maroc - Insurer Innovation Award 2024
 
Strategies for Landing an Oracle DBA Job as a Fresher
Strategies for Landing an Oracle DBA Job as a FresherStrategies for Landing an Oracle DBA Job as a Fresher
Strategies for Landing an Oracle DBA Job as a Fresher
 
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
 
Apidays New York 2024 - The value of a flexible API Management solution for O...
Apidays New York 2024 - The value of a flexible API Management solution for O...Apidays New York 2024 - The value of a flexible API Management solution for O...
Apidays New York 2024 - The value of a flexible API Management solution for O...
 
A Domino Admins Adventures (Engage 2024)
A Domino Admins Adventures (Engage 2024)A Domino Admins Adventures (Engage 2024)
A Domino Admins Adventures (Engage 2024)
 
How to Troubleshoot Apps for the Modern Connected Worker
How to Troubleshoot Apps for the Modern Connected WorkerHow to Troubleshoot Apps for the Modern Connected Worker
How to Troubleshoot Apps for the Modern Connected Worker
 
GenAI Risks & Security Meetup 01052024.pdf
GenAI Risks & Security Meetup 01052024.pdfGenAI Risks & Security Meetup 01052024.pdf
GenAI Risks & Security Meetup 01052024.pdf
 
+971581248768>> SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHA...
+971581248768>> SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHA...+971581248768>> SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHA...
+971581248768>> SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHA...
 

HTML5 Web Forms

  • 1. Web Forms 2.0 New form elements & Attributes in HTML5 Estelle Weyl www.Standardista.com@estellevw
  • 2.
  • 3. HTML 4 <Input> Types button checkbox file hidden image password radio reset submit text <input type="…
  • 4. <Input> Types New in HTML5 color date datetime datetime-local email month number range search tel time url week
  • 5. <Input> Attributes in HTML4 name disabled* type maxlength readonly size value alt src height width checked* align * CSS pseudoclasses
  • 6. New <Input> Attributes in HTML5 form readonly autocomplete autofocus list pattern required placeholder multiple list min max step formaction formenctype formmethod formtarget formnovalidate
  • 7. Other Form Elements New <datalist> <output> <meter> <progress> <keygen> Old <form> <fieldset> <legend> <textarea> <label> <select> <option> <optgroup>* * Optgroups are nestable in HTML5
  • 8. <p> <label for="inputID">Label: </label> <input id="inputID" name="inputName" type="text" /> </p>
  • 9. Attribute Soup! <p> <label for="inputID">Label: </label> <input id="inputID" name="inputName" placeholder="placeholder text" pattern="{6,9}" required autofocus type="text" /> </p> http://standardista.com/webkit/ch4/input.html
  • 10. <label> <p> <label for="inputID">Label: </label> <input id="inputID" name="inputName" placeholder="placeholder text" pattern="{6,9}" required autofocus type="text" /> </p>
  • 11. Placeholder Attribute <p> <label for="inputID">Label: </label> <input id="inputID" name="inputName" placeholder="placeholder text" pattern="{6,9}" required autofocus type="text" /> </p> 4
  • 12. Graceful Degredation $("input[placeholder]").each(function(){ if($(this).val()==""){ $(this).val($(this).attr("placeholder")); $(this).focus(function(){ if($(this).val()==$(this).attr("placeholder")) $(this).val(""); }); $(this).blur(function(){ if($(this).val()==""){ $(this).val($(this).attr("placeholder")); } }); } }); // on submit ensure: $(this).val() != $(this).attr("placeholder"))
  • 13. Pattern Attribute <p> <label for="inputID">Label: </label> <input id="inputID" name="inputName" placeholder="placeholder text" pattern="{6,9}" required autofocus type="text" /> </p>
  • 14. Required Attribute <p> <label for="inputID">Label: </label> <input id="inputID" name="inputName" placeholder="placeholder text" pattern="{6,9}" required autofocus type="text" /> </p>
  • 15. Graceful Degredation Without Touching HTML! // use regExp from pattern to validate! // if has attribute required, can not be empty.
  • 16. Targeting In CSS Without Touching HTML! :default :valid :invalid :in-range :out-of-range :required :optional :read-only :read-write input[type=checkbox] input[required] input:not([required])
  • 17. Autofocus Attribute <p> <label for="inputID">Label: </label> <input id="inputID" name="inputName" placeholder="placeholder text" pattern="{6,9}" required autofocus type="text" /> </p>
  • 18. Type Attribute <p> <label for="inputID">Label: </label> <input id="inputID" name="inputName" placeholder="placeholder text" pattern="{6,9}" required autofocus type="text" /> </p>
  • 19. HTML 4 <Input> Types button- checkbox. file* hidden image. password. radio reset- submit text
  • 20. 13 New <Input> Types in HTML5 color url tel email number range search date datetime datetime-local month time week
  • 22. Color on Blackberry Color: <input type="color" id="txtColor" value="#FF0000"/>
  • 23. color <input type="color" pattern="#[a-fA-F0-9]{6}" <input id="color" name="color" type="color" placeholder="#FFFFFF" pattern="#(?:[0-9A-Fa-f]{6}|[0-9A-Fa-f]{3})" required /> http://standardista.com/webkit/ch4/color.html
  • 25. URL <input id="url" name="url" type="url" placeholder="http://www.x.com" pattern="^http(s)?://.*" required /> http://standardista.com/webkit/ch4/url.html
  • 27. <p> <label for="url">Web Address: </label> <input id="url" name="url" type="url" placeholder="http://www.domain.com" required list="mydatalist"/ > </p> <datalist id="mydatalist"> <option value="http://www.standardista.com"/> <option value="http://www.apress.com" /><option value="http://www.evotech.net" /> </datalist>   http://standardista.com/webkit/ch4/datalist.html
  • 28. <datalist id="mydatalist"> <option value="http://www.standardista.com" label="standardista" /> <option value="http://www.apress.com" label="apress" /> <option value="http://www.evotech.net" label="Evotech"/> </datalist>   http://standardista.com/webkit/ch4/datalist.html
  • 29. <p> <label for="url">Web Address:</label> <input id="url" name="url" type="url" placeholder="http://www.domain.com" list="datalist" /> </p> <datalist id="datalist"> <label>or select one from the following list: <select name="url4"> <option value="http://www.standardista.com" /> <option value="http://www.apress.com" /> <option value="http://www.evotech.net" /> </select> </label> </datalist> http://standardista.com/webkit/ch4/datalist.html
  • 30.
  • 31. Phone Numbers <input type="tel" …>
  • 32. Phone Numbers <input type="tel" …>
  • 33. Phone Numbers <label for="tel">Telephone: </label> <input id="tel" type="tel" name="tel" placeholder="XXX-XXX-XXXX" pattern="[0-9]{3}-[0-9]{3}-[0-9]{4}" required /> http://standardista.com/webkit/ch4/phone.html
  • 34. Email Addresses <label for="email">Email: </label> <input id="email" name="email" type="email" placeholder="you@domain.com" multiple required /> http://standardista.com/webkit/ch4/email.html
  • 36. Number <input name="n" type="number"/> min max step http://standardista.com/webkit/ch4/number.html
  • 37. <inputid="nickels" name="nickels" type="number" placeholder="0, 5, 10 &hellip;" pattern="[0-9]*[05]" min="0" max="1000" step="5" required /> http://standardista.com/webkit/ch4/number.html safari
  • 38. <inputid="nickels" name="nickels" type="number" placeholder="0, 5, 10 &hellip;" pattern="[0-9]*[05]" min="0" max="1000" step="5" required /> Because all presentations are better with cats and unicorns http://standardista.com/webkit/ch4/number.html
  • 40. Range <input id="range" name="range" type="range" placeholder="0 to 10" pattern="[0-9]|10" min="0" max="10" step="1" required /> http://standardista.com/webkit/ch4/range.html
  • 41. Search <input id="search" name="search" type="search" placeholder="search terms" required /> http://standardista.com/webkit/ch4/search.html
  • 42. Date Time <Input> Types date 2010-08-26 datetime 2010-08-26 19:00 datetime-local 2010-08-26 19:00 month 2010-08 time 19:00 week 2010-W34
  • 43. Date Time <Input> Types date http://www.standardista.com/webkit/ch4/date.html datetimehttp://www.standardista.com/webkit/ch4/datetime.html datetime-localhttp://www.standardista.com/webkit/ch4/datetime-loca.html month http://www.standardista.com/webkit/ch4/month.html Timehttp://www.standardista.com/webkit/ch4/time.html weekhttp://www.standardista.com/webkit/ch4/month.html
  • 44.
  • 45. Other Attributes Form Autofocus Autocomplete
  • 46. Other Elements <meter> <progress> <keygen> <output>

Hinweis der Redaktion

  1. Stylizable
  2. Unchecked checkboxes are omitted from the data submitted by the form.   Might be worth clarifying that &quot;unchecked checkboxes are omitted from the data submitted by the form.&quot; This wording makes it sound like any unchecked checkbox prevents form data submission. It caught me off guard when I read that.File does not work on iPhone / iPod /iPadWhen using password, use post.Image = like sumbitButton = nothing -&gt; needs js to do anythingReset can lead to bad User experience
  3. Unchecked checkboxes are omitted from the data submitted by the form.   Might be worth clarifying that &quot;unchecked checkboxes are omitted from the data submitted by the form.&quot; This wording makes it sound like any unchecked checkbox prevents form data submission. It caught me off guard when I read that.File does not work on iPhone / iPod /iPadWhen using password, use post.Image = like sumbitButton = nothing -&gt; needs js to do anythingReset can lead to bad User experience
  4. Unchecked checkboxes are omitted from the data submitted by the form.   Might be worth clarifying that &quot;unchecked checkboxes are omitted from the data submitted by the form.&quot; This wording makes it sound like any unchecked checkbox prevents form data submission. It caught me off guard when I read that.File does not work on iPhone / iPod /iPadWhen using password, use post.Image = like sumbitButton = nothing -&gt; needs js to do anythingReset can lead to bad User experience
  5. Hexadecimal 6 char or keyword color only