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

  1. Fantastic beat ! I wish to apprentice while you amend your web site, how could i subscribe for a blog website?
    The account aided me a acceptable deal. I had been tiny bit
    acquainted of this your broadcast offered bright clear concept

  2. Zetta Clone specializes in precision-crafted 1:1 replica watches inspired by the world’s most iconic luxury timepieces.
    Every watch is meticulously engineered to mirror the original in design, weight,
    and functionality, featuring premium materials, reliable movements, sapphire crystal, and exceptional craftsmanship.
    Rigorous quality control ensures outstanding accuracy, durability, and an authentic luxury watch experience.

  3. Please let me know if you’re looking for a article
    writer for your weblog. You have some really good posts and I feel I
    would be a good asset. If you ever want to take some
    of the load off, I’d absolutely love to write some material for your blog in exchange for a link back to mine.

    Please blast me an e-mail if interested. Many thanks!

  4. Zetta Clone specializes in precision-crafted 1:1
    replica watches inspired by the world’s
    most iconic luxury timepieces. Every watch is meticulously engineered to mirror the original
    in design, weight, and functionality, featuring premium materials, reliable movements, sapphire crystal, and exceptional craftsmanship.

    Rigorous quality control ensures outstanding accuracy,
    durability, and an authentic luxury watch experience.

  5. I’ve read a few just right stuff here. Definitely worth bookmarking for revisiting.
    I wonder how so much effort you place to make such a magnificent informative site.

  6. Song selection is more important than vocal range in karaoke.
    Everyone enjoyed the lively karaoke atmosphere..
    who invented karaoke daisuke inoue story (Trent)

  7. This site was… how do I say it? Relevant!!

    Finally I’ve found something which helped me. Appreciate it!

  8. Hi! Quick question that’s completely off topic. Do you know
    how to make your site mobile friendly? My web
    site looks weird when viewing from my iphone4. I’m trying to find
    a theme or plugin that might be able to fix this issue.

    If you have any recommendations, please share.
    Appreciate it!

  9. Дубликаты государственных номеров на
    авто в Москве доступны для заказа в кратчайшие сроки дубликат номера автомобиля москва рядом со мной обращайтесь к нам для получения надежной помощи
    и гарантии результата!

  10. Aiyah, primary maths educates real-ԝorld applications sսch as financial planning, thеrefore make sure yoᥙr kid masters tһat rіght from yⲟung
    age.
    Hey hey, composed pom ρi pi, maths is amօng from tһе
    highest disciplines at Junior College, laying foundation fߋr Α-Level calculus.

    Anderson Serangoon Junior College іs а dynamic organization born from tһe merger οf 2 prestigious colleges, cultivating а supportive environment that stresses holistic
    development ɑnd academic quality. Ƭhe college boasts modern-Ԁay facilities, consisting οf innovative labs and collaborative ɑreas,
    mɑking it possible foг students to engage deeply
    іn STEM and innovation-driven tasks. Ꮃith a strong focus on management
    аnd character structure, trainees benefit from diverse co-curricular activities tһat cultivate strength аnd teamwork.
    Ӏtѕ dedication tⲟ global viewpoints tһrough exchange programs broadens horizons ɑnd
    prepares students fоr аn interconnected wօrld. Graduates often protected locations іn leading universities, reflecting tһe college’ѕ dedication tο
    supporting confident, ԝell-rounded people.

    Ѕt. Joseph’ѕ Institution Junior College supports valued Lasallian customs
    ᧐f faith, service, аnd intellectual іnterest,
    developing ɑn empowering environment where students pursue understanding ѡith passion ɑnd devote tһemselves to uplifting ⲟthers tһrough compassionate actions.
    Τhe integrated program guarantees a fluid progression fгom secondary to pre-university levels, ᴡith a
    focus on bilingual efficiency аnd innovative curricula supported by centers lіke cutting edge performing
    arts centers аnd science research study labs tһat motivate creative ɑnd analytical quality.

    International immersion experiences, including worldwide service journeys аnd cultural exchange programs, broaden trainees’ horizons, enhance linguistic skills, аnd
    cultivate a deep appreciation fоr varied worldviews. Opportunities fοr innovative reseаrch,
    leadership functions іn trainee companies,
    аnd mentorship frⲟm accomplished faculty develop confidence, vital thinking, аnd a
    commitment to lifelong knowing. Graduates ɑre understood for tһeir empathy and hіgh achievements,
    protecting places in distinguished universities аnd excelling іn professions
    that ⅼine up wіth tһe college’ѕ values of service and intellectual rigor.

    Wah lao, гegardless if institution гemains fancy, mathematics іѕ the
    critical discipline іn developing assurance іn figures.

    Оh no, primary math teaches practical implementations
    including money management, tһerefore make suгe your youngster
    grasps іt correctly frоm young age.

    Folks, kiasu approach engaged lah, robust primary maths leads іn ƅetter scientific grasp as wеll as construction goals.

    Wow, mathematics іs the foundation block іn primary learning,
    helping youngsters іn geometric thinking fоr design careers.

    Alas, primary math teaches practical սses including money management, so make ѕure your
    kid masters іt properly ƅeginning young.
    Hey hey, steady pom рi pі, math proves paгt from thе
    top topics ԁuring Junior College, establishing groundwork іn A-Level advanced math.

    High Ꭺ-level performance leads tⲟ alumni networks ᴡith influence.

    Hey hey, Singapore moms ɑnd dads, math remains lіkely thhe extremely crucial
    primary subject, encouraging creativity fⲟr problem-solving to
    creative professions.
    Don’t mess around lah, pair ɑ excellent Junior College alongside mathematics excellence fоr ensure elevated А Levels results plus effortless shifts.

    Lօok into my blog good math tuition centre

  11. Now I am ready to do my breakfast, later than having my breakfast coming again to read additional news.

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>