I am trying to build an input helper for Play Framework in Scala.
I would like to have my inputs of type radio and checkbox to be printed differently than the standard text or password input types ?
Here is my custom helper:
@(elements: helper.FieldElements)
<div class="form-group">
<label for="@elements.id" class="col-lg-2 control-label">@elements.label</label>
<div class="col-lg-10">
<input type="text" class="form-control" id="@elements.id" />
</div>
</div>
But this prints an text input instead of checkbox input. Which is strange behaviour.
I've read the documentation, but couldn't find anything about it.
Here is how I import this helper to view:
@implicitFieldConstructor = @{ FieldConstructor(generic.views.html.FormHelpers.twitterBootstrapInputSupraClub.render) }
@checkboxFieldConstructor = @{ FieldConstructor(generic.views.html.FormHelpers.twitterBootstrapInputSupraClubCheckbox.render) }
And this is how I call helpers to build input (generates inputs) in view:
@inputText(
accountRegistrationForm("email"),
'_label -> "email"
)
@inputPassword(
accountRegistrationForm("password"),
'_label -> password
)
@inputRadioGroup(
accountRegistrationForm("regulationAcceptance"),
options = Seq("true"->"Yes"),
'_label -> "I agree with regulation",
'type -> "radio"
)(handler = checkboxFieldConstructor, implicitly[Lang])