This commit is contained in:
@@ -14,8 +14,6 @@ TODO CLIENT STUFF
|
|||||||
|
|
||||||
TODO NEXT
|
TODO NEXT
|
||||||
|
|
||||||
Being screamed at so shutting down for today :(
|
|
||||||
|
|
||||||
|
|
||||||
GZ VALIDATE
|
GZ VALIDATE
|
||||||
- Add rule isNumeric
|
- Add rule isNumeric
|
||||||
|
|||||||
@@ -18,6 +18,20 @@ function isEmpty(o) {
|
|||||||
return !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
|
// Get control from ref
|
||||||
//
|
//
|
||||||
@@ -146,5 +160,31 @@ export default {
|
|||||||
} else {
|
} else {
|
||||||
return false;
|
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",
|
"RecordHistory",
|
||||||
"ErrorFieldLengthExceeded",
|
"ErrorFieldLengthExceeded",
|
||||||
"ErrorStartDateAfterEndDate",
|
"ErrorStartDateAfterEndDate",
|
||||||
"ErrorRequiredFieldEmpty"
|
"ErrorRequiredFieldEmpty",
|
||||||
|
"ErrorFieldValueNotInteger"
|
||||||
],
|
],
|
||||||
decimalValidate(required) {
|
decimalValidate(required) {
|
||||||
return { required: required, decimal: [2, this.formats.decimalSeparator] };
|
return { required: required, decimal: [2, this.formats.decimalSeparator] };
|
||||||
|
|||||||
@@ -26,8 +26,8 @@
|
|||||||
v-model="obj.count"
|
v-model="obj.count"
|
||||||
:counter="10"
|
:counter="10"
|
||||||
:label="this.$gzlocale.get('WidgetCount')"
|
:label="this.$gzlocale.get('WidgetCount')"
|
||||||
ref="count"
|
ref="count"
|
||||||
:rules="[this.$gzv.Required(this,'count')]"
|
:rules="[this.$gzv.Integer(this,'count'),this.$gzv.Required(this,'count')]"
|
||||||
required
|
required
|
||||||
></v-text-field>
|
></v-text-field>
|
||||||
</v-flex>
|
</v-flex>
|
||||||
|
|||||||
Reference in New Issue
Block a user