Validator: Fix usage of maxLen and maxDecimal in CheckDecimal
This commit is contained in:
@ -70,9 +70,9 @@ namespace Elwig.Helpers {
|
|||||||
for (int i = 0; i < input.Text.Length; i++) {
|
for (int i = 0; i < input.Text.Length; i++) {
|
||||||
char ch = input.Text[i];
|
char ch = input.Text[i];
|
||||||
if (char.IsAsciiDigit(ch)) {
|
if (char.IsAsciiDigit(ch)) {
|
||||||
if (v2 == -1 && v1 < maxLen) {
|
if (v2 == -1 && (maxLen == -1 || v1 < maxLen)) {
|
||||||
text += ch; v1++;
|
text += ch; v1++;
|
||||||
} else if (v2 != -1 && v2 < maxDecimal) {
|
} else if (v2 != -1 && (maxDecimal == -1 || v2 < maxDecimal)) {
|
||||||
text += ch; v2++;
|
text += ch; v2++;
|
||||||
}
|
}
|
||||||
} else if (v2 == 0-1 && ch == ',' || ch == '.') {
|
} else if (v2 == 0-1 && ch == ',' || ch == '.') {
|
||||||
|
Reference in New Issue
Block a user