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

  1. I have observed that online degree is getting preferred because accomplishing your college degree online has developed into popular alternative for many people. A huge number of people have not had an opportunity to attend a normal college or university nevertheless seek the elevated earning potential and career advancement that a Bachelors Degree provides. Still others might have a diploma in one discipline but would wish to pursue another thing they now develop an interest in.

  2. Heya! I’m at work surfing around your blog from my new iphone 3gs!
    Just wanted to say I love reading through your blog and look forward to all your posts!
    Keep up the superb work!

  3. I’velearn sopme jhst rigght sfuff here. Definiteky priice bookmaking ffor revisiting.

    I womder how a loot effokrt you plaqce tto create this type of wonderfuhl
    infodmative site.

    Also viwit myy web-site cnhub.xyz

  4. I do not even know the way I finished up right here, however I thought this post was once
    great. I don’t realize who you are but definitely you’re going to a famous blogger
    when you are not already. Cheers!

  5. I’ve learn several just right stuff here. Definitely value bookmarking for revisiting.
    I wonder how a lot attempt you place to create any such magnificent
    informative website.

  6. Hello there, You have done an incredible job. I will definitely digg
    it and personally recommend to my friends. I’m sure they will be benefited from this website.

  7. Excellent information shared here. Recently I upgraded my smartphone and started looking
    for a better fast charging battery pack. While researching online I came across
    this article and found several useful details that other reviews never mentioned.
    Very practical content.

  8. Hi, I do think this is an excellent site. I stumbledupon it ;) I may come back yet again since I book-marked it.
    Money and freedom is the greatest way to change, may
    you be rich and continue to guide other people.

  9. من خودم خیلی حرفه‌ای نیستم و بیشتر از
    زاویه یک کاربر کنجکاو این سایت رو بررسی کردم.
    درود به همه، خواستم نظر شخصی خودم رو درباره این موضوع بگم.
    مدتی قبل وقتی با چند نفر درباره این موضوع صحبت می‌کردیم این صفحه رو دیدم.
    همون ابتدادیدم اطلاعاتش قابل فهم نوشته شده.
    برداشت شخصی من اینه که کاربر باید خودش با دقت بررسی
    کنه. یکی از همکارام همیشه می‌گفت
    قبل از هر کاری باید شرایط رو کامل خوند.
    برای همین به جز ظاهر سایت، متن‌ها و توضیحاتش رو
    هم نگاه کردم. نکته‌ای که
    توجهم رو جلب کرد که متن‌ها خیلی خشک و
    تبلیغاتی نبودن. ولی خب بهتره کاربر قبل
    از هر اقدامی خودش هم تحقیق کنه.

    برای کسانی که می‌خوان قبل از تصمیم‌گیری دید بهتری داشته باشن،
    بهتره در کنار چند گزینه دیگه بررسی بشه.

    از طرف دیگه اسم‌هایی مثل enfejar omline همراه با sib-bet نشون میدن این حوزه چقدر
    گسترده شده. یکی از دوستام به اسم سامان همیشه می‌گفت توی این حوزه نباید فقط به ظاهر سایت نگاه کرد و باید شرایط، توضیحات و
    تجربه کاربرا رو هم دید. در کل حداقل
    برای آشنایی اولیه می‌تونه مفید باشه.
    من پیشنهاد می‌کنم با دید باز و منطقی جلو بره.
    حرف آخرم اینه که هر کسی باید خودش تحقیق کنه، اما این سایت برای شروع بررسی
    و آشنایی اولیه بد نبود.

    Here is my web-site :: شرط‌های ترکیبی، وابستگی رویدادها و محدودیت‌ها

  10. Every weekend i used to go to see this web site, for the reason that i wish for enjoyment, since this this web site conations actually pleasant funny material too.

  11. I do consider all of the ideas you have introduced
    in your post. They are very convincing and will definitely work.
    Nonetheless, the posts are very short for newbies.
    Could you please prolong them a little from next time? Thank you for the post.

  12. I’m extremely inspired with your writing skills and also with the format to your blog.
    Is that this a paid topic or did you modify it your self?
    Anyway stay up the excellent quality writing, it is uncommon to see
    a nice weblog like this one these days..

  13. I all the time emailed this website post page to all my contacts, because
    if like to read it next my links will too.

  14. At this time it seems like WordPress is the preferred
    blogging platform available right now. (from what I’ve
    read) Is that what you are using on your blog?

  15. Hi it’s me, I am also visiting this web page regularly, this
    web page is truly nice and the users are truly sharing nice thoughts.

  16. Thanks for your marvelous posting! I genuinely enjoyed reading it, you are
    a great author.I will ensure that I bookmark your blog and may come back
    in the foreseeable future. I want to encourage you continue your great job,
    have a nice morning!

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

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>