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.

5,816 thoughts on “Play Framework HTML5 input elements

  1. I’m not sure where you are getting your info, but great topic.
    I needs to spend some time learning more or understanding more.
    Thanks for wonderful info I was looking for this info for
    my mission.

  2. Сайты вроде взломанные игры на андроид предлагают широкий набор
    mods, создавая целую экосистему вокруг взломов.
    Такой тренд привела к появлению культуру пользователей, которые
    стремятся получить продвинутые возможности
    без ограничений.

  3. I have read so many posts on the topic of the blogger lovers but
    this post is genuinely a fastidious article, keep it up.

  4. I just like the helpful info you provide on your articles.
    I’ll bookmark your blog and test again here regularly.
    I am quite certain I will learn a lot of new stuff proper here!
    Good luck for the next!

    my web page … типа таких

  5. I read this article fully about the difference of newest and earlier
    technologies, it’s amazing article.

  6. It’s hard to find educated people in this particular subject, however, you seem like you know what you’re talking
    about! Thanks

  7. What’s Taking place i am new to this, I stumbled
    upon this I’ve discovered It absolutely useful and it
    has helped me out loads. I’m hoping to contribute & assist different customers like its aided me.
    Great job.

  8. Wonderful article! This is the kind of info that are meant
    to be shared around the net. Shame on the seek engines for no longer positioning
    this post upper! Come on over and discuss with my website .
    Thank you =)

  9. Hi there just wanted to give you a brief heads up and let you
    know a few of the pictures aren’t loading properly.
    I’m not sure why but I think its a linking issue.
    I’ve tried it in two different internet browsers and both show the same results.

  10. With heuristic techniques instructed аt OMT, pupils discover tօ
    assume lіke mathematicians, stiring ᥙp enthusiasm and drive for superior exam efficiency.

    Ԍet ready for success іn upcoming tests with OMT
    Math Tuition’ѕ proprietary curriculum, ϲreated
    to cultivate vital thinking and self-confidence in every student.

    As mathematics underpins Singapore’ѕ credibility fօr quality іn international standards lіke PISA, math tuition іs key to unlocking ɑ kid’ѕ ⲣossible annd securing scholastic advantages
    іn tһis core subject.

    Witһ PSLE math developing to inclᥙde more interdisciplinary elements, tuition kеeps
    students upgraded оn integrated concerns mixing math with science
    contexts.

    Comprehensive protection оf tһe wholе O Level curriculum іn tuition mаkes sure no topics, from collections to vectors, ɑrе overlooked іn a trainee’s modification.

    Junior college math tuition promotes joint learning іn smaⅼl teams, improving peer conversations օn complicated A Level concepts.

    Τhe proprietary OMT curriculum differs Ьy expanding MOE curriculum ԝith
    enrichment оn statistical modeling, perfect fоr
    data-driven test inquiries.

    OMT’ѕ ѕystem trcks yоur enhancement over time sia, encouraging
    үߋu to intend gгeater іn math grades.

    Specialized math tuition fⲟr O-Levels helps Singapore secondary pupils distinguish tһemselves in а jampacked applicant swimming pool.

    Ƭake a lߋoҝ at mү web-site :: math home tuition singapore

  11. Hi, Neat post. There is a problem with your web site
    in web explorer, would test this? IE nonetheless is the market
    leader and a huge section of other people will pass over your magnificent writing because of this problem.

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>