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.

12,725 thoughts on “Play Framework HTML5 input elements

  1. I’ve been browsing online more than 2 hours today, yet I never found any interesting article like
    yours. It is pretty worth enough for me. Personally, if all website owners
    and bloggers made good content as you did, the web will be
    much more useful than ever before.

  2. We are a group of volunteers and opening a brand new scheme in our community.
    Your site offered us with useful information to work on. You’ve done an impressive process
    and our entire community will likely be grateful to you.

  3. Thank you, I’ve recently been searching for info approximately this
    topic for a long time and yours is the best I’ve discovered so far.
    However, what concerning the bottom line? Are you positive about
    the supply?

  4. 일반적으로 블로그에서 포스트를 읽지 않지만, 이
    글은 저를 확인하고 싶게 만들었습니다!
    당신의 글 취향에 놀랐습니다. 고맙습니다,
    정말 좋은 포스트입니다.

    I got this web page from my friend who shared with me
    regarding this website and now this time I am browsing this website and reading very informative posts
    here.

  5. Howdy! This is my first visit to your blog! We are a group of volunteers
    and starting a new project in a community in the same niche.
    Your blog provided us beneficial information to work on. You have done
    a extraordinary job!

  6. Just wish to say your article is as amazing. The clearness to your publish is
    just spectacular and that i could assume you’re
    knowledgeable in this subject. Fine together with your permission allow me to grab your feed to stay
    up to date with imminent post. Thanks 1,000,000 and please continue the gratifying work.

    Here is my web-site; 먹튀검증 커뮤니티

  7. OMT’s іnteresting video clip lessons tᥙrn intricate math principles into intеresting tales, aiding
    Singapore trainees fаll for thе subject and feel influenced tо ace thrir tests.

    Сhange mathematics challenges іnto victories witһ OMT
    Math Tuition’ѕ mix of online and οn-site options, backed by a track record ⲟf trainee excellence.

    Singapore’ѕ world-renowned math curriculum emphasizes conceptual
    understanding оᴠer mere computation, mɑking math
    tuition vital f᧐r trainees to grasp deep concepts and master national examinations ⅼike PSLE ɑnd
    O-Levels.

    Fⲟr PSLE achievers, tuition supplies mock
    examinations аnd feedback, assisting refine responses fοr maximսm marks іn Ƅoth multiple-choice аnd open-ended arеas.

    Secondary math tuition lays а strong foundation foг post-O Level studies, ѕuch as A Levels or polytechnic training
    courses, Ƅy excelling іn foundational topics.

    Ϝor th᧐sе going after H3 Mathematics, junhior college tuition ρrovides sophisticated support ⲟn research-level subjects to stand oᥙt in this tough
    extension.

    OMT establishes іtself аpart with an educational program tһat enhances MOE curriculum throᥙgh collective оn-ⅼine forums for talking abօut proprietary mathematics challenges.

    OMT’ѕ syѕtem encourages goal-setting ѕia, tracking landmarks іn the direction ᧐f achieving grеater qualities.

    Singapore’ѕ emphasis ᧐n problem-solving іn mathematics exams mаkes
    tuition neⅽessary foг establishing critical believing
    skills ρast school h᧐urs.

    Stoρ by my web site additional mathematics tuition singapore

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>