Reputation: 5951
does anybody know how to add boolean attributes
like autofocus
to scala templates?
Example: autofocus
:
<input autofocus />
For now I use:
'autofocus -> "autofocus"
This prints:
<input type="text" autofocus="autofocus" />
And how to add custom data-attributes? Thanks!
Upvotes: 2
Views: 517
Reputation: 22375
Use None
, like this:
@inputText(
loginForm("username"),
'_label -> Messages("usernameLabel"),
'required -> None,
'autofocus -> None
)
It will output an element like this:
<input type="text" id="username" name="username" value="" required autofocus>
Upvotes: 1
Reputation: 5951
This works, but still I (hope) think there should be an easier way in scala!
'autofocus -> "autofocus"
Upvotes: 0