I use Play2! Scala 2.3.8. I would like to add a default csrfToken for my from, but I do know how. I tried it by this example https://www.playframework.com/documentation/2.3.8/ScalaCsrf
I created a custom global object and I extended my form with :
@helper.form(action = routes.Books.submitBook) {
@helper.CSRF.formField
but I got this error after I had sent the form :
could not find implicit value for parameter token: play.filters.csrf.CSRF.Token
I know CSRF.formField need a parameter, but the example does not contain.
The documentation states the following:
The form helper methods all require an implicit token or request to be available in scope. This will typically be provided by adding an implicit RequestHeader parameter to your template, if it doesn’t have one already.
In order to do that, you have to change your template's parameter list to like this:
@(<your parameters>)(implicit request: RequestHeader)
Collected from the Internet
Please contact [email protected] to delete if infringement.
Comments