This commit is contained in:
@@ -18,6 +18,20 @@ function isEmpty(o) {
|
||||
return !o;
|
||||
}
|
||||
|
||||
////////////////////////////////////
|
||||
// isInt value??
|
||||
//
|
||||
//FROM HERE: https://stackoverflow.com/a/14794066/8939
|
||||
//fast test if is an integer:
|
||||
function isInt(value) {
|
||||
var x;
|
||||
if (isNaN(value)) {
|
||||
return false;
|
||||
}
|
||||
x = parseFloat(value);
|
||||
return (x | 0) === x;
|
||||
}
|
||||
|
||||
////////////////////////////////////
|
||||
// Get control from ref
|
||||
//
|
||||
@@ -146,5 +160,31 @@ export default {
|
||||
} else {
|
||||
return false;
|
||||
}
|
||||
},
|
||||
///////////////////////////////
|
||||
// INTEGER
|
||||
//
|
||||
Integer(v, ref) {
|
||||
|
||||
var ctrl = getControl(v, ref);
|
||||
if(typeof ctrl == 'undefined'){
|
||||
return false;
|
||||
}
|
||||
|
||||
var value = getControlValue(ctrl);
|
||||
if (isEmpty(value)) {
|
||||
return false;
|
||||
}
|
||||
|
||||
if(isInt(value)){
|
||||
return false;
|
||||
}
|
||||
|
||||
|
||||
|
||||
// "ErrorFieldValueNotInteger": "Value must be an integer"
|
||||
var err = locale.get("ErrorFieldValueNotInteger");
|
||||
|
||||
return err;
|
||||
}
|
||||
};
|
||||
|
||||
@@ -67,7 +67,8 @@ export default {
|
||||
"RecordHistory",
|
||||
"ErrorFieldLengthExceeded",
|
||||
"ErrorStartDateAfterEndDate",
|
||||
"ErrorRequiredFieldEmpty"
|
||||
"ErrorRequiredFieldEmpty",
|
||||
"ErrorFieldValueNotInteger"
|
||||
],
|
||||
decimalValidate(required) {
|
||||
return { required: required, decimal: [2, this.formats.decimalSeparator] };
|
||||
|
||||
Reference in New Issue
Block a user