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.

7,114 thoughts on “Play Framework HTML5 input elements

  1. An intriguing discussion is worth comment. There’s no doubt that that you should write more on this
    subject, it might not be a taboo matter but generally people do
    not discuss such subjects. To the next! Cheers!!

  2. Every weekend i used to go to see this website, for the
    reason that i wish for enjoyment, since this this web site conations genuinely fastidious funny stuff
    too.

  3. Ϲonsidering the approaching PSLE, Ƅeginning math
    tuition early arms Primary 1 to Primary 6 students witһ confidence pluѕ effective strategies t᧐ excel in major school
    examinations.

    Ꮐiven Singapore’s strong focus ⲟn science аnd technology routes, solid secondary math performance — оften reinforced throuցһ tuition — оpens doors
    tߋward premier junior colleges, tοp polytechnic
    courses, аnd competitive university programmes.

    Math tuition аt junior college level delivers individualised critique
    ɑnd precision-focused techniques tһat mainstream JC lessons oftеn lack thе necesѕary detail foг.

    Secondary students tһroughout Singapore increasingly
    choose virtual Ο-Level preparation to receive іmmediate
    corrections ߋn practice papers ɑnd recurring errors in topics including sequences
    ɑnd differentiation, speeding ᥙp improvement toᴡard
    A1 or Α2 гesults in Additional Mathematics.

    Via real-life study, OMT ѕhows math’ѕ effeсt, assisting Singapore
    students develop а profound love ɑnd test motivation.

    Ԍet ready for success in upcoming exams ѡith OMT Math Tuition’s proprietary curriculum, developed tߋ foster imрortant thinking ɑnd confidence in еvery trainee.

    In Singapore’ѕ strenuous education ѕystem,
    where mathematics iѕ obligatory and consumes aroսnd 1600 hours of curriculum time in primary school and secondary schools, math tuition еnds ᥙp beіng
    vital to assist trainees construct а strong structure fⲟr
    lifelong success.

    Registering іn primary school math tuition еarly fosters confidence, reducing anxiety fߋr PSLE takers ѡho face
    high-stakes concerns оn speed, range, and time.

    Connecting math principles tο real-ѡorld situations thrlugh
    tuition ցrows understanding, mɑking O Level application-based questions а lot more approachable.

    Junior college tuition рrovides accessibility t᧐ supplementary resources ⅼike worksheets annd video clip explanations,
    strengthening А Level syllabus insurance coverage.

    Ꮤһat separates OMT iѕ its custom-maԀe educational program tһat lines up with MOE wһile concentrating ⲟn metacognitive abilities,
    instructing students һow to discover mathematics properly.

    Comprehensive insurance coverage оf subjects sia,
    leaving no spaces іn expertise for leading math achievements.

    With minimal class tіme іn schools, math tuition prolongs finding out hours, critical fоr
    grasping tһе comprehensive Singapore math
    syllabus.

    Ꭺlso visit my webpage jc 1 math tuition

  4. Hi there are using WordPress for your blog platform?

    I’m new to the blog world but I’m trying to get started and create my own. Do you need any coding expertise to make
    your own blog? Any help would be greatly appreciated!

  5. Usually I do not learn post on blogs, but I would like to say that this
    write-up very forced me to try and do so! Your writing style has been amazed me.
    Thank you, very nice article.

  6. Hello there! This blog post couldn’t be written any
    better! Going through this post reminds me
    of my previous roommate! He always kept preaching
    about this. I am going to forward this article to him.
    Fairly certain he will have a good read. Thanks for sharing!

  7. For the reason that the admin of this website is working,
    no uncertainty very shortly it will be renowned, due
    to its feature contents.

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>