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

  1. Hmm it seems like your site ate my first comment (it was super long) so I guess I’ll just sum it up what I had written and say, I’m thoroughly enjoying your blog.
    I too am an aspiring blog blogger but I’m still new
    to everything. Do you have any helpful hints for beginner blog writers?
    I’d definitely appreciate it.

  2. Spot on with this write-up, I actually believe that
    this web site needs a lot more attention. I’ll probably be back again to read more, thanks for
    the advice!

  3. What’s up to every body, it’s my first pay a visit of this webpage;
    this website consists of awesome and actually
    fine stuff for visitors.

  4. Primary-level math tuition іs essential f᧐r sharpening logical reasoning аnd ρroblem-solving abilities
    neеded to tackle thе increasingly complex ԝord problems encountered іn upper primary grades.

    More thɑn merely improving scores, secondary math tuition cultivates emotional resilience
    аnd greatⅼy reduces exam-гelated stress durіng one of the
    mօst intense stages of a teenager’ѕ academic
    journey.

    Ϝor JC students struggling ԝith tһe transition to ѕelf-directed һigher education, оr those targeting tһe jսmp from gooⅾ tο excellent, math tuition providces tһe
    critical edge neeԀеd tߋ distinguish tһemselves іn Singapore’ѕ highly
    meritocratic post-secondary environment.

    Ϝor time-pressed Singapore families, online math tuition ɡives primary children direct connection ѡith qualified instructors throuɡh video platforms, siցnificantly building confidence in core MOE syllabus
    ɑreas ѡhile removing commuting stress.

    Вy commemorating tiny triumphes underway monitoring,
    OMT supports а positive relationship ᴡith math,
    motivating trainees fⲟr examination quality.

    Prepare fⲟr success іn upcoming exams ԝith OMT Math Tuition’s proprietary curriculum, ϲreated to
    foster vital thinking ɑnd confidence in every trainee.

    Ӏn Singapore’s extensive education system,
    where mathematics іs mandatory and consumes around 1600 hoսrs οf curriculum
    tіme іn primary and secondary schools, math tuition еnds up Ƅeing necessarү to һelp trainees build а strong foundation fоr ⅼong-lasting success.

    primary school tuition іs very important f᧐r PSLE as it uses remedial assistance fߋr topics
    likе wholе numƅers and measurements, guaranteeing no fundamental weaknesses persist.

    Ɗetermining and rectifying ϲertain eak points, ⅼike in chance ߋr coordinate geometry, mɑkes secondary tuition indispensable fօr
    O Level excellence.

    Junior college tuition supplies accessibility tо additional sources ⅼike
    worksheets ɑnd video clip explanations, strengthening Α Level
    curriculum insurance coverage.

    OMT’ѕ distinct method features a curriculum tһat matches tһe MOE
    structure ԝith collaborative aspects, urging peer discussions ߋn math ideas.

    Combination with school research leh, maқing tuition a seamless extension fߋr quality
    enhancement.

    Withh math Ƅeing a core subject tһat influences ցeneral
    scholastic streaming, tuition assists Singapore students protect mᥙch bеtter
    grades and brighter future chances.

    mʏ һomepage – maths tuition jc

  5. Appreciating the commitment you put into your site and
    detailed information you offer. It’s good to come across a blog every once
    in a while that isn’t the same unwanted rehashed information. Wonderful read!
    I’ve saved your site and I’m adding your RSS feeds to my Google
    account.

  6. I must thank you for the efforts you’ve put in penning this blog.
    I am hoping to check out the same high-grade blog posts by you later on as well.
    In fact, your creative writing abilities has inspired me to get my own blog now ;)

  7. I needed to thank you for this fantastic read!!

    I definitely loved every bit of it. I have got
    you saved as a favorite to check out new things you post…

  8. Hello, i believe that i noticed you visited my web site so i came to go back the desire?.I’m trying to in finding things to enhance
    my website!I guess its ok to use some of your ideas!!

  9. Just wish to say your article is as surprising. The clearness to your submit
    is just cool and that i could assume you are an expert on this subject.

    Fine along with your permission let me to grab your feed to stay up to date with forthcoming post.
    Thank you 1,000,000 and please continue the enjoyable work.

  10. I value the wide token selection and quick deposits. This site is reliable. My withdrawals were always smooth.

  11. Wonderful beat ! I wish to apprentice while you amend your web
    site, how can i subscribe for a blog site? The account helped me
    a acceptable deal. I had been tiny bit acquainted of this your broadcast provided bright
    clear idea

  12. You could certainly see your expertise within the work you write.

    The sector hopes for even more passionate writers such
    as you who are not afraid to mention how they believe.
    At all times go after your heart.

  13. These are genuinely wonderful ideas in on the topic of blogging.
    You have touched some pleasant things here. Any way keep up wrinting.

  14. Just wish to say your article is as astonishing.
    The clarity in your post is simply nice and i could assume you
    are an expert on this subject. Well with your permission allow
    me to grab your RSS feed to keep up to date with forthcoming
    post. Thanks a million and please carry on the rewarding work.

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>