From 09ef8bda5b90c8a8d9ea149206e8fc0f4378c6f0 Mon Sep 17 00:00:00 2001
From: prasad <prasad@vtiger.com>
Date: Sun, 11 Feb 2018 18:18:17 +0530
Subject: [PATCH] Fixes #519: Validation for whole-number

---
 layouts/v7/modules/Vtiger/resources/validation.js | 11 ++++++-----
 1 file changed, 6 insertions(+), 5 deletions(-)

diff --git a/layouts/v7/modules/Vtiger/resources/validation.js b/layouts/v7/modules/Vtiger/resources/validation.js
index 1bc01e4cb..e870d8cbe 100644
--- a/layouts/v7/modules/Vtiger/resources/validation.js
+++ b/layouts/v7/modules/Vtiger/resources/validation.js
@@ -62,14 +62,15 @@ jQuery.validator.addMethod("double", function(value, element, params) {
 
 
 jQuery.validator.addMethod("WholeNumber", function(value, element, params) {
-	var regex= /[+]/;
-	if(value.match(regex)){
-		return;
+		var regex= /[^+\-0-9.]+/; // not number?
+		
+		if(value.match(regex)){
+			return false;
+		}
 
-		if((value % 1) != 0){
+		if((value % 1) != 0){  // is decimal?
 			return false;
 		}
-	}
 		return true;
 	}, jQuery.validator.format(app.vtranslate('INVALID_NUMBER'))
 );
-- 
GitLab