Play Framework 2.1-RC1 Error value message is not a member of Option[play.api.data.FormError]

StackOverflow https://stackoverflow.com/questions/13554848

  •  02-12-2021
  •  | 
  •  

Pergunta

I tried to upgrade Play 2.0 app to 2.1-RC1 and now it does not compile. I get the below error message:

value message is not a member of Option[play.api.data.FormError]

The line where above message is thrown is

<p class="error">@form.globalError.message</p>
Foi útil?

Solução

The issue is that in 2.1 form.globalError is an Option, so you'll need to do a get before accessing the FormError.

Something like:

@form.globalError.get.message

Be aware that could fail if the Option is None. Better use pattern matching or getOrElse to be safe.

Licenciado em: CC-BY-SA com atribuição
Não afiliado a StackOverflow
scroll top