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.

20,967 thoughts on “Play Framework HTML5 input elements

  1. The other day, while I was at work, my sister stole
    my iPad 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 destroyed and she has 83 views. I know
    this is totally off topic but I had to share it with someone!

  2. 저는 이 웹페이지 게시물을 읽고 실제로 만족합니다.
    풍부한 가치 있는 정보을 포함하고
    있어, 이런 통계를 제공해 줘서 감사합니다.

    What’s up it’s me, I am also visiting this site regularly, this
    website is in fact pleasant and the people are
    really sharing nice thoughts.

  3. I do trust all the ideas you have offered on your post.
    They’re really convincing and will certainly work.

    Still, the posts are too quick for novices. May just you please
    prolong them a bit from subsequent time? Thank you for the post.

  4. Yesterday, while I was at work, my cousin stole my iPad and tested to see if it can survive a forty foot drop, just
    so she can be a youtube sensation. My iPad is now broken and she
    has 83 views. I know this is completely off topic but I had to share it with someone!

  5. Mit Küchenfolie die Arbeitsplatte verschönern – schnell, günstig und ohne großen Aufwand.
    Entdecke praktische Tipps, kreative Ideen und eine einfache Anleitung, um deiner Küche in kurzer Zeit einen frischen, modernen Look
    zu verleihen und dabei Geld zu sparen.

  6. Tive uma intuição com o Fortune Mouse na virada do dia e batata: R$ 200 de lucro.

  7. A person necessarily lend a hand to make seriously posts I would state.
    This is the very first time I frequented your website page and so far?
    I amazed with the analysis you made to create this actual publish amazing.

    Great activity!

    Feel free to surf to my webpage: login sontogel

  8. Thanks for another fantastic post. Where else
    could anybody get that kind of info in such a perfect manner of writing?
    I’ve a presentation subsequent week, and I’m on the look for such
    information.

  9. ラブドールは、比較的高価なアイテムなので、価格と品質のバランスをしっかり見極める必要があります。
    価格が高いからといって必ずしも品質が良いわけではなく、極端に安い場合は逆に危険が増すことを理解しておかなければなりません。
    国産商品の価格帯は素材やサイズによって幅広く、相場を知らないまま選ぶと損をしたりするケースが多いです。
    激安の輸入品には、安全性が低かったり、アレルギーを引き起こしたりするものも存在します。
    一方で高額すぎる商品は、価格に見合った価値が得られない場合もあり、余計なコストを抑えることが重要です。
    当サイトでは、市場全体の相場を分析し、予算別のおすすめポイントを分かりやすく解説しています。
    追加費用やオプション代など、見落としがちなコストについても丁寧に触れています。
    購入後のメンテナンスコストまで考慮した上での判断が最も重要で、一度の金額だけで決めるべきではありません。
    初めて買う方が陥りやすい金額感のミスを解消し、賢い選択ができるようにサポートします。
    相場を理解することで、安心して購入を進められます。
    この情報を活用すれば、価格で損をすることなく、最適なリアルドールを見つけることができます。

  10. Today, I went to the beach with my children. I found a sea shell and
    gave it to my 4 year old daughter and said “You can hear the ocean if you put this to your ear.” She put the shell to her ear
    and screamed. There was a hermit crab inside and it pinched her ear.
    She never wants to go back! LoL I know this is entirely off topic
    but I had to tell someone!

  11. Hi, Neat post. There’s an issue along with your website in web explorer, could check this?
    IE still is the marketplace leader and a big
    component to other folks will pass over your wonderful writing because of this problem.

  12. Thanks for sharing your info. I truly appreciate your efforts and I will be
    waiting for your next write ups thanks once again.

  13. I think this is one of the most significant information for me.
    And i’m glad reading your article. But wanna remark on few general things, The site style is great, the
    articles is really great : D. Good job, cheers

  14. This is really attention-grabbing, You are a very professional blogger.
    I’ve joined your rss feed and look forward to
    looking for extra of your wonderful post.
    Additionally, I have shared your website in my social networks

  15. Hey there! Someone in my Facebook group shared this site with us so I came to take a look.
    I’m definitely enjoying the information. I’m bookmarking and will
    be tweeting this to my followers! Outstanding blog and outstanding style and
    design.

  16. It is appropriate time to make a few plans for the longer
    term and it is time to be happy. I’ve read this post and if I
    may I desire to counsel you few attention-grabbing things or tips.
    Maybe you can write subsequent articles regarding this article.
    I wish to learn even more things about it!

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>