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.

18,671 thoughts on “Play Framework HTML5 input elements

  1. This is my first time pay a visit at here and i
    am genuinely happy to read everthing at single place.

  2. Good post. I learn something new and challenging on websites I stumbleupon every day.
    It will always be interesting to read articles from
    other writers and use something from their web sites.

  3. Avoided Santa’s Gift Rush after the patch, came back this week, same vibe as before.

  4. Right away I am going to do my breakfast, when having my breakfast coming
    over again to read other news.

  5. VermeerAI is an all-in-one AI image generation and editing platform featuring
    advanced tools like ChatGPT image generator and free AI image generator for instant creative results.
    With GPT Image 2 technology and a Free Unlimited AI image generator,
    users can generate professional-quality visuals effortlessly.
    The platform also provides an AI photo editor, background remover, HEIC to JPG
    converter, and WebP to PNG conversion tools. VermeerAI.art helps users
    streamline their creative workflow by combining AI-powered image creation and smart editing features in one easy-to-use platform for personal and professional use.

  6. I personally find that i was skeptical, but after a week of trading, the trustworthy service convinced me.

  7. بخوام خودمونی بگم، اولش فکر نمی‌کردم چیز
    خاصی ببینم ولی چند بخشش برام قابل توجه بود.
    سلام دوستان، این بار گفتم تجربه وبرداشتم رو بنویسم.

    مدتی قبل وقتی داشتم درباره بازی‌های آنلاین پولی سرچ می‌کردم به این سایت رسیدم.
    بعد از چند دقیقه بررسی ظاهر ساده اما قابل استفاده‌ای داشت.
    به نظرم در این حوزه نباید عجله کرد.

    یکی از آشناهای من بیشتر از همه روی امنیت و قابل فهم بودن توضیحات حساس بود.
    به همین خاطر چند بخش رو با حوصله‌تر
    خوندم. چیزی که باعث شد چند دقیقه بیشتربمونم این بود که توضیحاتش خیلی پیچیده نوشته نشده بود.
    در عین حال بهتره کاربر قبل از هر اقدامی خودش هم تحقیق
    کنه. برای کاربرانی که می‌خوان قبل از تصمیم‌گیری دید بهتری داشته باشن، این سایت می‌تونه یکی از گزینه‌های بررسی باشه.

    درکنار این موضوع دامنه‌هایی مثل еnejaronline همراه
    با سایت sіbbet نمونه‌هایی هستن که
    باعث می‌شن آدم بیشتر دنبال بررسی و مقایسه بره.
    یکی از بچه‌ها که اسمش رضا بود،
    می‌گفت مشکل خیلی از سایت‌ها اینه که فقط شعار می‌دن ولی توضیح درست نمی‌دن؛ برای همین من هم بیشتر به متن‌ها دقت کردم.

    در مجموع به نظرم می‌شه به عنوان یک گزینه قابل بررسی بهش نگاه کرد.

    فکر می‌کنم منطقی‌تره با دید باز و
    منطقی جلو بره. در پایان، برداشت من اینه که این سایت برای بررسی اولیه می‌تونه مفید باشه، ولی تصمیم نهایی همیشه
    باید با تحقیق شخصی و مقایسه چند گزینه گرفته بشه.

    Check out my blog :: ۳ مزیت طلایی استفاده از فیلترشکن برای بازی کازینو, https://betbroreview.com/vpn-for-betting-Sites,

  8. I get pleasure from, cause I discovered just what I used to be looking for.
    You have ended my 4 day long hunt! God Bless
    you man. Have a nice day. Bye

  9. Hi would you mind stating which blog platform you’re using?
    I’m planning to start my own blog soon but I’m having a hard time choosing between BlogEngine/Wordpress/B2evolution and Drupal.
    The reason I ask is because your layout seems different then most blogs and
    I’m looking for something unique. P.S Apologies for being off-topic but I had to ask!

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>