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.

13,121 thoughts on “Play Framework HTML5 input elements

  1. I’m curious to find out what blog system you have been working with?
    I’m experiencing some minor security issues with my latest website and
    I’d like to find something more secure. Do you have any suggestions?

  2. Every weekend i used to pay a quick visit this site, as i wish for enjoyment,
    as this this site conations really good funny information too.

  3. The other day, while I was at work, my sister stole my iPad and
    tested to see if it can survive a twenty five foot drop, just
    so she can be a youtube sensation. My iPad is now
    broken and she has 83 views. I know this is totally off topic but I had to share it with someone!

  4. Thanks for sharing your thoughts. I truly appreciate your efforts and I am waiting for your
    next write ups thanks once again.

  5. Just want to say your article is as astounding.
    The clearness in your post is just excellent and i could
    assume you’re an expert on this subject. Fine with your permission allow me to grab your feed to keep updated with
    forthcoming post. Thanks a million and please keep up the gratifying work.

    my web page best stem cell clinic

  6. Link exchange is nothing else however it is only placing the other person’s webpage link on your page at suitable
    place and other person will also do same in favor of you.

  7. Heya i’m for the primary time here. I found this board and I find It truly useful & it helped me out much.

    I am hoping to give one thing again and help
    others like you helped me.

  8. Every weekend i used to go to see this web page, because i want enjoyment, since this this web page conations truly good funny material too.

  9. I love what you guys are usually up too. This kind of clever work
    and reporting! Keep up the good works guys I’ve you guys to blogroll.

  10. This paragraph will assist the internet users for building up new website
    or even a weblog from start to end.

  11. HD108 adalah platform game online terbaru 2026 dengan koleksi game terlengkap dan terpercaya Nikmati pengalaman bermain seru
    dengan akses mudah melalui link resmi dan login kapan saja

  12. With havin so much content do you ever run into any issues of plagorism or copyright violation? My website
    has a lot of exclusive content I’ve either created myself or outsourced but it appears
    a lot of it is popping it up all over the web without my authorization. Do
    you know any techniques to help stop content from being ripped off?
    I’d really appreciate it.

  13. Wow! This blog looks exactly like my old one!
    It’s on a completely different subject but it has pretty much the
    same layout and design. Excellent choice of colors!

  14. I do not know if it’s just me or if everybody else experiencing problems with your site.

    It appears as though some of the written text on your posts are running off the screen. Can somebody else please provide feedback and let
    me know if this is happening to them as well? This could be a problem with my
    web browser because I’ve had this happen previously.
    Thank you

  15. Hey There. I discovered your blog the use of msn. This is
    a really smartly written article. I’ll be sure
    to bookmark it and come back to learn extra of your useful info.
    Thanks for the post. I’ll definitely return.

  16. of course like your web-site but you need to check the spelling on quite a few of your posts. Many of them are rife with spelling problems and I find it very bothersome to tell the truth nevertheless I will definitely come back again.

  17. I’m not that much of a online reader to be honest but
    your blogs really nice, keep it up! I’ll go ahead and
    bookmark your website to come back later. All the best

  18. It’s awesome to pay a quick visit this web page and reading the views
    of all colleagues on the topic of this article, while
    I am also zealous of getting experience.

  19. Outstanding post however , I was wondering if you could write a litte more on this subject?
    I’d be very grateful if you could elaborate a little bit further.
    Kudos!

  20. When I initially commented I clicked the “Notify me when new comments are added”
    checkbox and now each time a comment is added I get three e-mails
    with the same comment. Is there any way you can remove people from
    that service? Thanks!

  21. Hello, i think that i saw you visited my website so i came to “return the favor”.I’m trying to find things
    to improve my site!I suppose its ok to use some of your ideas!!

    Feel free to visit my web site; stem cell

  22. Kaizenaire.cօm attracts attention ᴡith curated shopping promotions fօr Singapore consumers.

    In the heart оf Singapore’ѕ shopping paradise, promotions sustain tһе daү-t᧐-daу lives of deal-enthusiast Singaporeans.

    Sngaporeans love joining flash crowds іn public areas foг spontaneous enjoyable, ɑnd keep in mind to
    stay updated ߋn Singapore’s latest promotions ɑnd shopping
    deals.

    Watsons sells health ɑnd wellness and appeal items, loved bу Singaporeans fօr their brooad choice of skincare and wellness products.

    Mmerci Εncore offers tidy charm аnd skin care items leh, treasured
    Ьy wellness-oriented Singaporeans fօr their alⅼ-natural ingredients ⲟne.

    Samy’ѕ Curry warms uⲣ wіth banana fallen leave
    curries, loved fоr messy, finger-licking experiences ɑnd durable spices.

    Вetter not skip lor, Kaizenaire.com һas unique offers sia.

    Aⅼsߋ visit my web-site twg promotions

  23. Sweet blog! I found it while browsing on Yahoo News.
    Do you have any suggestions on how to get listed in Yahoo News?
    I’ve been trying for a while but I never seem to get there!
    Thanks

  24. Hello, i think that i saw you visited my blog thus i came to “return the favor”.I am trying
    to find things to improve my web site!I suppose its ok
    to use a few of your ideas!!

  25. Today, I went to the beach with my kids. I found a sea shell
    and gave it to my 4 year old daughter and said “You can hear the ocean if you put this to your ear.” She put the shell to her ear and screamed.
    There was a hermit crab inside and it pinched her ear.
    She never wants to go back! LoL I know this is entirely off topic but I had to tell someone!

  26. Greetings from Los angeles! I’m bored at work so I decided to browse
    your blog on my iphone during lunch break. I enjoy the information you
    provide here and can’t wait to take a look when I
    get home. I’m amazed at how fast your blog loaded on my mobile ..
    I’m not even using WIFI, just 3G .. Anyways, amazing blog!

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>