Play Framework HTML5 input elements

The built in Play input elements are fairly restrictive in that you can’t specify the input type. I wrote a helper template that you can use to generate input elements which have HTML5 type attributes such as url, email, number, search etc. etc.

All you have to do is call the template method, passing the HTML input type as a parameter. For example:

@helper.html5.input(form("website"), '_label -> "Website:", 'type -> "url")

If you have a form field mapped as a play.api.data.Forms.email then the template will automatically infer it’s type so you don’t have to pass the type attribute in with your html attributes:

@helper.html5.input(form("email"), '_label -> "Email:")

If your field has the required constraint, e.g. it is a “nonEmptyText” then the template will add the HTML5 “required” attribute to the field as well.

You can get the source code here.

330 thoughts on “Play Framework HTML5 input elements

  1. Hello there, I found your site via Google while searching for a related topic, your website came up, it looks good. I have bookmarked it in my google bookmarks.

  2. I do trust all the ideas you’ve presented in your post. They are very convincing and can certainly work. Still, the posts are too short for beginners. May just you please extend them a little from next time? Thanks for the post.

  3. I haven?t checked in here for a while since I thought it was getting boring, but the last few posts are good quality so I guess I will add you back to my everyday bloglist. You deserve it my friend :)

  4. In my opinion that a property foreclosures can have a significant effect on the borrower’s life. House foreclosures can have a 6 to ten years negative affect on a client’s credit report. A new borrower who may have applied for a mortgage or virtually any loans even, knows that a worse credit rating can be, the more tough it is to obtain a decent loan. In addition, it might affect a new borrower’s ability to find a good place to let or rent, if that results in being the alternative housing solution. Thanks for your blog post.

  5. Hey very cool site!! Man .. Beautiful .. Amazing .. I will bookmark your blog and take the feeds also?I am happy to find so many useful info here in the post, we need develop more strategies in this regard, thanks for sharing. . . . . .

  6. Wonderful blog! I found it while surfing around on Yahoo News. Do you have any tips on how to get listed in Yahoo News? I’ve been trying for a while but I never seem to get there! Cheers

  7. I think this is among the most important info for me. And i am glad reading your article. But should remark on some general things, The web site style is ideal, the articles is really nice : D. Good job, cheers

  8. Do you mind if I quote a few of your posts as long
    as I provide credit and sources back to your site? My website is in the very same area of interest as
    yours and my users would really benefit from a lot of the information you present here.
    Please let me know if this ok with you. Thanks!

  9. I?ve been exploring for a little bit for any high quality articles or blog posts on this sort of area . Exploring in Yahoo I at last stumbled upon this site. Reading this information So i?m happy to convey that I have an incredibly good uncanny feeling I discovered just what I needed. I most certainly will make sure to do not forget this website and give it a look on a constant basis.

  10. Thanks for every other wonderful post. Where else may anybody get that kind of information in such a perfect method of writing? I’ve a presentation subsequent week, and I am on the search for such information.

  11. We stumbled over here from a different web page and thought I may as well check things out. I like what I see so i am just following you. Look forward to looking into your web page repeatedly.

  12. Please let me know if you’re looking for a article author for your site. You have some really great posts and I believe I would be a good asset. If you ever want to take some of the load off, I’d love to write some articles for your blog in exchange for a link back to mine. Please blast me an email if interested. Kudos!

  13. I simply could not go away your site prior to suggesting that I extremely loved the usual info a person supply on your guests? Is gonna be back ceaselessly in order to investigate cross-check new posts

  14. It is my belief that mesothelioma will be the most dangerous cancer. It has unusual characteristics. The more I actually look at it the more I am certain it does not react like a true solid flesh cancer. In case mesothelioma is actually a rogue virus-like infection, in that case there is the probability of developing a vaccine and also offering vaccination to asbestos open people who are really at high risk of developing long term asbestos connected malignancies. Thanks for sharing your ideas about this important ailment.

  15. This is hands down one of the greatest articles I’ve read on this topic! The author’s extensive knowledge and passion for the subject shine through in every paragraph. I’m so appreciative for finding this piece as it has enriched my understanding and sparked my curiosity even further. Thank you, author, for dedicating the time to create such a remarkable article!

  16. I’m not sure exactly why but this weblog is loading extremely slow for me. Is anyone else having this issue or is it a problem on my end? I’ll check back later and see if the problem still exists.

  17. This design is incredible! You obviously know how to keep a reader amused. Between your wit and your videos, I was almost moved to start my own blog (well, almost…HaHa!) Wonderful job. I really loved what you had to say, and more than that, how you presented it. Too cool!

  18. naturally like your website but you have to check the spelling on several of your posts. Many of them are rife with spelling problems and I find it very troublesome to tell the truth nevertheless I?ll surely come back again.

  19. It?s actually a nice and useful piece of information. I?m glad that you shared this helpful info with us. Please stay us informed like this. Thanks for sharing.

  20. Today, taking into consideration the fast way of living that everyone leads, credit cards get this amazing demand in the economy. Persons from every discipline are using the credit card and people who aren’t using the card have arranged to apply for just one. Thanks for giving your ideas about credit cards.

  21. I’ve been browsing online more than three hours today, yet I never found any interesting article like yours. It?s pretty worth enough for me. In my opinion, if all site owners and bloggers made good content as you did, the net will be much more useful than ever before.

  22. Fantastic blog you have here but I was curious if you knew of any community forums that cover the same topics discussed here? I’d really love to be a part of online community where I can get feedback from other experienced individuals that share the same interest. If you have any recommendations, please let me know. Thanks!

  23. This is one of the best postings I’ve came across in quite a while. Good work.

  24. Valuable information. Lucky me I found your website by accident, and I’m shocked why this accident did not happened earlier! I bookmarked it.

  25. Hello there I am so delighted I found your weblog, I really found you by accident, while I was searching on Digg for something else, Nonetheless I am here now and would just like to say thank you for a marvelous post and a all round enjoyable blog (I also love the theme/design), I don’t have time to go through it all at the moment but I have book-marked it and also included your RSS feeds, so when I have time I will be back to read a lot more, Please do keep up the awesome job.

  26. Way cool! Some very valid points! I appreciate you writing
    this article and the rest of the site is really good.

  27. We absolutely love your blog and find a lot of your post’s to be precisely what I’m looking for. Would you offer guest writers to write content for you? I wouldn’t mind producing a post or elaborating on some of the subjects you write concerning here. Again, awesome web log!

  28. Thanks for your handy post. Through the years, I have come to be able to understand that the actual symptoms of mesothelioma are caused by the build up associated fluid relating to the lining of your lung and the upper body cavity. The condition may start within the chest region and pass on to other body parts. Other symptoms of pleural mesothelioma include weight-loss, severe respiration trouble, nausea, difficulty swallowing, and inflammation of the face and neck areas. It ought to be noted that some people living with the disease do not experience just about any serious indications at all.

  29. The next time I read a blog, I hope that it doesnt disappoint me as much as this one. I mean, I know it was my choice to learn, but I really thought youd have one thing fascinating to say. All I hear is a bunch of whining about something that you could fix when you werent too busy looking for attention.

Leave a Reply

Your email address will not be published. Required fields are marked *

You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>