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

  1. It is actually a nice and helpful piece of information. I am glad that you just shared this
    helpful information with us. Please stay us informed
    like this. Thanks for sharing.

  2. bayar bayar bayar bayar bayar bayarbayar bayar bayar bayar bayar bayarbayar bayar bayar bayar bayar bayar bayar bayar bayar bayar
    bayar bayarbayar bayar bayar bayar bayar bayarbayar bayar bayar bayar
    bayar bayar bayar bayar bayar bayar bayar bayarbayar bayar bayar bayar bayar bayarbayar bayar bayar bayar
    bayar bayar bayar bayar bayar bayar bayar bayarbayar bayar bayar bayar bayar bayar

  3. you are actually a just right webmaster. The site loading pace is incredible.
    It seems that you are doing any distinctive trick.
    Moreover, The contents are masterpiece. you have performed a magnificent task on this matter!

  4. An impressive share! I have just forwarded this onto a coworker who was doing a little homework on this.
    And he actually bought me breakfast due to the fact that I stumbled upon it for him…
    lol. So let me reword this…. Thank YOU for the meal!!
    But yeah, thanx for spending some time to talk about this subject here on your website.

  5. Wonderful beat ! I wish to apprentice while you amend your site, how can i subscribe for a blog
    web site? The account helped me a acceptable
    deal. I had been tiny bit acquainted of this your broadcast provided bright clear
    concept

  6. Hello! I know this is somewhat off topic but I was wondering if you knew where
    I could find a captcha plugin for my comment form?

    I’m using the same blog platform as yours and I’m having
    trouble finding one? Thanks a lot!

  7. The other day, while I was at work, my cousin stole my iPad and tested to
    see if it can survive a 40 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!

  8. Every weekend i used to go to see this web site,
    as i want enjoyment, for the reason that this this website conations genuinely good funny
    stuff too.

    Here is my site 여친대행

  9. This is a well-written post about betting platforms. I really like how you explained the importance of using
    trusted platforms.

    From what I’ve seen, ufabet888 are often recommended
    because they provide consistent service and secure transactions.

    Many players have trouble to find reliable websites, so content
    like this is great for guidance.

    Thanks for sharing — this will definitely help new users make
    smarter decisions.

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>