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.

15,610 thoughts on “Play Framework HTML5 input elements

  1. El portal Deporte Ecuador se presenta como un sitio especializado dedicada al
    análisis del panorama deportivo online en Ecuador. La
    plataforma integra artículos que exploran cómo evoluciona el deporte en el país en el contexto de la tecnología, los
    datos y los nuevos hábitos de consumo.
    A diferencia de los sitios convencionales, Deporte
    Ecuador no se limita a cubrir resultados o noticias.

    La prioridad es comprender el funcionamiento
    del ecosistema deportivo moderno: cómo los aficionados se relacionan con los servicios digitales, qué factores influyen en su comportamiento y cómo cambian los criterios de calidad en el entorno digital.

    El contenido del sitio se estructura en torno a distintos ejes temáticos.
    Por un lado, se analizan las plataformas deportivas desde el punto de vista del usuario, la estabilidad
    y la coherencia del servicio. Además, se revisan tendencias del
    mercado, procesos de digitalización y cambios en las formas de consumo deportivo en el
    país.
    Además, el portal también cubre cuestiones regulatorias, la ciberseguridad y la toma de decisiones dentro del entorno online.
    Esto permite ofrecer una visión más completa del sector, combinando análisis
    técnico, escenario nacional y conducta del usuario.

    El propósito central es brindar datos claros, bien estructurados y funcionales
    para comprender cómo funciona el deporte en la era digital.

    No busca dar respuestas simples, sino de ayudar a interpretar un entorno cada vez
    más complejo.
    Deporte Ecuador está dirigido a usuarios que quieren comprender el deporte más allá de lo básico: incluyendo su componente tecnológico
    y su impacto en la experiencia cotidiana.
    El texto menciona que hay un enlace disponible para ampliar el artículo.

  2. I am no longer certain the place you are getting your info,
    however good topic. I must spend some time learning much more or understanding more.
    Thank you for fantastic information I was searching for
    this information for my mission.

  3. Hello! Do you know if they make any plugins to help with Search Engine Optimization? I’m trying
    to get my blog to rank for some targeted keywords but I’m not seeing very good results.
    If you know of any please share. Thanks!

  4. план эвакуации – нормативный документ , указывающий безопасные пути эвакуации и расположение первичных средств пожаротушения.

  5. I pay a quick visit each day a few web sites and
    blogs to read articles, however this webpage gives quality based content.

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>