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

  1. I am in fact pleased to read this weblog posts which includes plenty
    of helpful facts, thanks for providing such statistics.

  2. Truly no matter if someone doesn’t understand afterward its up
    to other users that they will help, so here it occurs.

  3. I never imagined I’d say this at only 14, but life changes you after
    my dad turned his back on our family.

    We lived in a small district in Berlin and our house used to
    mean warmth. But when the bills started to overflow, we began to lose control.

    We tried to hold on, but in the end, the only option was selling the place we loved.

    Watching her fall apart made me feel older than I should be.
    I knew I couldn’t just sit there.

    I tried to understand what adults do when things get bad.
    That’s when I came across stories of people using cryptocurrencies and converting them safely into money through
    trusted platforms.

    I told my mother she could explore that—not because I understood everything,
    but because I wanted to help. She looked into it, researched for days, and eventually chose Paybis (Paybis).
    She said it felt clear and trustworthy.

    I still remember standing next to her during that first exchange.
    When it went through, we both let out a breath we didn’t know we were holding.

    From that moment, things slowly began to shift.
    My mom handled everything herself, but she always said my encouragement gave her courage.

    I learned that even kids can bring light into dark moments.

    Today, we’re healing slowly but steadily. And every time my mom looks
    at me and smiles, she reminds me how everything changed
    the day she found the strength to use Paybis to
    convert her crypto into something we could actually
    live on.

    Hope is the only thing that kept us moving.

  4. Greetings! I’ve been following your weblog for some time now and finally got
    the courage to go ahead and give you a shout out from Porter Texas!
    Just wanted to say keep up the great job!

  5. Nice post. I learn something new and challenging on blogs I stumbleupon on a daily basis.
    It will always be interesting to read through articles from other authors
    and use something from their websites.

  6. Good day I am so grateful I found your site, I really found
    you by error, while I was browsing on Digg for something else, Anyhow
    I am here now and would just like to say kudos for a remarkable post and a all round exciting blog
    (I also love the theme/design), I don’t
    have time to go through it all at the moment but I
    have bookmarked it and also added in your RSS feeds, so when I
    have time I will be back to read much more, Please do keep up the great jo.

    Stop by my web blog; online bloodborne pathogens training

  7. The dad who deposits r$20 for his kid’s school stuff only plays Prosperity Gods Book on Sundays. Says it pays better. We laughed, the data agrees.

  8. I’m truly enjoying the design and layout of
    your blog. It’s a very easy on the eyes which makes it much more pleasant for me to come
    here and visit more often. Did you hire out a designer to create your theme?
    Excellent work!

  9. CosmosHandpan specializes in handcrafted handpan instruments designed to create soothing, melodic, and atmospheric sound experiences.

    Their collection includes 10-inch compact handpans,
    12-inch versatile models, and 14-inch deep resonance instruments, all
    engineered for high-quality sound production and durability.

    The brand supports musicians at every stage with beginner-friendly
    handpans for easy learning, intermediate models for skill
    development, and professional-grade instruments for advanced musical performance.

    CosmosHandpan pan drums are widely used in meditation, yoga, sound therapy, and live music performances due
    to their calming tones and expressive sound range. Special editions like the 4th Anniversary Celebration handpan highlight the brand’s
    commitment to innovation and artistic excellence in modern handpan design.

  10. Greetings! This is my first visit to your blog!
    We are a team of volunteers and starting a new project in a community in the same
    niche. Your blog provided us useful information to work on. You have done a marvellous job!

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>