score:1

I got the same error and in my case, I forgot to make request implicit. I hope this answer helps if you change the code as Achraf answered but still have the error.

def foo() = Action { implicit request =>
    Ok(html.index(form))
}

score:14

The play framework forms handling has changed between version 2.5 and 2.6, in order to make thing works you have to change the declaration of your Application class as follow :

import javax.inject._
import play.api.i18n.I18nSupport

class Application @Inject()(val cc: ControllerComponents) extends AbstractController(cc) with I18nSupport

and in your view add an implicit parametre as follow :

@(customerForm:Form[Customer])(implicit request: RequestHeader, messagesProvider: MessagesProvider)

If you dont need the RequestHeader in your view you may omit its declaration.

Please refer to the link in your error message for more information : https://www.playframework.com/documentation/2.6.x/ScalaForms#Passing-MessagesProvider-to-Form-Helpers


Related Query