validation - How to Validate Negative BigDecimals in scala play Framework FORMS? -


i want validate (do not allow) negative amount values , in post request following validation trait have form mapping,

bigdecimal has precision , scale, how make sure of negative bigdecimals coming in request?

  trait bicvalidation extends commonvaldidation {       implicit val bicform = form(         mapping(           "id" -> optional(number),           "name" -> text,           "description" -> optional(text),           "bid" -> optional(number),           "amount" -> bigdecimal         )(bic.apply)(bic.unapply)       )     } 

try

"amount" -> bigdecimal.verifying("amount must negative", => < 0) 

and see docs.


Popular posts from this blog

Apache NiFi ExecuteScript: Groovy script to replace Json values via a mapping file -

node.js - How do I prevent MongoDB replica set from querying the primary? -