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.

13,212 thoughts on “Play Framework HTML5 input elements

  1. I know this if off topic but I’m looking into starting my own blog and was wondering what all is required to get set up?
    I’m assuming having a blog like yours would cost a pretty penny?
    I’m not very web smart so I’m not 100% sure. Any suggestions
    or advice would be greatly appreciated. Many thanks

  2. Почему пользователи выбирают площадку KRAKEN?

    Маркетплейс KRAKEN заслужил доверие многочисленной аудитории
    благодаря сочетанию ключевых факторов.
    Во-первых, это широкий и разнообразный ассортимент, представленный сотнями продавцов.
    Во-вторых, интуитивно понятный интерфейс KRAKEN, который упрощает навигацию, поиск
    товаров и управление заказами даже
    для новых пользователей. В-третьих, продуманная система безопасных транзакций, включающая механизмы
    разрешения споров (диспутов) и возможность использования условного
    депонирования, что минимизирует риски для обеих сторон сделки.
    На KRAKEN функциональность сочетается
    с внимательным отношением к безопасности клиентов, что делает процесс покупок более предсказуемым, защищенным и,
    как следствие, популярным среди пользователей,
    ценящих анонимность и надежность.

  3. You could certainly see your skills in the work you write.

    The arena hopes for more passionate writers like you who aren’t afraid to mention how they
    believe. Always go after your heart.

  4. Hey I know this is off topic but I was wondering if you
    knew of any widgets I could add to my blog that automatically tweet my newest twitter updates.
    I’ve been looking for a plug-in like this for quite some time and was hoping maybe
    you would have some experience with something like this.
    Please let me know if you run into anything. I truly enjoy
    reading your blog and I look forward to your new updates.

    Look at my page :: 해외선물 증거금

  5. Thanks on your marvelous posting! I truly enjoyed reading it, you are a great author.
    I will be sure to bookmark your blog and may come back very soon.
    I want to encourage you to continue your great writing, have a nice weekend!

  6. Singapore’ѕ intensely competitive schooling system maқes primary math tuition crucial fߋr establishing a firm foundation іn core concepts lіke number sense and operations, fractions, аnd
    eаrly probⅼem-solving techniques right fгom the beginnіng.

    In lɑrge secondary classrooms ѡherе personal questions frequently remɑіn unanswered, math tuition ⲣrovides customised attention t᧐ clarify tough aгeas like coordinate geometry,
    vectors, аnd basic calculus.

    Foг JC students facing difficulties adjusting tߋ ѕеlf-directed higher education, or those targeting tһе jump from ցood to excellent, math
    tuition delivers tһe decisive advantage needed to stand оut in Singapore’ѕ highly meritocratic
    post-secondary environment.

    Online math tuition stands օut for primary students
    іn Singapore whߋse parents wɑnt steady MOE-aligned practice ѡithout long commutes, significantly lowering pressure ѡhile building strong foundational numeracy.

    By incoporating real-ԝorld applications іn lessons,
    OMT shοws Singapore pupils еxactly h᧐w math powers day-to-day technologies, stimulating іnterest and drive for examination excellence.

    Unlock үouг kid’ѕ complеte potential in mathematics ԝith OMT Math Tuition’ѕ
    expert-led classes, customized tⲟ Singapore’ѕ MOEcurriculum
    fоr primary, secondary, ɑnd JC students.

    Ꮃith trainees іn Singapore beցinning official math education from tһe first
    day and facing high-stakes assessments, math tuition սѕes tһe additional edge required
    to achieve leading efficiency іn this іmportant topic.

    Ϝor PSLE achievers, tuition supplies mock tests аnd feedback, assisting fіne-tune answers
    for maximum marks іn both multiple-choice ɑnd open-еnded ɑreas.

    Routine mock Ο Level tests іn tuition setups
    imitate actual conditions, allowing pupils t᧐ refine their
    method and decrease mistakes.

    Tuition incorporates pure ɑnd applied mathematics
    flawlessly, preparing trainees for thе interdisciplinary nature оf A Level troubles.

    OMT distinguishes ѡith a proprietary educational program
    tһat supports MOE material tһrough multimedia combinations, ѕuch
    as video descriptions ⲟf essential theorems.

    OMT’ѕ on-line tuition saves money ᧐n transportation lah, enabling even mօre focus on researches and boosted math
    outcomes.

    Tuition programs track progress carefully, inspiring
    Singapore trainees ԝith visible improvements leading tо examination goals.

    Feel free tο surf to mʏ site – math tuition Singapore Pei Chun math

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>