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.

15,466 thoughts on “Play Framework HTML5 input elements

  1. Hello just wanted to give you a quick heads up.
    The text in your article seem to be running off the screen in Firefox.
    I’m not sure if this is a format issue or something to do with
    internet browser compatibility but I figured I’d post to let you know.
    The design and style look great though! Hope you get the issue resolved soon. Kudos

  2. Hello there, I discovered your web site via Google whilst searching for a similar topic, your site got here up, it seems
    to be good. I’ve bookmarked it in my google bookmarks.

    Hello there, just was aware of your blog through Google, and located
    that it’s really informative. I am going to watch out for brussels.
    I’ll appreciate for those who continue this in future.
    Lots of other folks will likely be benefited out of your writing.

    Cheers!

  3. The enthusiasm of OMT’s owner, Мr. Justin Tan, shines with іn mentors, motivating Singapore pupils
    tߋ love mathematics for examination success.

    Join օur smaⅼl-grouρ ᧐n-site classes іn Singapore for tailored assistance in a nurturing environment
    tһat constructs strong fundamental mathematics skills.

    Ꭺѕ math forms tһe bedrock of rational thinking аnd critical prօblem-solving in Singapore’s education sʏstem, expert math tuition supplies
    tһe tailored guidance neеded to tսrn challenges іnto accomplishments.

    primary tuition іs essential foг developing durability
    ɑgainst PSLE’s difficult questions, ѕuch аs those on possibility and basic stats.

    Math tuition teaches effective tіme management techniques, assisting
    secondary trainees fuⅼl Օ Level exams within the assigned duration ѡithout hurrying.

    Fоr those going aftеr H3 Mathematics, junior college tuition սѕes advanced advice оn rеsearch-level subjects tⲟ master tһiѕ tough extension.

    OMT’ѕ customized syllabus distinctively lines սp wіth MOE framework
    by giᴠing bridging components fօr smooth ϲhanges
    in between primary, secondary, and JC mathematics.

    12-mоnth accessibility implies you can revisit subjects anytime
    lah, developing solid foundations fߋr constant һigh mathematics marks.

    Team math tuition in Singapore promotes peer
    discovering, encouraging trainees tߋ press harder fօr premium exam outcomes.

    Ⅿy page igcse maths tutor singapore

  4. What’s up friends, how is the whole thing, and what you would like to say regarding this paragraph, in my view
    its in fact remarkable for me.

  5. When the brand new plants are growing strongly, transplant them into individual containers or put them out in the garden. There’s nothing
    fairly like having a garden in your yard.

    This page illustrates different types of summer time flowering plants, so you
    may choose and combine what you want. In order to perform this,
    manufacturers can introduce calming, mood boosting tones like dusted pastels in ombre and prism patterns.
    Immersive Escapist Design: As a way to develop and set up
    immersive, sensory charged settings inside the
    shop that function a kind of escapism for shoppers, brands
    can implement prismatic lighting, reflective materials, and
    dynamic architecture. Symmetrical store layouts: Implementing layouts with correct symmetry can promote emotional stability and order.
    By opting for an understated strategy to retailer
    styling, prioritising construction, pure light,
    and handcrafted particulars, retail manufacturers can effortlessly communicate calm via order.
    You’ll be able to feed them citrus fruits in moderation, though some goats could not benefit from the bitter style.
    The plant could spread by seed however volunteer seeding is normally minimal.
    The vascular bundles of monocots are often spread throughout the cross-part of the stem.
    Take softwood stem cuttings in late spring or early summer time for fast rooting.
    Stress and overstimulation are indeed the commonest elements which are
    defining the features of modern life in this
    fast paced world.

  6. That is a great tip particularly to those new to the blogosphere.
    Brief but very precise info… Many thanks for sharing this one.
    A must read article!

  7. Its like you read my mind! You appear to know a lot about this, like
    you wrote the book in it or something. I think that you could do with a few pics
    to drive the message home a bit, but instead of that, this is wonderful blog.
    A great read. I’ll certainly be back.

  8. Do you have a spam problem on this site; I also am a blogger, and
    I was curious about your situation; we have developed some nice practices and we are looking to trade
    methods with others, please shoot me an email if interested.

  9. در پایان کار

    برای کاربران علاقه‌مند به

    بتینگ

    مشغولن

    این مرجع

    احتمالا گزینه باشه

    کاربردی دربیاد

    یه نکته مهم اینه که

    نام‌هایی مثل

    enfejarⲟnline جدید

    و

    sibbet شناخته شده

    پیشرفت قابل توجهی داشتن

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

    جذاب بود

    و

    بدون تردید

    میام سراغش

    Here is my site; سایت بورس; Mindy,

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>