This commit is contained in:
2019-03-22 19:26:07 +00:00
parent 899422da75
commit 80034af489

View File

@@ -17,6 +17,31 @@ function isEmpty(o) {
return !o; return !o;
} }
////////////////////////////////////
// Get control from ref
//
function getControl(ref) {
var ctrl = v.$refs[ref];
if (isEmpty(ctrl)) {
return null;
}
}
////////////////////////////////////
// Get value from control
//
function getControlValue(ctrl) {
var value = ctrl.value;
return value;
}
////////////////////////////////////
// Get field name from control
//
function getControlFieldName(ctrl) {
return ctrl.label;
}
export default { export default {
/* /*
ctrl.$refs[ref].value ctrl.$refs[ref].value
@@ -40,13 +65,13 @@ ctrl.$refs[ref].initialValue
// err = _.replace(err, "{0}", fieldName); // err = _.replace(err, "{0}", fieldName);
// return err; // return err;
// }, // },
Required(v, ref) {HERE DID THIS METHOD OVER TO NEW WAY USING REF, NOW TO DO THE REST Required(v, ref) {
var ctrl = v.$refs[ref]; var ctrl = getControl(ref);
if (isEmpty(ctrl)) { if (!ctrl) {
return false; return false;
} }
var value = ctrl.value; var value = getControlValue(ctrl);
if (!isEmpty(value)) { if (!isEmpty(value)) {
return false; return false;
} }
@@ -61,7 +86,8 @@ ctrl.$refs[ref].initialValue
}, },
/////////////////////////////// ///////////////////////////////
// MAXLENGTH // MAXLENGTH
MaxLength(ltkey, value, max) { //MaxLength(ltkey, value, max) {
MaxLength(v, ref) {
if (_.isEmpty(value)) { if (_.isEmpty(value)) {
return false; return false;
} }