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

php - How should I create my API for mobile applications (Needs Authentication) -

5 Reasons to Blog Anonymously (and 5 Reasons Not To)

Google AdWords and AdSense - A Dynamic Small Business Marketing Duo