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.
Fantastic web site. A lot of useful info here. I’m sending it to several friends ans additionally sharing
in delicious. And naturally, thanks to your effort!
Here is my blog – best realtor in Gilbert AZ
Hey would you mind stating which blog platform you’re working with?
I’m looking to start my own blog soon but I’m having a difficult time selecting between BlogEngine/Wordpress/B2evolution and
Drupal. The reason I ask is because your layout seems different
then most blogs and I’m looking for something unique.
P.S My apologies for being off-topic but I had to ask!
Also visit my site … real estate agent Chicago IL