From 1a5c97dbda86a7981619248ffb01148c30a6a3a7 Mon Sep 17 00:00:00 2001 From: bumfresh Date: Mon, 17 Jun 2019 13:39:42 +0200 Subject: [PATCH] warn on negative quantity for sending fairs --- faircoin/templates/faircoin/faircoin_account.html | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/faircoin/templates/faircoin/faircoin_account.html b/faircoin/templates/faircoin/faircoin_account.html index 90975ce15..d6ef9d428 100644 --- a/faircoin/templates/faircoin/faircoin_account.html +++ b/faircoin/templates/faircoin/faircoin_account.html @@ -406,9 +406,11 @@

jQuery.validator.addMethod("quantity", function(value, element) { var isValidQuantity = /^\d{0,6}(\.\d{0,4})?$/.test(value); + if isValidQuantity and parseFloat(value) <= 0: + isValidQuantity = false; return this.optional(element) || isValidQuantity; }, - "Please enter a number less than 1000000 with no more than 4 decimal places" + "Please enter a positive number less than 1000000 with no more than 4 decimal places" ); $.validator.addClassRules("quantity", { quantity: true });