Using the doc, I can set my own helper for the layout surrending my field, but I'd like to personalize also some fields given by play.
The main reason is for Twitter Bootstrap 2, where I need to change (in checkbox.scala.html)
@input(field, args:_*) { (id, name, value, htmlArgs) =>
<input type="checkbox" id="@id" name="@name" value="@boxValue" @(if(value == Some(boxValue)) "checked" else "") @toHtmlArgs(htmlArgs.filterKeys(_ == 'value))>
<span>@args.toMap.get('_text)</span>
}
to :
<label class="checkbox">
<input type="checkbox" name="@name" id="@id" value="@boxValue" @(if(value == Some(boxValue)) "checked" else "") @toHtmlArgs(htmlArgs.filterKeys(_ == 'value)) />
@args.toMap.get('_text)
</label>
How can I do that ? Thanks for your help!
It will be simpler to just write your own tag with the code you want and use it instead of the provided helper. It will simplify potential issues related to overwritting platform tags.
I finally did it like this :
I created a package views.helpers.form, that contains :
bootstrap.scala.html :
checkbox.scala.html :
And in my template, all I have to do is :
And voilà! It works!