Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Playframework: Helpers to generate HTML5 input (type="email" or type="url")?

In Play 2.0 templates, there are some helpers to build form inputs: @inputText, @inputPassword, etc.

With existing helpers, I did not find a way to build HTML5 input like these:

<input type="email" ... />
<input type="url" ... />

Do I need to make my own helpers, or did I miss something?

like image 671
Maaaaat Avatar asked Feb 21 '23 01:02

Maaaaat


2 Answers

Play 2.0 view helper are defined in package views.helper. HTML 5 new types are currently missing from the list. But it should be really easy to extend it yourself. See for example the @inputPassword source.

like image 51
paradigmatic Avatar answered Apr 27 '23 18:04

paradigmatic


Seems some one already fixed this in 2.0.4. You can now do this:

@inputText(
  myform("email"),
  '_showConstraints -> false,
  '_label -> Messages("label.email"),
  'type -> "email"
)
like image 32
Eldelshell Avatar answered Apr 27 '23 19:04

Eldelshell