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.

16,606 thoughts on “Play Framework HTML5 input elements

  1. نتیجه‌گیری اینکه

    برای کسانی که میخوان

    کازینو اینترنتی

    می‌گردن

    این مجموعه آنلاین

    به خوبی میتونه

    کمک‌کننده باشه

    در ضمن

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

    enfejaronline جدید

    و

    sibbet جدید

    جایگاه خوبی دارن

    در آخر کار

    ازش راضی بودم

    و

    بدون تردید

    حتما برمی‌گردم

    my blog :: سلامت روان

  2. Hey there are using WordPress for your blog platform?
    I’m new to the blog world but I’m trying to get
    started and set up my own. Do you need any html coding expertise to make your own blog?
    Any help would be really appreciated!

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>