This commit is contained in:
@@ -14,8 +14,6 @@ TODO CLIENT STUFF
|
||||
|
||||
TODO NEXT
|
||||
|
||||
Being screamed at so shutting down for today :(
|
||||
|
||||
|
||||
GZ VALIDATE
|
||||
- Add rule isNumeric
|
||||
|
||||
@@ -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] };
|
||||
|
||||
@@ -26,8 +26,8 @@
|
||||
v-model="obj.count"
|
||||
:counter="10"
|
||||
:label="this.$gzlocale.get('WidgetCount')"
|
||||
ref="count"
|
||||
:rules="[this.$gzv.Required(this,'count')]"
|
||||
ref="count"
|
||||
:rules="[this.$gzv.Integer(this,'count'),this.$gzv.Required(this,'count')]"
|
||||
required
|
||||
></v-text-field>
|
||||
</v-flex>
|
||||
|
||||
Reference in New Issue
Block a user