Skip to content

Commit 98e5ccd

Browse files
authored
Merge pull request #82 from WEBcodeX1/add-validate-float
Add float validation type
2 parents bdf9712 + 7768206 commit 98e5ccd

1 file changed

Lines changed: 22 additions & 0 deletions

File tree

www/sysFormfieldValidate.js

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -45,6 +45,7 @@ function sysFormFieldValidate()
4545
//- validate functions
4646
this.ValidateFunc =
4747
{
48+
'Float': this.Float,
4849
'MinMax': this.MinMax,
4950
'MaxLength': this.MaxLength,
5051
'IPAddress': this.IPv4Address,
@@ -469,6 +470,27 @@ sysFormFieldValidate.prototype.DateGerman = function(Value)
469470
}
470471

471472

473+
//------------------------------------------------------------------------------
474+
//- METHOD "Float"
475+
//------------------------------------------------------------------------------
476+
477+
sysFormFieldValidate.prototype.Float = function(Value)
478+
{
479+
const ErrorMsgFloatFormat = sysFactory.getText('TXT.SYS.ERROR.FORMVALIDATE.FLOAT-FORMAT-INCORRECT');
480+
481+
console.debug('CheckFloat Value:%s', Value);
482+
483+
if (Value.includes(',') || isNaN(parseFloat(Value)) ) {
484+
return {
485+
"Error": true,
486+
"Message": ErrorMsgFloatFormat
487+
};
488+
}
489+
490+
return false;
491+
}
492+
493+
472494
//------------------------------------------------------------------------------
473495
//- CONSTRUCTOR "sysFormFieldValidate"
474496
//------------------------------------------------------------------------------

0 commit comments

Comments
 (0)