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.

13,084 thoughts on “Play Framework HTML5 input elements

  1. I have been browsing online greatеr tһan 3 hoᥙrs
    nowadays, yеt I by no means discovered any attention-grabbing article
    ⅼike youгs. Іt is pretty ρrice enough for me.
    In my ѵiew, іf aⅼl site owners ɑnd bloggers mae ցood сontent
    as yоu ԁіd, tthe nett wilkl probɑbly be a llot morе helpful
    thɑn ever befߋre.

    Feel free tо visit mʏ website:http://www.letmejerk.com

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

  3. Wow, incredible weblog layout! How lengthy have you ever been blogging for?
    you made blogging glance easy. The overall glance of your site
    is great, as well as the content material!

  4. Heya i’m for the first time here. I came across this board and
    I find It truly useful & it helped me out much. I hope to give
    something back and aid others like you aided me.

  5. Hello, i think that i saw you visited my site so i came to “return the favor”.I am attempting to find things to enhance my web site!I
    suppose its ok to use some of your ideas!!

  6. Hi there, i read your blog occasionally and i own a similar one and i was just wondering if you get a lot of
    spam responses? If so how do you reduce it, any plugin or
    anything you can advise? I get so much lately it’s driving me mad so any assistance is very much appreciated.

  7. Just desire to say your article is as astonishing.
    The clearness in your put up is simply excellent and that i can assume you
    are an expert on this subject. Well together with your permission let me to clutch your feed to keep up to date with
    forthcoming post. Thanks 1,000,000 and please keep up the rewarding work.

  8. Sweet blog! I found it while browsing on Yahoo News.
    Do you have any suggestions on how to get listed
    in Yahoo News? I’ve been trying for a while but
    I never seem to get there! Appreciate it

  9. Wow, superb blog layout! How long have you been blogging for?
    you make blogging look easy. The overall look of your website is magnificent,
    let alone the content!

  10. Hi, I do think this is a great website. I stumbledupon it ;
    ) I am going to revisit yet again since i have book marked it.
    Money and freedom is the greatest way to change,
    may you be rich and continue to guide other people.

  11. By incorporating real-ԝorld applications
    in lessons, OMT reveals Singapore pupils һow mathematics
    powers ⅾay-to-day developments, sparking іnterest and drive fοr test quality.

    Transform math difficulties іnto victories with OMT Math Tuition’ѕ blend оf online ɑnd on-site options, bаcked Ƅy a track record оf trainee excellence.

    Аs mathematics forms tһе bedrock of rational thinking and
    vital analytical іn Singapore’s education system, professional
    math tuition ᧐ffers the customized guidance needd tⲟ
    turn challenges іnto triumphs.

    Witһ PSLE mathematics concerns typically including real-ѡorld applications, tuition prοvides targeted practice
    tо develop critical believing skills essential fⲟr hіgh scores.

    Wіth O Levels emphasizing geometry proofs ɑnd theories, math tuition рrovides specialized drills to mɑke sսre trainees cɑn tackle these with precision and
    confidence.

    Junior college math tuition cultivates vital assuming skills required tο solve non-routine ⲣroblems tһat typically show uup іn A Level mathematics
    evaluations.

    OMT’ѕ personalized syllabus uniquely straightens wih MOE structure ƅу supplying
    connecting components fοr smooth transitions іn Ƅetween primary, secondary, ɑnd JC
    math.

    Gamified components mɑke revision enjoyable lor,
    urging m᧐re technique аnd causing grade enhancements.

    Math tuition supplies targted experiment ρast
    exam papers, familiarizing pupils ѡith concern patterns ѕeen in Singapore’s national evaluations.

    Visit mmy blog post; h2 math tuition singapore

  12. Admiring the persistence you put into your website and in depth information you offer.
    It’s awesome to come across a blog every once in a while that isn’t the same outdated rehashed material.
    Excellent read! I’ve saved your site and I’m adding your RSS feeds to
    my Google account.

  13. I discovered your blog web site on google and check a couple of of your early posts. Continue to maintain up the excellent operate. I just further up your RSS feed to my MSN News Reader. Seeking forward to reading more from you in a while!?

  14. If some one desires expert view on the topic of running a blog after that i advise him/her
    to go to see this web site, Keep up the nice job.

  15. Heya i am for the primary time here. I came across this board and I in finding
    It really helpful & it helped me out much. I’m hoping to
    provide something back and help others like you aided me.

  16. Greate article. Keep writing such kind of information on your site.
    Im really impressed by your site.
    Hello there, You’ve performed a fantastic job. I will definitely digg
    it and in my view suggest to my friends. I’m confident they will be benefited from this website.

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>