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

  1. Thank you a bunch for sharing this with all folks you actually recognize what you are talking about!
    Bookmarked. Kindly also visit my website =).
    We will have a link trade arrangement between us

  2. I have been browsing online more than 4 hours today, yet
    I never found any interesting article like yours.
    It is pretty worth enough for me. In my view, if all web owners and bloggers
    made good content as you did, the web will be a lot more useful than ever before.

  3. Hello! This post could not be written any better! Reading through this post reminds
    me of my previous room mate! He always kept chatting about
    this. I will forward this page to him. Pretty sure he will have a good read.

    Many thanks for sharing!

  4. We stumbled over here coming from a different website
    and thought I should check things out. I like what I
    see so now i am following you. Look forward to going over your web
    page again.

  5. Magnificent site. A lot of helpful info here. I’m sending it to
    some friends ans also sharing in delicious.
    And naturally, thank you on your effort!

  6. By celebrating little success іn development monitoring, OMT nurtures а favorable relationship ѡith math, inspiring pupils fⲟr examination excellence.

    Dive іnto ѕelf-paced math proficiency witһ
    OMT’s 12-month e-learning courses, tоtal with practice worksheets and tape-recorded sessions f᧐r extensive modification.

    Αs mathematics underpins Singapore’ѕ track record for quality in worldwide benchmarks ⅼike PISA, math tuition iѕ crucial to opening ɑ child’s ⲣossible and securing academic benefits іn this core
    topic.

    For PSLE achievers, tuition supplies mock exams ɑnd feedback, assisting improve answers fⲟr maⲭimum marks in botһ multiple-choice and open-ended sections.

    Offered tһe high stakes of O Levels for hіgh school development іn Singapore, math tuition maximizes possibilities fоr leading qualities аnd preferred placements.

    Dealing with specific understanding designs, math tuition guarantees
    junior college students understand subjects аt
    tһeir very own rate for A Level success.

    Ꮃhɑt mɑkes OMT stand аρart іѕ its tailored curriculum that aligns wіth MOE wһile integrating ΑI-driven adaptive learning
    tօ match specific requirements.

    Unlimited access t᧐ worksheets indiсates you practice up սntil shiok, increasing уour mathematics confidence аnd grades іn no time at aⅼl.

    Singapore’ѕ worldwide position іn mathematics originates fгom additional tuition that refines skills fοr global standards ⅼike PISA
    ɑnd TIMSS.

    Aⅼso visit my homерage … one to one maths tuition

  7. Right here is the right blog for everyone who hopes to understand this topic.

    You understand a whole lot its almost tough to argue with you (not that I personally will need to…HaHa).
    You definitely put a fresh spin on a subject that has been discussed for a long time.
    Wonderful stuff, just excellent!

  8. Good day! I could have sworn I’ve been to your blog before but after going through a few
    of the articles I realized it’s new to me.
    Nonetheless, I’m certainly delighted I discovered it and
    I’ll be bookmarking it and checking back often!

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

  10. Every weekend i used to go to see this site,
    because i wish for enjoyment, for the reason that this this web page conations actually good funny stuff
    too.

  11. Oh my goodness! Amazing article dude! Thank you so much, However I am experiencing problems with your RSS.
    I don’t understand why I am unable to join it. Is there anybody getting
    similar RSS problems? Anyone that knows the answer will you kindly respond?
    Thanks!!

  12. Its like you read my mind! You seem to know so much about this, like you
    wrote the book in it or something. I think that you could
    do with some pics to drive the message home a little bit, but other than that, this is magnificent blog.
    A great read. I’ll certainly be back.

  13. Hello there, just became aware of your blog through Google, and found that it’s truly informative.
    I am gonna watch out for brussels. I’ll appreciate if you continue this in future.
    A lot of people will be benefited from your writing.
    Cheers!

  14. Thanks for your personal marvelous posting! I quite enjoyed reading it, you can be a great author.
    I will ensure that I bookmark your blog and will come back later
    in life. I want to encourage you continue your great posts, have a nice
    morning!

  15. Hello there! This article couldn’t be written any better!
    Reading through this article reminds me of my previous roommate!
    He continually kept preaching about this. I’ll forward this article to him.
    Pretty sure he will have a very good read. Many thanks for
    sharing!

  16. May I simply say what a comfort to find a person that really understands what they’re talking about over the internet.
    You definitely understand how to bring a problem to light and make it
    important. More people really need to look at this and understand this
    side of the story. It’s surprising you aren’t more popular given that you most certainly have the gift.

  17. Login ke GT108, platform game online resmi dan terpercaya
    hari ini Nikmati pengalaman bermain seru, aman, dan mudah diakses untuk semua pemain

  18. Actually when someone doesn’t know after that its up to other people that they will assist,
    so here it happens.

  19. Good day! I know this is kinda off topic however , I’d figured I’d ask.

    Would you be interested in trading links or maybe guest authoring a blog article or vice-versa?

    My site addresses a lot of the same subjects as yours and I
    think we could greatly benefit from each other. If you might be interested feel free to send me
    an e-mail. I look forward to hearing from you!
    Awesome blog by the way!

  20. Great blog you’ve got here.. It’s hard to find quality writing like yours these days.
    I honestly appreciate people like you! Take care!!

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>