Skip to content

Commit b516f6f

Browse files
committed
Update location.dev.js
longlat check is passing invalid co-ordinates, updated regex to only pass valid co-ordinates
1 parent 950cb47 commit b516f6f

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

form-validator/location.dev.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -44,7 +44,7 @@
4444
$.formUtils.addValidator({
4545
name : 'longlat',
4646
validatorFunction : function(str) {
47-
var regexp = /^[+-]?\d+\.\d+, ?[+-]?\d+\.\d+$/;
47+
var regexp = /^[-+]?([1-8]?\d(\.\d+)?|90(\.0+)?),\s*[-+]?(180(\.0+)?|((1[0-7]\d)|([1-9]?\d))(\.\d+)?)$/;
4848
return regexp.test(str);
4949
},
5050
errorMessage:'',
@@ -75,4 +75,4 @@
7575
return $.formUtils.suggest(this, states, settings);
7676
};
7777

78-
})(jQuery);
78+
})(jQuery);

0 commit comments

Comments
 (0)