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.

14,879 thoughts on “Play Framework HTML5 input elements

  1. I’ve been exploring for a bit for any high quality articles or weblog posts on this sort of house .

    Exploring in Yahoo I ultimately stumbled upon this
    web site. Reading this info So i am satisfied to express that I
    have a very excellent uncanny feeling I found out exactly
    what I needed. I such a lot undoubtedly will make
    sure to don?t fail to remember this website and provides it
    a glance regularly.

    Review my webpage; online dating

  2. Heya! I’m at work browsing your blog from my new iphone 3gs!
    Just wanted to say I love reading through your blog and look forward to
    all your posts! Carry on the outstanding work!

    Also visit my web site :: HundRoses

  3. Attractive part of content. I just stumbled upon your web site and in accession capital to
    say that I acquire in fact enjoyed account your
    blog posts. Anyway I will be subscribing in your feeds or even I
    success you get entry to persistently fast.

    Visit my website – best realtor in Tampa FL

  4. Asking questions are really good thing if you are not understanding anything completely, but this post provides fastidious understanding yet.

  5. Hi there, I think your web site could possibly be having browser compatibility issues.
    When I look at your blog in Safari, it looks fine however when opening in IE, it has some overlapping issues.

    I just wanted to provide you with a quick heads up!

    Besides that, great website!

  6. Great article, very helpful.
    It clearly explains
    how streaming platforms operate
    in a
    simple and easy-to-understand way.

    A lot of users are curious
    how to access live sports streams
    and
    the information here is quite practical.
    Thanks for putting this together.

  7. It is truly a great and helpful piece of information. I’m satisfied that you simply shared this helpful
    information with us. Please keep us informed like this.
    Thanks for sharing.

  8. Hi there! I could have sworn I’ve been to this site
    before but after reading through some of the post I realized
    it’s new to me. Anyhow, I’m definitely glad I found it and I’ll be book-marking and
    checking back often!

  9. Hi there, You have done an excellent job. I will certainly digg it and personally recommend to my friends.
    I am sure they’ll be benefited from this web site.

  10. Hello there, just became alert to your blog through Google,
    and found that it’s truly informative. I’m gonna
    watch out for brussels. I’ll be grateful if you continue this in future.

    Lots of people will be benefited from your writing. Cheers!

  11. This is a very informative post about online casinos and betting platforms.
    I especially liked how it explains the importance
    of choosing a secure site before registering.

    Many players often ask where to find reliable gaming
    platforms with fair odds and smooth withdrawals.
    In my experience, checking platforms like milyon88games.com helps
    users understand what features to look for in a
    legit online casino.

    Thanks for sharing these insights — they’re useful
    for both beginners and experienced players.

  12. I think that what you said was very reasonable. However, think on this, what if you added a little information? I mean, I don’t wish
    to tell you how to run your blog, however suppose you added a post
    title to possibly grab a person’s attention? I mean Play Framework HTML5
    input elements | freestyle developments is kinda boring.

    You might look at Yahoo’s front page and watch how they create article titles
    to grab people to open the links. You might try adding a video or a picture or two to get
    readers excited about everything’ve got to say.
    Just my opinion, it could bring your posts a little livelier.

  13. Our site is an affiliate/referral site which hosts gambling sites
    and we aiming on bringing people into each casino by using our referral code.

  14. Hi there, You have done a great job. I will definitely digg it and personally recommend to my friends.
    I am confident they will be benefited from this site.

  15. Wow! After all I got a web site from where I can genuinely get helpful facts concerning my
    study and knowledge.

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>