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,478 thoughts on “Play Framework HTML5 input elements

  1. Incredible! This blog looks exactly like my old one!
    It’s on a completely different topic but it has pretty much the same page layout
    and design. Superb choice of colors!

  2. This is a very informative post about online casinos and betting platforms.

    I especially liked how it explains the importance of choosing a licensed site before
    signing up.

    Many players often ask where they can find reliable gaming platforms
    with fair odds and smooth payouts. From what I’ve seen, checking platforms
    like vn22vip helps users compare features, bonuses, and overall
    experience.

    Thanks for sharing these insights — they’re helpful for both beginners and experienced bettors.

  3. Admiring the hard work you put into your website and
    detailed information you present. It’s great to come across a
    blog every once in a while that isn’t the same out
    of date rehashed information. Wonderful read! I’ve saved your
    site and I’m adding your RSS feeds to my Google account.

  4. Heya i am for the first time here. I found this board and
    I find It truly useful & it helped me out much. I hope to give something back and
    aid others like you aided me.

  5. Hi there, I enjoy readinhg all of youur artiocle post.
    I wqnted tto wrikte a little omment too support you.

    Feeel fre too suirf tto myy weeb blog :: javkink.com

  6. Definitely imagine that which you stated.
    Your favorite reason seemed to be at the internet
    the simplest thing to be mindful of. I say to you, I certainly
    get annoyed at the same time as other people consider concerns that they plainly do not understand about.
    You controlled to hit the nail upon the highest as well as outlined out the
    entire thing without having side-effects , other people could
    take a signal. Will likely be back to get more.
    Thanks

  7. Wonderful website you have here but I was wondering if you knew of any discussion boards that cover the
    same topics talked about here? I’d really like to be a part of online community where I can get comments from other experienced individuals that share the same interest.
    If you have any recommendations, please let me know. Kudos!

  8. Почему пользователи выбирают площадку KRAKEN?

    Маркетплейс KRAKEN заслужил доверие
    многочисленной аудитории благодаря сочетанию ключевых факторов.
    Во-первых, это широкий и разнообразный ассортимент, представленный
    сотнями продавцов. Во-вторых, интуитивно понятный интерфейс KRAKEN, который упрощает навигацию,
    поиск товаров и управление заказами
    даже для новых пользователей.
    В-третьих, продуманная система безопасных транзакций,
    включающая механизмы разрешения споров
    (диспутов) и возможность использования
    условного депонирования, что минимизирует риски для обеих сторон сделки.
    На KRAKEN функциональность сочетается с
    внимательным отношением к безопасности клиентов, что делает процесс покупок более предсказуемым, защищенным и, как следствие, популярным среди пользователей, ценящих анонимность
    и надежность.

  9. I’m gone to inform my little brother, that he should also pay a quick visit this
    webpage on regular basis to obtain updated from most up-to-date news
    update.

  10. Hmm it seems like your blog ate my first comment (it was extremely long) so
    I guess I’ll just sum it up what I had written and say, I’m
    thoroughly enjoying your blog. I too am an aspiring blog blogger but I’m still new
    to everything. Do you have any suggestions for rookie blog
    writers? I’d genuinely appreciate it.

  11. Thanks on your marvelous posting! I actually enjoyed reading it, you
    could be a great author. I will be sure to bookmark your
    blog and definitely will come back in the future.
    I want to encourage you to definitely continue your great job, have a
    nice holiday weekend!

  12. Greetings from Ohio! I’m bored to death at work so I decided to browse your blog on my iphone during lunch
    break. I really like the info you present here and can’t wait to take a look when I get home.
    I’m surprised at how fast your blog loaded on my cell phone ..

    I’m not even using WIFI, just 3G .. Anyways, very good site!

  13. Pretty component of content. I just stumbled upon your blog and in accession capital to assert that I acquire in fact
    enjoyed account your weblog posts. Any way I’ll be subscribing to your feeds and even I fulfillment
    you get right of entry to constantly rapidly.

  14. Hello there, You’ve done a fantastic job.
    I will definitely digg it and personally recommend to my
    friends. I’m sure they will be benefited from this web site.

  15. You ought to take part in a contest for one of the
    best sites on the net. I will recommend this website!

  16. I think this is among the most vital info for me.
    And i am glad reading your article. But wanna remark on some general things, The web site style
    is wonderful, the articles is really great : D.
    Good job, cheers

    Here is my web-site; allstarvegas

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>