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.

19,543 thoughts on “Play Framework HTML5 input elements

  1. Hi I am so delighted I found your site,
    I really found you by error, while I was looking on Google for something else, Regardless I am here now and would just like to say cheers
    for a tremendous post and a all round exciting blog
    (I also love the theme/design), I don’t have time to read through
    it all at the minute but I have book-marked it and also added in your
    RSS feeds, so when I have time I will be back
    to read a great deal more, Please do keep up the awesome work.

  2. If you desire to improve your experience only keep
    visiting this web site and be updated with the most recent gossip posted here.

  3. Undeniably believe that which you said. Your favorite reason appeared to be at
    the web the simplest thing to remember of. I say to you,
    I definitely get annoyed at the same time as other folks consider issues that they plainly do not
    recognise about. You controlled to hit the nail upon the top and also defined out the whole thing with
    no need side-effects , folks can take a signal. Will probably be back
    to get more. Thank you

  4. Do you haqve a spam iszsue oon this website; I also aam a blogger, annd I
    was wantiing too know your situation; we hage developed some nice
    practices aand wwe are looking tto swap strategijes wth other folks,
    please shlot mme aan e-mail iif interested.

    Feeel frese too visijt myy bllog – xnxx18.pro

  5. magnificent post, very informative. I’m wondering why
    the opposite specialists of this sector don’t
    notice this. You must proceed your writing. I’m confident,
    you’ve a great readers’ base already!

  6. My programmer is tryinjg too convince me too movve
    too .net from PHP. I have alwzys disliuked thee idda because off the expenses.
    Butt he’s tryiong none thee less. I’ve bden using Movable-type oon sevsral werbsites foor abbout a yer annd am
    axious bout switching too another platform. I hve hward fantastic things about blogengine.net.

    Is there a way I can transfer alll mmy wordpress ccontent into it?
    Any kind off heelp would bee greeatly appreciated!

  7. Hello there I am so thrilled I found your weblog, I really found you by accident, while I was researching on Google for something else,
    Regardless I am here now and would just like to say cheers for a incredible post and a all round exciting
    blog (I also love the theme/design), I don’t have time to browse 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 a lot more, Please do keep up the great work.

  8. Its like you read my thoughts! You seem to understand so much about this, like you wrote the guide in it or something.
    I feel that you just could do with a few percent to
    drive the message home a little bit, however instead of that, this is wonderful blog.

    A great read. I will definitely be back.

  9. Today, while I was at work, my sister stole my iphone
    and tested to see if it can survive a 30 foot drop, just so she can be
    a youtube sensation. My apple ipad is now broken and she has 83 views.

    I know this is completely off topic but I had to share it
    with someone!

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

  11. Excellent pieces. Keep posting such kind of info on your blog.
    Im really impressed by it.
    Hello there, You’ve performed an excellent job.
    I’ll definitely digg it and personally suggest
    to my friends. I’m sure they will be benefited from this website.

  12. Hi just wanted to give you a quick heads up and let you know a few of
    the images aren’t loading correctly. I’m not sure why but
    I think its a linking issue. I’ve tried it in two different browsers and both show the same
    results.

  13. Exceptional post however , I was wondering if you could write a litte more on this topic?
    I’d be very grateful if you could elaborate a little bit more.
    Thank you!

  14. Generally I do not learn post on blogs, however I would like to
    say that this write-up very compelled me to take a look at and do it!
    Your writing style has been amazed me. Thank you, quite nice article.

  15. Great blog right here! Additionally your site quite a
    bit up very fast! What host are you the use of? Can I get
    your associate link to your host? I desire my
    web site loaded up as quickly as yours lol

  16. I enjoy what you guys are usually up too. This type of clever
    work and reporting! Keep up the fantastic works
    guys I’ve added you guys to my blogroll.

  17. Hi all, here every person is sharing these kinds of know-how, thus it’s
    fastidious to read this blog, and I used to pay a visit this web site every day.

  18. This design is incredible! You definitely know how to keep a reader amused.
    Between your wit and your videos, I was almost moved to start my own blog (well, almost…HaHa!) Excellent
    job. I really enjoyed what you had to say, and more than that, how
    you presented it. Too cool!

  19. Great blog here! Also your website loads up very fast!
    What host are you using? Can I get your affiliate link to your host?
    I wish my site loaded up as fast as yours lol

  20. I absolutely love your blog and find the
    majority of your post’s to be exactly what I’m looking for.
    Would you offer guest writers to write content for you personally?
    I wouldn’t mind writing a post or elaborating on most of
    the subjects you write in relation to here. Again, awesome site!

  21. Please let me know if you’re looking for a author for your blog.
    You have some really good posts and I believe I would be
    a good asset. If you ever want to take some of
    the load off, I’d love to write some articles for your blog in exchange for a link back to mine.
    Please blast me an email if interested. Thanks!

  22. Awesome blog! Is your theme custom made or
    did you download it from somewhere? A theme
    like yours with a few simple tweeks would really make my blog jump out.
    Please let me know where you got your theme. With thanks

  23. Fabulous, what a website it is! This weblog provides useful information to us, keep it up.

  24. Great web site you have got here.. It’s difficult to find high quality writing like yours
    nowadays. I seriously appreciate people like you!

    Take care!!

  25. Hi there this is kinda of off topic but I was
    wanting to know if blogs use WYSIWYG editors or if you have to
    manually code with HTML. I’m starting a blog soon but
    have no coding experience so I wanted to get advice from someone with experience.
    Any help would be enormously appreciated!

  26. 商品情報をありがとうございます 。 各部の寸法が明確でイメージしやすい 。 仕上がりに大変満足です。 リアルな質感に仕上がるのが嬉しい
    。 今後の更新を楽しみにしています

  27. Hmm is anyone else encountering problems with the pictures on this blog loading?
    I’m trying to figure out if its a problem on my end or
    if it’s the blog. Any suggestions would be greatly appreciated.

  28. I am really loving the theme/design of your blog. Do you ever run into any web browser compatibility problems?
    A number of my blog audience have complained about my site not operating correctly in Explorer but looks
    great in Opera. Do you have any suggestions to help fix this problem?

  29. If you desire to take much from this post then you have to apply such methods to your won website.

  30. Дубликаты государственных номеров на авто в Москве
    доступны для заказа в кратчайшие
    сроки дубликат номера в москве сделать автомобиля цена обращайтесь
    к нам для получения надежной помощи и гарантии результата!

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>