Quick Tip: New HTML5 Form Features
videos

Quick Tip: New HTML5 Form Features

Tutorial Details
  • Topic: HTML5 Forms
  • Difficulty: Easy
  • Estimated Completion Time: 4 Minute Video
This entry is part 3 of 14 in the HTML5 and You Session
« PreviousNext »

In this screencast, we’ll take a quick look at a few new HTML5 features: the placeholder and autofocus tools, as well as the email and URL input types.


Thanks for watching!

Add Comment

Discussion 55 Comments

  1. Scott Corgan says:

    If HTML5 would have been supported 10 years ago, we just have finally acheived a part of the greatest of the potential of the web…

  2. Gavin says:

    Really great screencast and tips!

    You demonstrated the email input there, and the warning that popped up.

    Is that error/warning message editable/set using the css? whats the field for that?
    Thanks

    • Grant Derderian says:
      Author

      I don’t think it’s editable using CSS because it’s generated directly by the browser. But, there are some JS UI libraries which enable you to add custom errors and styling: http://bit.ly/bBhBSj

      Thanks for the feedback!

  3. Aziz Light says:

    Nice tips!

    However, I find it odd that you used an XHTML 1.0 Strict Doctype while demo-ing HTML 5 features…

  4. trgy says:

    Hi! I am form Turkey. I can’t watch this video, because Turkish Government banned youtube’s ip. Please upload another video services.

  5. MonitoJoomla says:

    I like this in HTML5:

    But now you have to use javascript

    Thanks for sharing

  6. MonitoJoomla says:

    ups, the comment system doesn’t allow html

    <input type="password" name="firstname" placeholder="john" />

  7. OnYx says:

    is it me or the video no longer plays?

  8. Where do you get the iPhone emulator?? That would be really handy!

    Nice tut, greatly appreciated.

  9. Very neat HTML5 tip. Amazing what you can do with these new features once all browsers support it. Does Android OS recognize the email field like the iPhone OS – just curious

  10. From what I can tell autofocus appears to be a boolean so one would assume that the proper way to use it would be to assign a value of “true” just like other boolean attributes. However it does not seem to respond to ‘true’ or ‘false’. Rather it applies focus to the last element on the page with the autofocus attribute. This is logical because only one element can have focus at a time, but it seems to go against the HTML way of doing things. Anyone have more information?

    • Dan Harper says:

      I’m 99% sure if you want to use a field=”value” style syntax you use: autofocus=”autofocus” – the same way you would check a checkbox with checked=”checked”.

      But in HTML5 it’s just putting “autofocus” as Grant did in the video is perfectly standard mark-up.

  11. A reader says:

    Where’s the textual representation of this quick tip? JEFFR-

  12. John says:

    I think if you had to use a value for the “autofocus” attribute, it would also be autofocus. If you remember how to have something preselected in a select list, its just selected=”selected.” I would assume the same applies here?

  13. Kineri says:

    Nice tips, but you forgot to say that the “url” input will only submit if the value match the regular URLs pattern (http:// etc)

  14. Angry says:

    Please upload to Screenr

  15. What about the Date type?

    • Grant Derderian says:
      Author

      That was in the original draft for the screencast, although there wasn’t enough time left to stick that in (Screenr has a five minute time limit) . Maybe next time ;)

  16. Jose Perales says:

    Good!!! Quick tip and Good for save time.

  17. Sunny Singh says:

    Nice tips but you should be using and quotes for attributes that don’t necessarily need them, like autofocus=”autofocus”

    • Shane says:

      This is valid HTML5, as are upper case tags and so on. Personally, I’ll continue to use a stricter markup style, but this more ‘relaxed’ style is perfectly valid.

  18. Rory says:

    What happens with the URL and Email fields in browsers that don’t support HTML5? How do those older browsers handle these new input types?

  19. Martin says:

    Excellent tut. Thanks!

  20. Very nice. I wish those features were supported in all browsers.

    • Give it time. How long have we been wishing for the death of IE6? Now, it’s nearly dead! It is our job as designers and developers to really push the new technology and create a demand for browsers to use it.

  21. Seth Etter says:

    Good information, very useful. I like that HTML5 is implementing a lot of small and simple features that greatly increase the way these tags are used.

  22. Any thoughts on time line to complete HTML5 spec? Plus or minus 25 years.

  23. Jacob Dubail says:

    Great tip. Thanks. Can’t wait to see more browsers adopt more of these features. Too bad we can’t force our audience to upgrade…

  24. Andy says:

    When submitting the incorrect email in the form in Opera, since Opera is handling the error, what happens if you come to the page with a different browser? Does it allow the form to submit with an incorrect email? Do all browsers that support HTML5 handle this the same? If they don’t what happens when the page is visited by a browser that doesn’t support HTML5?

    Is it going to be a good idea to rely on the browser to validate our forms?

  25. Thomas says:

    I think it’s never a good idea to trust the browser with validating anything, javascript or the new HTML5 features. Javascript can be deactivated and HTML can be changed by the browser and especially with plugins like firebug.
    Validation in the browser is good for user comfort but not reliable.
    About browsers that don’t support HTML5: All inputs with a not recognized type will become text fields.

    I think I’ll be using these features but I think there should be a standard on how the error message is displayed and an easy way to change it.

  26. Amazing quick tip as usual! I’m starting to like these as much as / more than the actual tutorials. Keep it up!

  27. Evin says:

    Hi Envato,

    Recently I have started to see video posts rather than normal text posts. But this is not good for users who have a limited bandwidth internet connection or for some one who have slow internet.

    Envato has been pioneering in helping web developers and designers to get latest and updated news and tutorials etc and I have been a keen visitor to your sites for years.

    Now the video posts have started to annoy me by taking away my monthly bandwidth.

    I hope Envato will understand this issue and find a way out for this.

    Thanks.

  28. Arnab says:

    Really amazing quick tips …. as this will help me to take a step forward to HTML 5 ….

    Thanks

  29. burhan says:

    thanks very nice :D share

  30. Essex says:

    This is a excellent website, will you be involved in doing an interview regarding how you designed it? If so e-mail me!

  31. site ekle says:

    thank you for reel forever

  32. Thank you for writing was a beautiful illuminated

Add a Comment

To add a code snippet to your comment, please wrap your code like so: <pre name="code" class="html">YOUR CODE</pre>. You can replace the class name with "js," "css," "sql," or "php." If there are any "<" or ">" within your code, please search and replace them with: &lt; and &gt; respectively.