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

  1. Процедура капельницы от похмелья с контролем врача в Самаре начинается с первичной консультации на которой врач осматривает пациента измеряет его основные показатели давление пульс температуру и оценивает общее состояние. На основе этих данных выбирается оптимальный состав капельницы которая может включать в себя различные компоненты такие как солевые растворы витамины антиоксиданты и медикаменты для снятия симптомов похмелья. Выяснить больше – капельница от похмелья цена самара

  2. Good day! I know this is kinda off topic
    but I was wondering which blog platform are you using for this site?
    I’m getting fed up of WordPress because I’ve had issues with hackers and I’m looking at options for another platform.
    I would be fantastic if you could point me in the direction of a good platform.

  3. You really make it appear really easy along with your presentation however I in finding this topic to be actually one thing which I feel
    I’d by no means understand. It kind of feels too complex and
    extremely large for me. I am taking a look ahead in your subsequent publish,
    I will attempt to get the hold of it!

  4. Greetings from Carolina! I’m bored at work so I decided to check out your website on my iphone during lunch break.
    I enjoy the knowledge you provide here and can’t wait to
    take a look when I get home. I’m surprised at how fast your blog
    loaded on my phone .. I’m not even using WIFI, just 3G
    .. Anyhow, awesome blog!

  5. Kaizenaire.ⅽom accumulations Singapore’ѕ finest promotions,
    mаking іt the supreme website fοr deals ɑnd occasions from toρ companies.

    Singapore’ѕ popularity ɑѕ a shopping area is boosted Ƅy locals’ love for deals.

    Attending art workshops іn galleries stimulates creativity іn imaginative Singaporeans, аnd bear in mind tо stay upgraded on Singapore’ѕ most
    current promotions and shopping deals.

    Frasers Property handles retail аnd household assets, adored ƅy Singaporeans for tһeir vivid shopping malls аnd neighborhood spaces.

    PropertyGuru lists property properties аnd consultatory
    services one, cherished ƅʏ Singaporeans fοr simplifying hօmе searches аnd market understandings mah.

    Fei Siong Ԍroup runs restaurants likke Nam Sing Hokkien Mee, loved fοr hawker faves іn food courts.

    Eh, wһү not lah, Singaporeans ѕhould examine Kaizenaire.ϲom ԁay-to-day mah.

    my website: promotion

  6. Thanks a lot for sharing this with all people you actually understand what you’re
    speaking about! Bookmarked. Kindly also consult with my web
    site =). We will have a link change agreement between us

  7. Heya i’m for the first time here. I found this board
    and I find It really useful & it helped me out much.
    I’m hoping to offer one thing back and help others like you aided me.

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>