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.

16,546 thoughts on “Play Framework HTML5 input elements

  1. Nice post. I learn something new and challenging on blogs I stumbleupon on a daily basis.
    It’s always interesting to read articles from other writers and
    use a little something from their web sites.

  2. I’m no longer certain the place you are getting your info, but great topic.
    I needs to spend some time learning much more or understanding more.

    Thank you for wonderful information I used to be looking for this information for my mission.

  3. Hi are using WordPress for your site platform? I’m new to the blog world but I’m trying to get started and create my own. Do you require any coding knowledge to make your own blog?

    Any help would be greatly appreciated!

  4. Do you mind if I quote a couple of your posts as long as I provide credit
    and sources back to your webpage? My website is in the exact same
    niche as yours and my visitors would really benefit from a lot of the information you
    provide here. Please let me know if this okay with you.
    Thanks!

  5. This is a very informative post about online casinos and betting platforms.
    I especially liked how it explains the importance of choosing a secure site before registering.

    Many players often ask where to find reliable gaming platforms with fair odds and smooth withdrawals.
    In my experience, checking platforms like milyon88games.com helps users
    understand what features to look for in a legit online casino.

    Thanks for sharing these insights — they’re useful
    for both beginners and experienced players.

  6. 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
    made good content as you did, the internet will be a lot more useful.

    I often read your posts while analyzing top-tier platforms like keobongda.ru.com.
    Keep it up!
    |
    Howdy! Someone in my Telegram group shared this website so I came to check it out.
    I’m definitely loving the information. It’s as useful as the service I get at keobongda.ru.com.
    I’m bookmarking and will be sharing this with my followers who love
    football! Terrific blog!
    |
    Woah! I’m really digging the template of this website.
    It’s effective. It’s very hard to find a balance between user friendliness and
    visual appeal, but you’ve done it. The blog loads very fast, just like the keobongda.ru.com mobile interface.
    Exceptional Blog!
    |
    I just couldn’t go away your website prior to
    saying that I really loved the standard of information you provide
    for your guests. I’ll be again frequently to check new
    posts. This is a topic which is close to my heart, similar to how I feel about
    keobongda.ru.com! Many thanks!
    |
    Greetings! Very useful advice within this post! It’s the little changes which will
    make the most significant changes. Thanks a lot for sharing!
    By the way, for anyone looking for top football analysis,
    keobongda is certainly a great choice.

  7. Hi there would you mind sharing which blog
    platform you’re working with? I’m going to start my own blog soon but I’m having a hard time
    making a decision between BlogEngine/Wordpress/B2evolution and
    Drupal. The reason I ask is because your design seems different then most blogs
    and I’m looking for something completely unique.
    P.S My apologies for being off-topic but I had to ask!

  8. Great post. I used to be checking continuously this blog and I am inspired!

    Very useful info particularly the remaining part :) I deal with such info much.
    I was looking for this particular information for a long
    time. Thank you and best of luck.

  9. Hey there! Someone in my Facebook group shared
    this website with us so I came to look it over.

    I’m definitely enjoying the information.
    I’m bookmarking and will be tweeting this to my followers!
    Superb blog and outstanding design and style.

  10. Hello, i think that i noticed you visited my blog thus
    i came to go back the prefer?.I am trying to to find issues
    to enhance my web site!I suppose its good enough to use some of your concepts!!

  11. For most recent news you have to pay a visit world-wide-web and on internet I found this website as a most excellent website for hottest updates.

  12. My programmer is trying to convince me to move to .net from PHP.
    I have always disliked the idea because of the costs.
    But he’s tryiong none the less. I’ve been using Movable-type
    on a number of websites for about a year and am
    nervous about switching to another platform. I have heard
    fantastic things about blogengine.net. Is there a way I can import all my wordpress posts into it?
    Any kind of help would be greatly appreciated!

  13. Heya just wanted to give you a quick heads up and let you know a few of
    the pictures aren’t loading correctly. I’m not sure why but
    I think its a linking issue. I’ve tried it in two different internet browsers and both
    show the same results.

  14. I think that is among the most important info for me.
    And i’m glad studying your article. But want to
    observation on few normal issues, The web site style is great, the
    articles is really great : D. Just right activity, cheers

    Also visit my website – realtor in Gilbert AZ

  15. I was curious if you ever considered changing the page layout of your site?
    Its very well written; I love what youve got to say. But maybe you
    could a little more in the way of content so
    people could connect with it better. Youve got an awful lot of text for only having
    1 or two pictures. Maybe you could space it out better?

  16. bayar bayar bayar bayar bayar bayarbayar bayar bayar bayar bayar bayarbayar bayar bayar bayar bayar bayar bayar bayar
    bayar bayar bayar bayarbayar bayar bayar bayar bayar bayarbayar bayar bayar bayar bayar
    bayar bayar bayar bayar bayar bayar bayarbayar bayar bayar bayar
    bayar bayarbayar bayar bayar bayar bayar bayar bayar bayar bayar bayar bayar bayarbayar bayar
    bayar bayar bayar bayar

  17. Have you ever considered about adding a little bit more than just your articles?
    I mean, what you say is important and everything.
    But imagine if you added some great photos or video clips to give your posts more, “pop”!
    Your content is excellent but with images and clips,
    this website could definitely be one of the very best in its niche.

    Terrific blog!

  18. Excellent items from you, man. I’ve remember your stuff previous to and you’re just too
    magnificent. I really like what you’ve acquired right here, really like what you are
    stating and the way wherein you are saying it. You make it
    entertaining and you continue to care for to stay it wise.
    I can’t wait to read much more from you. That is actually a terrific web site.

    Feel free to visit my blog :: realtor in Palos Verdes CA

  19. Heya i’m for the first time here. I came across this board and I find It really useful
    & it helped me out a lot. I hope to give something back and help others
    like you aided me.

  20. You’re so awesome! I don’t suppose I’ve truly read anything like this before.
    So wonderful to discover somebody with some original thoughts on this subject matter.

    Really.. many thanks for starting this up. This web site is something that’s needed
    on the web, someone with a bit of originality!

  21. Does your blog have a contact page? I’m having problems locating
    it but, I’d like to shoot you an e-mail. I’ve got some creative ideas for your blog
    you might be interested in hearing. Either way, great blog and I look forward to seeing it expand over time.

  22. When someone writes an post he/she keeps the idea of a user
    in his/her brain that how a user can be aware of it.
    Therefore that’s why this article is outstdanding. Thanks!

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>