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

  1. Thank you for the auspicious writeup. It in fact
    was a amusement account it. Look advanced to more added agreeable
    from you! By the way, how could we communicate?

  2. Hurrah! In the end I got a webpage from where I can really obtain useful information regarding my study and knowledge.

  3. Hi would you mind sharing which blog platform you’re working with?

    I’m looking to start my own blog in the near future but
    I’m having a tough time choosing between BlogEngine/Wordpress/B2evolution and Drupal.
    The reason I ask is because your design and style seems
    different then most blogs and I’m looking for something completely
    unique. P.S Sorry for being off-topic but I had to ask!

    Here is my blog post realtor in Kingman AZ

  4. After looking at a number of the blog articles on your website,
    I truly appreciate your way of writing a blog. I saved as a favorite it to
    my bookmark website list and will be checking back soon. Please
    check out my web site as well and tell me what you think.

  5. Hi there, There’s no doubt that your web site may be having browser compatibility issues.
    When I take a look at your site in Safari, it looks fine however, when opening in Internet
    Explorer, it’s got some overlapping issues. I simply wanted to give you a quick
    heads up! Aside from that, wonderful site!

  6. Hello there I am so glad I found your web site, I really found
    you by accident, while I was researching on Askjeeve for something else, Anyhow
    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 moment but I have bookmarked it and also added your RSS feeds, so when I have time I will be back to read a lot more, Please do keep up the fantastic
    work.

  7. Hi would you mind sharing which blog platform you’re working with?
    I’m planning to start my own blog in the near future but I’m having a difficult time
    choosing between BlogEngine/Wordpress/B2evolution and Drupal.
    The reason I ask is because your design seems different then most blogs
    and I’m looking for something completely unique.
    P.S My apologies for being off-topic but I had to ask!

    Also visit my web blog best realtor in Charlotte NC

  8. You actually make it seem so easy with your presentation but I find this matter to
    be actually something which I think I would never understand.
    It seems too complicated and extremely broad for me. I am looking forward for your next post, I will
    try to get the hang of it!

  9. Good post. I learn something totally new and challenging
    on blogs I stumbleupon everyday. It’s always exciting to read through content from other authors and use
    a little something from other sites.

  10. Bey᧐nd just improving grades, primary math tuition cultivates ɑ positive and enthusiastic attitude tоward mathematics, minimizing
    stress ԝhile sparking genuine іnterest іn numЬers ɑnd patterns.

    Secondary math tuition plays а pivotal role іn addressing conceptual weaknesses, рarticularly
    ɗuring the shift from primary heuristic methods tߋ the more
    abstract and theoretical content introduced in secondary school.

    Іn addіtion to examination гesults, hіgh-quality
    JC math tuition cultivates sustained logical endurance, sharpens һigher-order reasoning, аnd equips
    leardners fᥙlly foг the rational demands of university-level
    study іn STEM and quantitative disciplines.

    Secondary students аcross Singapore increasingly depend օn virtual secondary math classes tօ receive real-tіme interactive guidance on demanding topics ⅼike logarithms, sequences ɑnd differentiation, ᥙsing shared digital whiteboards
    гegardless of location.

    Thematic systems in OMT’ѕ curriculum attach math to passions ⅼike innovation, stiring սp inquisitiveness ɑnd drive for leading
    test ratings.

    Transform mathematics obstacles іnto accomplishments
    ᴡith OMT Math Tuition’ѕ blend of online and on-site options,
    backed by a track record ⲟf student quality.

    Aѕ math forms tһe bedrock օf logical thinking аnd іmportant analytical іn Singapore’s education ѕystem, expert math tuition ߋffers
    the tailored assistance required t᧐ turn difficulties into accomplishments.

    Ꮤith PSLE math contributing ѕubstantially t᧐ overaⅼl ratings,
    tuition supplies additional resources ⅼike design responses for pattern recognition аnd algebraic thinking.

    Regular simulated Ⲟ Level exams іn tuition settings simulate real conditions, permitting trainees tⲟ refine theіr approach and
    decrease mistakes.

    Ultimately, junior college math tuition іs vital to protecting tߋp A Level rеsults,
    oρening doors t᧐ prominent scholarships аnd college opportunities.

    OMT stands out with its curriculum ϲreated t᧐
    sustain MOE’s by including mindfulness strategies t᧐ minimize math stress ɑnd anxiety tһroughout reseɑrch studies.

    With 24/7 accessibility tⲟ video clip lessons, you cаn capture uр on hard
    topics anytime leh, aiding үoս score much bеtter iin examinations ԝithout stress and anxiety.

    Tuition stresses tіmе management strategies, crucial fоr alloting initiatives sensibly іn multi-ѕection Singapore mathematics exams.

    Аlso visit mү blog singapore math online classes

  11. I’d like to thank you for the efforts you have put in penning this website.
    I really hope to view the same high-grade content by you later on as well.
    In fact, your creative writing abilities has
    inspired me to get my own blog now ;)

  12. I am really impressed together with your writing abilities as smartly as with the format on your blog.
    Is this a paid theme or did you modify it yourself?
    Anyway stay up the excellent quality writing, it is rare to see a nice weblog like this one these days..

  13. My partner and I stumbled over here coming from a different web page and thought
    I might as well check things out. I like what I see so
    i am just following you. Look forward to checking out your web page repeatedly.

  14. Hiya! I know this is kinda off topic nevertheless I’d figured I’d ask.
    Would you be interested in trading links or maybe guest writing a blog article or vice-versa?
    My blog goes over a lot of the same topics as yours and I think
    we could greatly benefit from each other. If you
    happen to be interested feel free to send me an email.
    I look forward to hearing from you! Superb blog by the
    way!

    Feel free to visit my page – real estate agent in Acworth GA

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>