Fix JS number validation when the input is empty
Signed-off-by: William Desportes <williamdes@wdes.fr>
This commit is contained in:
parent
b5743c691a
commit
85624b9115
@ -178,6 +178,9 @@ function verifyAfterSearchFieldChange (index, searchFormId) {
|
||||
// BETWEEN and NOT BETWEEN
|
||||
// See all possible syntaxes in tests of https://regexr.com/7h1eq
|
||||
jQuery.validator.addMethod('validationFunctionForMultipleInt', function (value) {
|
||||
if (value === '') {
|
||||
return true;
|
||||
}
|
||||
return value.replace(/ /g,'').match(/^(((0x[0-9a-f]+)|([+-]?([0-9]*\.?[0-9]+|[0-9]+\.?[0-9]*)(e[+-]?[0-9]+)?))(,|$))+$/i) !== null;
|
||||
},
|
||||
Messages.strEnterValidNumber
|
||||
@ -187,6 +190,10 @@ function verifyAfterSearchFieldChange (index, searchFormId) {
|
||||
// validator method for INTs
|
||||
// See all possible syntaxes in tests of https://regexr.com/7h1ci
|
||||
jQuery.validator.addMethod('validationFunctionForInt', function (value) {
|
||||
if (value === '') {
|
||||
return true;
|
||||
}
|
||||
|
||||
return value.match(/^(0x[0-9a-f]+$)|([+-]?([0-9]*\.?[0-9]+|[0-9]+\.?[0-9]*)(e[+-]?[0-9]+)?)$/i) !== null;
|
||||
},
|
||||
Messages.strEnterValidNumber
|
||||
|
||||
Loading…
Reference in New Issue
Block a user