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

  1. Its like you read my mind! You appear to know a lot 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 instead of
    that, this is great blog. A fantastic read. I will certainly be back.

  2. Hey there, You have done a great job. I’ll certainly digg it and personally
    recommend to my friends. I am sure they’ll be benefited from this website.

  3. How to use SMM panel safely is the most important lesson for long-term
    growth. At GetFollowerFast.com we teach every customer these
    six proven rules so they never face bans or drops.
    Rule 1: Start small – test with 100–500 units first.
    Rule 2: Always enable drip feed to spread delivery over days.
    Rule 3: Choose only high retention non-drop services with refill guarantee.
    Rule 4: Mix SMM services with regular organic posting and engagement.
    Rule 5: Never share your account password – our panel only needs public username.
    Rule 6: Monitor your account and enable 2FA.

    When you follow these steps, using an common mistakes smm panels panel is 100% safe.
    GetFollowerFast.com makes it easy with clear service descriptions
    and 24/7 support. Our VIP auto refill and country targeted options add extra safety and quality.

    Many users who switched from cheap panels now
    enjoy stable growth with us. Safety is built into every order.

    Ready to grow safely? Join GetFollowerFast.com today and follow
    our guide. Your account will thank you.

  4. You are so awesome! I don’t believe I’ve truly read through something like
    that before. So wonderful to find somebody with some genuine thoughts on this subject matter.
    Seriously.. many thanks for starting this up. This web site is one thing that is needed on the internet,
    someone with some originality!

    Feel free to visit my site … dragon stuffed animal jellycat

  5. Do you mind if I quote a couple of your articles as long as I provide credit and sources
    back to your blog? My website is in the exact same area of interest as yours and my visitors would certainly benefit from some of the information you present here.

    Please let me know if this ok with you. Thanks!

    Also visit my page – stuffed animal dragon

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>