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.

7,270 thoughts on “Play Framework HTML5 input elements

  1. Good day! Would you mind if I share your blog with my twitter group?

    There’s a lot of folks that I think would really enjoy your
    content. Please let me know. Thanks

  2. Howdy I am so grateful I found your website, I really found you by accident, while I
    was browsing on Askjeeve for something else, Nonetheless I am here now and would just like to say cheers for a marvelous
    post and a all round entertaining blog (I also love the theme/design), I don’t
    have time to go through it all at the minute but I have bookmarked it and
    also added in your RSS feeds, so when I have time I will be back to read much more,
    Please do keep up the superb work.

  3. Definitely believe that which you stated.
    Your favorite justification seemed to be on the net the simplest
    thing to be aware of. I say to you, I definitely get irked while people
    think about worries that they just don’t know about.
    You managed to hit the nail upon the top and defined out
    the whole thing without having side effect , people could take a signal.
    Will likely be back to get more. Thanks

  4. With havin so much content do you ever run into any problems of plagorism or
    copyright infringement? My blog has a lot of exclusive content I’ve either written myself or outsourced but
    it looks like a lot of it is popping it up all over the web without my agreement.
    Do you know any techniques to help prevent content from being ripped off?
    I’d really appreciate it.

  5. Wow that was strange. I just wrote an incredibly long comment
    but after I clicked submit my comment didn’t show up.
    Grrrr… well I’m not writing all that over again. Anyway, just
    wanted to say wonderful blog!

  6. Primary-level math tuition іs essential for honing critical thinking ɑnd pгoblem-solving abilities neеded tο
    tackle the increasingly complex word probleems
    encountered іn upper primary grades.

    Іn Singapore’ѕ rigorous secondary education landscape, math tuition ƅecomes indispensable fօr students to thorougһly grasp challenging topics including advanced algebra, geometry, trigonometry,
    ɑnd statistics tһɑt act as critical building blocks fοr Օ-Level achievement.

    Given tһat A-Level performance directly determine
    admission t᧐ toρ local universities, specialised math tuition tһroughout
    JC1 аnd JC2 subѕtantially improves tһe likelihood of obtaining top-tier гesults.

    Аcross primary, secondary and junior college levels, digital math learning іn Singapore has
    revolutionised education Ƅy combining superior accessibility witһ affordable quality ɑnd access to elite tutors, helping students stay
    ahead іn Singapore’ѕ intensely competitive academic landscape ԝhile reducing fatigue from long travel oг inflexible
    schedules.

    Project-based discovering ɑt OMT tᥙrns math riցht intо hands-on enjoyable, triggering іnterest in Singapore
    trainees for outstanding examination end гesults.

    Cһange math challenges іnto victories ԝith OMT Math Tuition‘s mix of
    online ɑnd on-site options, ƅacked by a performance history οf student quality.

    As mathematics underpins Singapore’ѕ credibility fⲟr quality іn international
    benchmarks ⅼike PISA, math tuition іs crucial tо unlocking a kid’s рossible aand protecting academic benefits іn this core subject.

    Ꭲhrough math tuition, trainees practice PSLE-style concerns οn averages and
    graphs, enhancing accuracy ɑnd speed under test conditions.

    Linking math principles tߋ real-ѡorld circumstances via tuition strengthens understanding,
    maкing O Level application-based questions а lot moгe approachable.

    Junior college math tuition is vital fߋr A Degrees as it gгows understanding ߋf advanced calculus subjects ⅼike assimilation methods ɑnd
    differential formulas, which arе central tߋ thе test curriculum.

    The proprietary OMT curriculum distinctively enhances
    tһe MOE syllabus with focused practice on heuristic methods,
    preparing students ƅetter for examination challenges.

    OMT’ѕ οn the internet neighborhood pгovides
    support leh, ѡhere yօu can аsk concerns and improve your knowing fօr better qualities.

    Singapore’ѕ meritocratic ѕystem rewards һigh achievers, mаking math tuition a calculated investment fⲟr
    tedst dominance.

  7. Hiya very nice web site!! Man .. Beautiful .. Amazing ..
    I will bookmark your site and take the feeds also?
    I am happy to find so many useful info here within the put up, we want
    develop extra strategies in this regard, thank you for sharing.
    . . . . .

  8. I’m really enjoying the design and layout of your site.

    It’s a very easy on the eyes which makes it much more pleasant for me to come here and
    visit more often. Did you hire out a designer to create your theme?
    Superb work!

  9. Every weekend i used to pay a quick visit this website, as i want enjoyment,
    as this this site conations really nice funny material too.

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>