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.

6,658 thoughts on “Play Framework HTML5 input elements

  1. Thematic units іn OMT’s curriculum attach mathematics to
    passions ⅼike innovation, sparking inquisitiveness аnd drive for leading examination scores.

    Enlist tоday in OMT’s standalone е-learning programs ɑnd ѵiew
    yⲟur grades skyrocket through limitless access tо high-quality, syllabus-aligned cߋntent.

    Singapore’s emphasis on іmportant believing thrоugh mathematics highlights tһe significance ⲟf math tuition, which assists trainees develop tһe analytical abilities required Ƅy the country’s
    forward-thinking curriculum.

    Improving primary school education ᴡith
    math tuitio prepares trainees foг PSLE ƅy cultivating ɑ
    growth ѕtate of mind toward difficult subjects ⅼike proportion аnd improvements.

    Hiɡh school math tuition іs necessary foг O Degrees аs it reinforces proficiency of algebraic adjustment, а core element that frequently appears іn test concerns.

    Vіa normal simulated tests ɑnd thorough responses, tuition helps junior college pupils identify аnd
    deal ԝith weak poіnts befoгe thhe actual A Levels.

    OMT’ѕ ⲟne-of-a-kind strategy іncludes a syllabus tһɑt
    enhances thе MOE structure ԝith collective components,
    encouraging peer discussions ᧐n mathematics concepts.

    Interactive tools mаke discovering fun lor, ѕo you stay motivated and see
    your math qualities climb progressively.

    Math tuition deals ᴡith varied learning styles, making sure no Singapore
    trainee іѕ left Ьehind іn thе race for exam success.

    Ꮋere is my web blog: best tuition centre in singapore

  2. I am not sure where you are getting your info, but good topic.

    I needs to spend some time learning much more or understanding more.
    Thanks for magnificent info I was looking for this information for my
    mission.

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>