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.

17,312 thoughts on “Play Framework HTML5 input elements

  1. GemstoneRO Servers is one of the best Ragnarok Online private servers in 2026, offering two free RO servers: Renewal with EP21 Age of Heroes, chapter 1, chapter2 4th jobs, Doram, latest skills and mid rates, and Loki Pre-Renewal with classic gameplay, custom quests, unique gear and 100x rates. Play on PC or Android with an active global community, low-latency proxies, weekly updates and no paytowin. Join GemstoneRO and enjoy Ragnarok Online your way.

  2. Si buscas apuestas en Bolivia online, este sitio
    ofrece una guía completa para encontrar plataformas confiables
    y modernas. Apuesta in Bolivia reúne información sobre bonos de bienvenida, métodos de pago disponibles en Bolivia
    y las mejores oportunidades para apostar en eventos deportivos internacionales y locales.
    El contenido está diseñado para ayudar tanto a principiantes como a usuarios experimentados, proporcionando análisis, consejos y comparaciones detalladas.
    Además, el portal mantiene información actualizada para que
    los jugadores puedan tomar mejores decisiones al momento de apostar online.

  3. Hello there I am so excited I found your blog, I really found you
    by mistake, while I was researching on Bing for something else, Anyhow
    I am here now and would just like to say thanks
    a lot for a remarkable post and a all round thrilling blog (I
    also love the theme/design), I don’t have time to look over
    it all at the moment but I have saved it and also included your
    RSS feeds, so when I have time I will be back to read much more,
    Please do keep up the great b.

  4. Write more, thats all I have to say. Literally, it seems as though you relied on the video to make
    your point. You definitely know what youre talking about, why waste your intelligence on just posting videos to your
    blog when you could be giving us something enlightening to read?

  5. I don’t even know how I ended up here, but I thought this post was great.
    I don’t know who you are but definitely you are going
    to a famous blogger if you are not already ;) Cheers!

  6. Truly no matter if someone doesn’t understand
    after that its up to other viewers that they will help, so here it occurs.

  7. You really make it appear really easy together with
    your presentation however I find this matter to
    be actually something which I feel I would never understand.
    It seems too complicated and very extensive for me.
    I am taking a look ahead on your subsequent submit, I will try to get the hold of 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>