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.

18,287 thoughts on “Play Framework HTML5 input elements

  1. kaspa wallet helps users store, send, and receive digital
    payments safely. kaspa wallet app offers fast access,
    smooth performance, strong security, and simple
    account management.

  2. We are a group of volunteers and starting a brand new scheme in our community.
    Your website offered us with helpful information to work on. You have performed a formidable job and
    our entire group might be thankful to you.

  3. I have been exploring for a bit for any high-quality articles
    or weblog posts on this sort of house . Exploring in Yahoo I finally stumbled upon this
    site. Studying this information So i’m happy to exhibit that I have a very good uncanny feeling I discovered
    just what I needed. I such a lot surely will make sure to
    do not disregard this website and provides it a glance on a continuing
    basis.

  4. Every weekend i used to go to see this site, for the reason that i want enjoyment, as this this web site conations in fact good funny stuff too.

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

  6. Wow that was strange. I just wrote an very long comment but
    after I clicked submit my comment didn’t show up. Grrrr…
    well I’m not writing all that over again. Regardless, just wanted to say
    excellent blog!

  7. avalanche web wallet login and setup guide helps users
    access Core App quickly with simple steps for safe
    and easy online account use today experience

  8. Dedinitely believe tjat whbich you stated. Your favoorite reason appeazred tto
    be oon tthe nett thee easist thinjg too bee awae of.
    I saay too you, I certaijly gett ireked whiule peoplle think about worrries thawt they jusxt do nnot now about.
    You maaged tto hitt the nail upoin thee top annd defied outt thee whjole thinjg withouit having sidde efffect , peoole could take a signal.

    Willl likesly bbe back tto get more. Thanks

  9. Fantastic blog! Do you have any hints for aspiring writers?
    I’m hoping to start my own site soon but I’m a
    little lost on everything. Would you suggest starting
    with a free platform like WordPress or go for a paid option? There are so many options
    out there that I’m completely overwhelmed .. Any suggestions?
    Bless you!

  10. I am now not positive where you’re getting your information, however great
    topic. I needs to spend some time learning more or working out more.
    Thank you for great info I was in search of this info for my mission.

  11. Why visitors still use to read news papers when in this
    technological globe everything is accessible on web?

  12. My spouse and I stumbled over here from a different website and thought I might as well check things out.
    I like what I see so now i’m following you. Look forward to
    looking over your web page for a second time.

  13. Wow that was strange. I just wrote an very long comment but after
    I clicked submit my comment didn’t appear. Grrrr…
    well I’m not writing all that over again. Regardless,
    just wanted to say great blog!

  14. Wow, superb weblog layout! How lengthy have you been blogging for?
    you made blogging look easy. The overall glance of your
    web site is fantastic, let alone the content material!

  15. Can I simply just say what a relief to uncover somebody who genuinely understands what they are talking about on the web.
    You certainly understand how to bring an issue
    to light and make it important. More and more people ought to read this and understand this side of the story.

    I was surprised you are not more popular since you surely
    have the gift.

  16. It’s a pity you don’t have a donate button! I’d most certainly donate to this brilliant blog! I guess for now i’ll settle for book-marking and adding your RSS feed to my Google account. I look forward to brand new updates and will talk about this blog with my Facebook group. Chat soon!

  17. This big need just mosts likely to show how much individuals worth
    keeping their smiles looking their ideal.

  18. O cara de ti com a planilha perdeu R$300 fazendo chasing no Prosperity Gods Book, postou o comprovante, assumiu. Respeito.

  19. Вот детальный анализ по вопросу
    грамотного контроля ремонтно-строительными
    процессами. Представленный материал
    раскрывает важные методы надзора на любом заключении выполнения здания.

  20. Hi, I think your blog might be having browser compatibility issues.
    When I look at your blog site in Ie, it looks fine but when opening in Internet Explorer, it has some overlapping.
    I just wanted to give you a quick heads up! Other then that, great blog!

  21. I just could not leave your site prior to suggesting
    that I extremely loved the standard information a person provide on your guests?
    Is going to be back ceaselessly to investigate cross-check new posts

  22. I’ve been surfing online more than three hours today, yet I by no means found any interesting article like
    yours. It is beautiful worth enough for me. Personally, if
    all webmasters and bloggers made just right content as you did,
    the web will be a lot more useful than ever before.

  23. Buscas long-tail em Santa’s Gift Rush ficaram mais específicas em 2026. Galera pede variância, não vibes.

  24. Howdy would you mind letting me know which webhost you’re utilizing?
    I’ve loaded your blog in 3 different internet browsers and I must say this blog loads a lot quicker then most.
    Can you suggest a good web hosting provider at a fair price?
    Kudos, I appreciate it!

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>