Olivier Refalo
Olivier Refalo

Reputation: 51435

How to create a Scala custom validator with Play2?

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 ?

Upvotes: 1

Views: 947

Answers (1)

Julien Richard-Foy
Julien Richard-Foy

Reputation: 9663

Use the verifying method on Mapping.

For example:

Form("foo" -> text.verifying{ txt => txt.startsWith("bar") })

Upvotes: 1

Related Questions