Skip to content

Instantly share code, notes, and snippets.

@gakuzzzz
Created December 17, 2012 10:29
Show Gist options
  • Save gakuzzzz/4317301 to your computer and use it in GitHub Desktop.
Save gakuzzzz/4317301 to your computer and use it in GitHub Desktop.
数値with必須チェック
import play.api.data.Form
import play.api.data.Forms._
import play.api.data.validation.Constraints._
val taskForm = Form(
single(
"hoge" -> nonEmptyText.verifying(pattern("""-?\d+""".r, error = "number")).transform[Int](_.toInt, _.toString)
)
)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment