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.

16,809 thoughts on “Play Framework HTML5 input elements

  1. Villas for rent in Protaras, by RentVillaCyprus can assure you that the
    selection and control of each villa is entirely made
    by us, in order to ensure the lovely holidays you deserve.
    Moreover, book your accommodation safely thanks to our secure online payment
    system.

  2. Woah! I’m really enjoying the template/theme of this site.

    It’s simple, yet effective. A lot of times it’s very hard to
    get that “perfect balance” between superb usability and appearance.

    I must say that you’ve done a very good job with this.
    Additionally, the blog loads super quick for me on Chrome.
    Excellent Blog!

  3. I must thank you for the efforts you’ve put
    in writing this site. I am hoping to check out the same
    high-grade blog posts by you in the future as well.
    In fact, your creative writing abilities has encouraged me to get my very own blog now ;)

  4. Кейтеринг Зайцев: создаём гастрономические впечатления для ваших событий.

    Мы берём на себя всё от разработки меню до сервировки и обслуживания.

    Доверьте организацию питания
    профессионалам, и освободите время для
    самого важного: общения с гостями и наслаждения праздником.

    Что мы предлагаем:
    индивидуальное меню (классическая кухня, авторские блюда, вегетарианские и диетические опции);
    выездное обслуживание в любом месте:
    банкетный зал, офис, парк, берег озера, теплоход;
    кейтеринг в казани доставка,оформление
    площадки и сервировка столов;
    внимательный персонал: опытные официанты и повара;
    гибкость форматов: кофе брейк, фуршет, банкет, барбекю, детский праздник.

    Доверьтесь кейтерингу Зайцев и ваш праздник запомнится гостям безупречным вкусом и атмосферой.

  5. hello there and thank you for your info – I’ve definitely picked up something new from right here.
    I did however expertise several technical issues using this website, since I experienced to reload
    the website many times previous to I could get it to load correctly.
    I had been wondering if your web host is OK? Not that I’m complaining, but slow loading instances
    times will sometimes affect your placement
    in google and can damage your quality score if ads and marketing with Adwords.

    Anyway I’m adding this RSS to my e-mail and could look
    out for much more of your respective interesting content.
    Make sure you update this again soon.

    Look at my web page … bittele pcb assembly

  6. My whole view of betting changed the day I discovered how sure bets
    work. Honestly, it sounded like a scam when I first
    heard that you could bet on both sides and win. Once I tried it with real bets, the results
    amazed me.

    It’s basically using pure math to make the outcome irrelevant.

    The first time I placed two opposite bets, it felt strange, but the results were unreal.
    Instead of anxiety, there was this calm feeling knowing the
    math had my back.

    What surprised me most is how steady the returns are.
    Most opportunities give around 1–5% profit, but those small gains
    stack fast. It honestly feels more like investing than gambling.

    The right software totally transforms the experience.
    Without the software, I wouldn’t even notice most opportunities.
    I never imagined software could help beat bookmakers so effectively.

    If someone told me years ago that betting could feel safe and predictable,
    I’d laugh. Now I treat it like a side investment that grows a little every day.
    If you enjoy long-term strategies, this is a perfect fit.

  7. Great goods from you, man. I have be mindful your stuff previous to
    and you’re just too excellent. I actually like what you have acquired
    here, really like what you’re stating and the way in which during which you assert it.
    You are making it entertaining and you still care for to stay it sensible.
    I can’t wait to read far more from you. That is actually a
    wonderful website.

    Also visit my blog post – restaurant seating bulk order

  8. Hey there! I know this is kinda off topic but I was wondering if you knew where I could locate a captcha
    plugin for my comment form? I’m using the same blog platform as yours and I’m having
    problems finding one? Thanks a lot!

  9. Hello to every , as I am actually eager of reading this website’s post to be updated daily.
    It consists of fastidious data.

  10. An outstanding share! I have just forwarded this onto a coworker who was
    conducting a little homework on this. And he in fact bought me
    lunch simply because I found it for him…
    lol. So allow me to reword this…. Thank YOU for the meal!!
    But yeah, thanks for spending some time to talk
    about this topic here on your website.

  11. Have you ever thought about adding a little bit more than just your articles?
    I mean, what you say is important and all. Nevertheless just imagine if
    you added some great images or video clips to give your posts more,
    “pop”! Your content is excellent but with images and clips,
    this website could certainly be one of the very best in its niche.
    Awesome blog!

  12. Selam hangi blog platformunu kullandığınızı söyler misiniz?
    Yakın gelecekte kendi blogumu açmayı düşünüyorum ama BlogEngine/Wordpress/B2evolution ve Drupal
    arasında karar kılmakta zorlanıyorum. Sorma sebebim tasarımınızın çoğu blogdan farklı görünmesi ve tamamen benzersiz bir şey
    arıyor olmam. Konu dışı olduğu için pardon!

  13. You really make it seem so easy with your presentation but
    I find this topic to be really something which I think I would never understand.
    It seems too complicated and very broad for me. I am looking
    forward for your next post, I’ll try to get the
    hang of it!

  14. Hey, I think your blog might be having browser compatibility issues.
    When I look at your blog site in Opera, it looks fine but when opening in Internet Explorer, it has some overlapping.
    I just wanted to give you a quick heads up!
    Other then that, awesome blog!

  15. What’s Going down i am new to this, I stumbled upon this I’ve found It positively
    helpful and it has aided me out loads. I am hoping to
    contribute & aid other customers like its aided me.

    Great job.

  16. constantly i used to read smaller articles or reviews which also clear their motive,
    and that is also happening with this article which I am reading here.

  17. I was curious if you ever considered changing the layout of your website?
    Its very well written; I love what youve got to
    say. But maybe you could a little more in the way of content so people could connect with it better.

    Youve got an awful lot of text for only having 1 or two images.
    Maybe you could space it out better?

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>