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.

7,309 thoughts on “Play Framework HTML5 input elements

  1. Bariatric Jello Recipe (Learn The Full Recipe)

    This bariatric jello recipe is part of the viral gelatin trick recipe used for appetite control and
    portion awareness.

    In this short video, you’ll learn how the gelatin trick works, why it’s popular in bariatric routines, and how people use it
    before meals to support weight loss habits.

    This gelatin trick recipe is made with simple ingredients and is often used as a low-calorie, high-satiety option to help reduce overeating.

  2. Gelatin Weight Loss – What Is The Recipe For The Gelatin Trick To Lose Weight

    The gelatin trick recipe has gone viral as a simple pre-meal routine
    many people are talking about online. In this video, you’ll learn what the gelatin trick is, why
    it’s trending, and how the basic recipe is usually
    prepared.

    This gelatin trick is often mentioned in wellness communities as
    a mindful habit before meals.

  3. I was recommended this blog through my cousin. I’m now not certain whether
    or not this post is written by means of him as no one else realize such distinctive approximately my trouble.
    You’re incredible! Thanks!

  4. Au88 là sân chơi cá cược online hàng đầu, giữ vững thương
    hiệu số 1 với hệ thống pháp lý minh bạch và
    giải pháp bảo mật tiên tiến. Nền tảng mang đến tỷ lệ cược
    chuẩn, nhiều bộ môn thi đấu cùng dịch vụ nạp rút
    nhanh chóng. Với tầm nhìn dài hạn 2025, au88 cam kết xây dựng không gian giải trí chuyên nghiệp,
    trung thực và bền vững cho tất cả thành viên.

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>