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

  1. At this time it sounds like Expression Engine is the top blogging platform available
    right now. (from what I’ve read) Is that what you’re using on your
    blog?

  2. Having read this I believed it was really informative. I appreciate you taking the time and energy to put
    this content together. I once again find myself spending way too much time both reading and posting comments.

    But so what, it was still worthwhile!

    my website; 마사지사이트

  3. Hello there! I could have sworn I’ve visited this site before but
    after looking at a few of the posts I realized it’s new to me.
    Nonetheless, I’m definitely delighted I came across it
    and I’ll be book-marking it and checking back frequently!

    Feel free to visit my site fat tire ebikes for sale

  4. Woah! I’m really loving the template/theme of this site.
    It’s simple, yet effective. A lot of times it’s very difficult to get
    that “perfect balance” between superb usability and appearance.

    I must say that you’ve done a great job with this. Additionally, the blog loads very fast for me on Internet explorer.
    Exceptional Blog!

    Here is my web-site: Online Mushroom Dispensary Canada

  5. What’s up everybody, here every one is sharing such know-how, thus
    it’s nice to read this website, and I used to
    visit this website daily.

  6. سلام و عرض ادب، بنده امروز اتفاقی تو اینترنت با این وبسایت برخوردم و راستش رو بخواید خیلی خوشم اومد.

    مطالبش کاربردی بود و کمتر همچین وبسایتی
    پیدا کنم. به نظرم برای خیلی‌ها ارزش دیدن داره.
    اگه دنبال اطلاعات کامل هستن حتما یه نگاهی بندازن.

    به طور کلی تجربه خوبی بود و احتمالا باز هم سر
    می‌زنم

    در جمع‌بندی کلی

    برای کسانی که

    سایت‌های شرطی

    قصد فعالیت دارن

    این صفحه

    به سادگی می‌تونه

    ارزش امتحان داشته باشه

    از سوی دیگر

    پروژه‌هایی مثل

    پلتفرم еnfejаronline

    و

    sibbet شناخته شده

    تجربه خوبی ارائه دادن

    جمع‌بندی اینکه

    تجربه مثبتی داشتم

    و

    در آینده نزدیک

    مراجعه مجدد دارم

    .

    Heere is my ρage: پشتیبانی سایت Bettime90

  7. American Industrial Magazine (americanindustrialmagazine.com) es un portal digital
    y publicación especializada (bilingüe
    en inglés y español) enfocada en proveer noticias, análisis de mercado y tendencias sobre los sectores
    de manufactura, industria, tecnología, metalmecánica
    y farmacéutica.

    Su contenido abarca temas estratégicos y técnicos que impactan a América
    del Norte (principalmente México y Estados Unidos), incluyendo el nearshoring,
    la adopción de inteligencia artificial en fábricas,
    robótica (cobots), control de calidad predictivo, normativas de seguridad (OSHA, ISO 9001) y la escasez de talento especializado.
    Además, funciona como una plataforma de desarrollo profesional, ofreciendo cursos de capacitación técnica en software como Microsoft
    Excel (desde nivel básico hasta macros) y Autodesk Fusion 360.

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>