1

I wrote this excellent question:

How to create a custom validator in Play Framework 2.0?

The point is, the solution applies to the Java Play API.

How to write a custom validator in Scala ?

Community
  • 1
  • 1
Olivier Refalo
  • 50,287
  • 22
  • 91
  • 122

1 Answers1

1

Use the verifying method on Mapping.

For example:

Form("foo" -> text.verifying{ txt => txt.startsWith("bar") })
Julien Richard-Foy
  • 9,634
  • 2
  • 36
  • 42