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.

20,630 thoughts on “Play Framework HTML5 input elements

  1. Hi! I could hav worn I’ve beeen tto this weebsite efore but after reaading throuhgh somje
    off the posst I realized it’s neew too me. Anyhow, I’m dwfinitely hapy I fund itt annd I’ll be book-marking
    andd checking back frequently!

  2. Now I am ready to do my breakfast, later than having my breakfast coming yet again to read further news.

  3. When it pertains to divorce mediation prices, it is necessary to recognize what
    to expect.

  4. With havin so much written content do you ever run into any problems
    of plagorism or copyright infringement? My blog 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 permission. Do you know any ways
    to help prevent content from being stolen? I’d
    definitely appreciate it.

  5. Hi there! Someone in my Myspace group shared this website with us so I came to look it over.

    I’m definitely enjoying the information. I’m book-marking
    and will be tweeting this to my followers! Great blog and fantastic design and
    style.

  6. Dubai is song of the world’s outstrip real estate investment destinations, sacrifice
    dues advantages, energetic rental yields, and премиум
    lifestyle opportunities. From sybaritism villas to high-rise apartments, buying
    chattels in Dubai provides unequalled passive for both income and long-term
    top growth.

  7. It is perfect time to make some plans for the longer
    term and it’s time to be happy. I have read this put up and if I could I wish to counsel you few
    attention-grabbing things or advice. Maybe you can write subsequent articles regarding this article.
    I desire to learn even more issues about it!

  8. Hello would you mind stating which blog platform
    you’re working with? I’m looking to start my own blog
    in the near future but I’m having a difficult time choosing between BlogEngine/Wordpress/B2evolution and Drupal.
    The reason I ask is because your layout seems different then most blogs and
    I’m looking for something completely unique.
    P.S Apologies for getting off-topic but I had to ask!

    Also visit my web blog – serviço iptv portugal

  9. You’re so cool! I don’t suppose I’ve read through something like that before.
    So good to discover someone with unique thoughts on this subject.

    Seriously.. thanks for starting this up. This website is one
    thing that is needed on the web, someone with some originality!

  10. When thousands of fans chat in real time, manual moderation cannot keep up. Watchers uses multi-layered AI moderation to detect harmful behavior, protect personal data, block dangerous links, and identify bots or spam before they damage the fan experience. The system understands context, so it can separate emotional sports talk from real abuse. Build a fan zone that keeps the passion, protects your brand, and turns live chat into a product advantage.

  11. Asking questions are genuinely pleasant thing if you are
    not understanding something entirely, except this article gives good understanding
    even.

  12. Explore AU99 payment methods for deposits and withdrawals, including cards,
    bank transfer, Google Pay, Apple Pay, PayID, and cryptocurrency.

  13. Howdy! Do you know if they make any plugins to assist with Search
    Engine Optimization? I’m trying to get my blog to rank for some targeted keywords but I’m
    not seeing very good results. If you know of any please share.
    Cheers!

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>