This commit is contained in:
@@ -32,6 +32,14 @@ function isInt(value) {
|
|||||||
return (x | 0) === x;
|
return (x | 0) === x;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
////////////////////////////////////
|
||||||
|
// isNumber
|
||||||
|
//
|
||||||
|
//FROM HERE: https://stackoverflow.com/a/1830632/8939
|
||||||
|
function isNumber(n) {
|
||||||
|
return !isNaN(parseFloat(n)) && isFinite(n);
|
||||||
|
}
|
||||||
|
|
||||||
////////////////////////////////////
|
////////////////////////////////////
|
||||||
// Get control from ref
|
// Get control from ref
|
||||||
//
|
//
|
||||||
@@ -185,6 +193,35 @@ export default {
|
|||||||
// "ErrorFieldValueNotInteger": "Value must be an integer"
|
// "ErrorFieldValueNotInteger": "Value must be an integer"
|
||||||
var err = locale.get("ErrorFieldValueNotInteger");
|
var err = locale.get("ErrorFieldValueNotInteger");
|
||||||
|
|
||||||
|
return err;
|
||||||
|
},
|
||||||
|
///////////////////////////////
|
||||||
|
// DECIMAL
|
||||||
|
// Basically anything that can be a number is valid
|
||||||
|
Decimal(v, ref) {
|
||||||
|
|
||||||
|
//TODO: Handle commas and spaces in numbers
|
||||||
|
//as per locale rules for numbers
|
||||||
|
|
||||||
|
var ctrl = getControl(v, ref);
|
||||||
|
if(typeof ctrl == 'undefined'){
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
var value = getControlValue(ctrl);
|
||||||
|
if (isEmpty(value)) {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
if(isNumber(value)){
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
// "ErrorFieldValueNotDecimal": "Value must be a number"
|
||||||
|
var err = locale.get("ErrorFieldValueNotDecimal");
|
||||||
|
|
||||||
return err;
|
return err;
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|||||||
@@ -68,7 +68,8 @@ export default {
|
|||||||
"ErrorFieldLengthExceeded",
|
"ErrorFieldLengthExceeded",
|
||||||
"ErrorStartDateAfterEndDate",
|
"ErrorStartDateAfterEndDate",
|
||||||
"ErrorRequiredFieldEmpty",
|
"ErrorRequiredFieldEmpty",
|
||||||
"ErrorFieldValueNotInteger"
|
"ErrorFieldValueNotInteger",
|
||||||
|
"ErrorFieldValueNotDecimal"
|
||||||
],
|
],
|
||||||
decimalValidate(required) {
|
decimalValidate(required) {
|
||||||
return { required: required, decimal: [2, this.formats.decimalSeparator] };
|
return { required: required, decimal: [2, this.formats.decimalSeparator] };
|
||||||
|
|||||||
@@ -39,6 +39,7 @@
|
|||||||
:label="this.$gzlocale.get('WidgetDollarAmount')"
|
:label="this.$gzlocale.get('WidgetDollarAmount')"
|
||||||
ref="dollarAmount"
|
ref="dollarAmount"
|
||||||
required
|
required
|
||||||
|
:rules="[this.$gzv.Decimal(this,'dollarAmount'),this.$gzv.Required(this,'dollarAmount')]"
|
||||||
></v-text-field>
|
></v-text-field>
|
||||||
</v-flex>
|
</v-flex>
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user