How to deal with implict b3 field constructor with the play scala template?

600 Views Asked by At
@(loggedUser: Option[User], loginInfo: Option[LoginInfo], cards: Seq[Card], addCardInput: AddCardInput)(implicit request: RequestHeader, messages: Messages)

@category(card: Card) = {
    <tr>
        <td>
        @b3.form(routes.DeckBuilder.deleteCard()) {
            @helper.CSRF.formField
            @b3.submit('class -> "btn btn-primary") { Submit }
        }
        </td>
    </tr>
    }

@views.html.templates.mainApp(Messages("app.title"), tab = "index", loggedUser = loggedUser, loginInfo = loginInfo)) {
<h2 class="text-primary">Your Cards</h2>
<p class="lead">
@loggedUser.map { user =>

<div class="modal-body">
    <table class="table">
        <tbody>
            @cards.map(grouped => category(grouped))
        </tbody>
    </table>
</div>
}.getOrElse {
    @Html(Messages("index.notLogged", routes.Auth.signIn, routes.Auth.startSignUp)) <br/>
    @Html(Messages("index.resetPassword", routes.Auth.startResetPassword))
}
    </p>
}

The above code produces error

could not find implicit value for parameter fc: views.html.b3.B3FieldConstructor

The error points to the line where I am building the submit button. I'm aware that it requires the implicit field constructor and in another file, I've done this successfully, but that was where the form wasn't in a helper method.

1

There are 1 best solutions below

0
On

You just need to declare the implicit field constructor at the top of your partial (I know - it seems contradictory to declare an implicit.. but this works):

@implicitFieldConstructor = @{ b3.vertical.fieldConstructor }