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.

15,286 thoughts on “Play Framework HTML5 input elements

  1. Hi there would you mind stating which blog platform you’re using?

    I’m going to start my own blog in the near future but I’m having a hard
    time selecting between BlogEngine/Wordpress/B2evolution and
    Drupal. The reason I ask is because your design and style seems different then most blogs and I’m looking for something unique.
    P.S Sorry for getting off-topic but I had to ask!

    Here is my web page :: 부산토닥이 도박

  2. Почему пользователи выбирают площадку KRAKEN?

    Маркетплейс KRAKEN заслужил доверие многочисленной аудитории благодаря
    сочетанию ключевых факторов.
    Во-первых, это широкий и разнообразный ассортимент, представленный сотнями продавцов.
    Во-вторых, интуитивно понятный интерфейс KRAKEN, который упрощает навигацию,
    поиск товаров и управление заказами даже для
    новых пользователей. В-третьих, продуманная система безопасных транзакций,
    включающая механизмы разрешения споров
    (диспутов) и возможность использования
    условного депонирования, что минимизирует риски для обеих сторон сделки.
    На KRAKEN функциональность сочетается с внимательным отношением к безопасности клиентов, что
    делает процесс покупок более предсказуемым, защищенным и, как следствие, популярным
    среди пользователей, ценящих анонимность и надежность.

  3. Have you ever thought about adding a little bit more than just your articles?
    I mean, what you say is important and everything.
    But think about if you added some great photos or videos to give your posts more, “pop”!
    Your content is excellent but with images and videos, this blog could undeniably be one of the very best in its niche.

    Great blog!

  4. Good day! I know this is somewhat off topic but I was
    wondering which blog platform are you using for this site?
    I’m getting fed up of WordPress because I’ve had issues with hackers and
    I’m looking at options for another platform. I would be
    great if you could point me in the direction of a good platform.

    My web page … Roofing

  5. Hey I know this is off topic but I was wondering
    if you knew of any widgets I could add to my blog that automatically tweet my newest twitter updates.

    I’ve been looking for a plug-in like this folding electric bikes for adults
    quite some time and was hoping maybe you would have some experience with something like this.
    Please let me know if you run into anything. I truly enjoy reading your blog and I look forward to your new updates.

  6. Singapore’ѕ consistent top rankings in global assessments
    like TIMSS аnd PISA have madе supplementary primary math tuition nearly universal among families aiming to preserve tһɑt world-class standard.

    Іn Singapore’ѕ rigorous secondary education landscape, math tuition ƅecomes indispensable fоr sstudents to deeply master challenging topics ѕuch aѕ algebra, geometry, trigonometry, аnd statistics tһat fⲟrm tһe core
    foundation fоr O-Level achievement.

    Ꭺ ⅼarge proportion ᧐f JC students tuгn t᧐ math tuition tⲟ gain mastery ονer and
    hone precise methods fоr the abstract, proof-oriented
    questions that define Η2 Math examination papers.

    Online math tuition stands օut for primary students іn Singapore whoѕe parents
    ԝant regular structured support wіthout long commutes, effectively reducing stress ѡhile
    strengthening еarly probⅼem-solving skills.

    Flexible pacing in OMT’ѕ e-learning ⅼets trainees
    enjoy mathematics triumphes, building deep love аnd inspiration fоr exam performance.

    Established іn 2013 by Mг. Justin Tan, OMT Math Tuition һas
    actᥙally helped many students ace exams ⅼike PSLE, Ο-Levels,
    and A-Levels witһ proven ρroblem-solving techniques.

    Αs mathematics underpins Singapore’ѕ reputation fοr excellence іn worldwide standards like PISA,
    math tuition іѕ key to opening а child’s potential and
    protecting academic advantages in thіs core subject.

    Ϝor PSLE achievers, tuition ߋffers mock examinations and
    feedback, assisting refine responses fоr optimum marks іn both multiple-choice ɑnd open-еnded sections.

    By usіng considerable exercise ᴡith ρast O Level papers, tuition gears սp pupils witrh familiarity аnd the capability to prepare
    fߋr inquiry patterns.

    Junior college math tuition promotes vital thinking skills required tо solve non-routine problemms that typically show up in ALevel mathematics analyses.

    OMT sets іtself apɑrt with аn exclusive
    curriculum tһаt extends MOE ⅽontent by consisting of enrichment activities
    aimed аt developing mathematical intuition.

    Flexible tests adjust tо ʏour level lah, challenging you perfect tօ continuously raise yοur test scores.

    Tuition exposes pupils tо diverse inquiry kinds,
    broadening tһeir readiness for unpredictable Singapore mathematics
    examinations.

    Ηere is my webpage :: online math tuition Singapore for accelerated learning

  7. Howdy just wanted to give you a brief heads up and let you know a few of the images aren’t loading correctly.
    I’m not sure why but I think its a linking issue. I’ve tried it in two different web browsers
    and both show the same outcome.

  8. Right away I am going away to do my breakfast, once having my breakfast coming again to
    read more news.

  9. I recently came across an eye-opening article about this crypto service Paybis and
    honestly I didn’t expect much at first but it
    impressed me.
    The guide shared insights on how people are using crypto in smarter ways, and it wasn’t full of complicated jargon.

    After going through it, I shared it with my uncle, and he decided to explore it.
    Within the next month, he became way more financially aware.

    He didn’t just sit around — he started testing things carefully.
    Eventually, he managed to reach around 100k — not overnight, but through learning.

    What surprised me most is how his lifestyle changed.
    He even treated himself to a new car, something like a BMW 3 Series, and became more confident.
    He even met someone new who shares his lifestyle.

    Of course results can vary, but the story is true
    from what I’ve seen, and that article definitely changed the way we look at
    money.
    There’s actually a reference mentioned here,
    and I’d seriously suggest reading it.
    Opportunities are everywhere if you look closely.

  10. Thank you, I have recently been searching for info approximately this subject for
    a long time and yours is the best I have found out so
    far. But, what in regards to the conclusion? Are you sure about the supply?

  11. Kazanma büyüsü ile şansı kendi tarafına çek, iş ve finans hayatında fırsatların peş peşe gelmesini sağla. 1648

  12. Hi there, this weekend is nice for me, for the reason that this point in time i am reading this wonderful educational piece of
    writing here at my house.

  13. Hey there! I’m at work surfing around your blog from my new
    iphone 4! Just wanted to say I love reading your blog and look forward to all your posts!
    Carry on the outstanding work!

  14. Hey! I could have sworn I’ve been to this website before but after browsing through some of the post I realized it’s
    new to me. Anyways, I’m definitely delighted I found it and I’ll be book-marking and checking back frequently!

  15. Great post! I totally agree — the Plinko Online Game is
    one of the most exciting options right now.
    The moment when the Plinko ball drops and bounces around is always intense.

    If anyone wants simple mechanics with real winning chances, the Plinko Money Game is perfect.

  16. Very good information. Lucky me I recently found your website by chance (stumbleupon).

    I have saved it for later!

  17. This is a very informative post. I really appreciate how clearly everything
    is explained, especially for people who are new to online casino platforms.

    The way you describe the features, usability, and overall
    experience makes it easy to understand and compare
    with other websites. I also like that the content
    focuses on safety, convenience, and user experience.

    Thanks for sharing such useful information. I will definitely check out more articles on this site.

  18. Hi there, I discovered your site via Google
    while searching for a comparable subject, your web site came up, it seems to be great.
    I have bookmarked it in my google bookmarks.
    Hello there, simply was aware of your weblog thru Google, and
    located that it’s really informative. I’m going to be
    careful for brussels. I will be grateful in the event you continue this in future.
    Lots of other people will probably be benefited from your writing.
    Cheers!

  19. I constantly spent my half an hour to read this weblog’s articles all the time along with a cup
    of coffee.

  20. USD777 CapitalSpas menyediakan layanan spa massage
    terbaik untuk relaksasi, healing, dan kesehatan tubuh dengan terapis profesional,
    suasana nyaman, serta berbagai pilihan perawatan berkualitas untuk membantu mengurangi
    stres dan menjaga kebugaran tubuh

  21. It’s going to be finish of mine day, but before ending I am reading this great piece of writing to
    improve my experience.

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>