浏览代码

#999: Replace ',' with '.' to validate decimal numbers correct, thanks to @johanronn77

Phuoc Nguyen 11 年之前
父节点
当前提交
0afd5ef1c8

+ 1 - 0
CHANGELOG.md

@@ -11,6 +11,7 @@ __New Features__
 __Improvements__
 * [#823](https://github.com/nghuuphuoc/bootstrapvalidator/issues/823): The [hexColor](http://bootstrapvalidator.com/validators/hexColor/) validator only accepts 6 hex character values when using HTML 5 ```type='color'``` attribute
 * [#864](https://github.com/nghuuphuoc/bootstrapvalidator/pull/864): Coma separator handling in [greaterThan](http://bootstrapvalidator.com/validators/greaterThan/), [lessThan](http://bootstrapvalidator.com/validators/lessThan/) validators, thanks to [@mgibas](https://github.com/mgibas)
+* [#999](https://github.com/nghuuphuoc/bootstrapvalidator/pull/999): Replace ',' with '.' to validate decimal numbers correct, thanks to [@johanronn77](https://github.com/johanronn77)
 * [#1002](https://github.com/nghuuphuoc/bootstrapvalidator/pull/1002): Put tooltip/popover on bottom if there is not enough space on top, thanks to [@jazzzz](https://github.com/jazzzz)
 
 __Bug Fixes__

+ 1 - 1
dist/css/bootstrapValidator.min.css

@@ -2,7 +2,7 @@
  * BootstrapValidator (http://bootstrapvalidator.com)
  * The best jQuery plugin to validate form fields. Designed to use with Bootstrap 3
  *
- * @version     v0.5.3-dev, built on 2014-10-21 8:23:41 AM
+ * @version     v0.5.3-dev, built on 2014-10-21 8:33:17 AM
  * @author      https://twitter.com/nghuuphuoc
  * @copyright   (c) 2013 - 2014 Nguyen Huu Phuoc
  * @license     MIT

+ 7 - 7
dist/js/bootstrapValidator.js

@@ -2,7 +2,7 @@
  * BootstrapValidator (http://bootstrapvalidator.com)
  * The best jQuery plugin to validate form fields. Designed to use with Bootstrap 3
  *
- * @version     v0.5.3-dev, built on 2014-10-21 8:23:41 AM
+ * @version     v0.5.3-dev, built on 2014-10-21 8:33:17 AM
  * @author      https://twitter.com/nghuuphuoc
  * @copyright   (c) 2013 - 2014 Nguyen Huu Phuoc
  * @license     MIT
@@ -2024,6 +2024,8 @@ if (typeof jQuery === 'undefined') {
             if (value === '') {
                 return true;
             }
+
+			value = value.replace(',', '.');
             if (!$.isNumeric(value)) {
                 return false;
             }
@@ -3157,9 +3159,8 @@ if (typeof jQuery === 'undefined') {
             if (value === '') {
                 return true;
             }
-            if (value.indexOf(',') > -1){
-                value = value.replace(',', '.');
-            }
+            
+            value = value.replace(',', '.');
             if (!$.isNumeric(value)) {
                 return false;
             }
@@ -5414,9 +5415,8 @@ if (typeof jQuery === 'undefined') {
             if (value === '') {
                 return true;
             }
-            if (value.indexOf(',') > -1){
-                value = value.replace(',', '.');
-            }
+            
+			value = value.replace(',', '.');
             if (!$.isNumeric(value)) {
                 return false;
             }

文件差异内容过多而无法显示
+ 4 - 4
dist/js/bootstrapValidator.min.js


+ 2 - 1
src/js/validator/between.js

@@ -47,7 +47,8 @@
             if (value === '') {
                 return true;
             }
-			value = value.replace(',','.');
+
+			value = value.replace(',', '.');
             if (!$.isNumeric(value)) {
                 return false;
             }