Reputation: 663
I have tried to validate form input only for numbers, I it pop-up an error message
Read from stdout: D:\PROJECTS\test\SimpleRequest19-DBCon_Session\app\controllers\Prodcuts.scala:24: not found: value number
Here is the helper
@helper.inputText(productCreateForm("prosupprice"),'_help -> "",'_label -> "Supplier Price",'_showConstraints -> false)</div>
here is the validation function
private val productCreateForm: Form[Product] = Form(
mapping(
"proname" -> nonEmptyText,
"proprice" -> nonEmptyText,
"prodes" -> nonEmptyText,
"probrand" -> nonEmptyText,
"protype" -> nonEmptyText,
"prosupplier" -> nonEmptyText,
"prosupcode" -> nonEmptyText,
"prosupprice"-> number
)(Product.apply)(Product.unapply)
)
Upvotes: 1
Views: 316
Reputation: 2631
Check your imports. You should have play.api.data.Forms._
maybe you have only play.api.data.Forms.nonEmptyText
Upvotes: 1