fixed rules change, now should return TRUE if no broken rules before it was false, what a world!
This commit is contained in:
@@ -147,17 +147,17 @@ export default {
|
||||
//
|
||||
required(vm, ref) {
|
||||
if (vm.formState.loading) {
|
||||
return false;
|
||||
return true;
|
||||
}
|
||||
|
||||
var ctrl = getControl(vm, ref);
|
||||
if (typeof ctrl == "undefined") {
|
||||
return false;
|
||||
return true;
|
||||
}
|
||||
|
||||
var value = getControlValue(ctrl);
|
||||
if (!isEmpty(value)) {
|
||||
return false;
|
||||
return true;
|
||||
}
|
||||
|
||||
// "ErrorRequiredFieldEmpty": "{0} is a required field. Please enter a value for {0}",
|
||||
@@ -178,16 +178,16 @@ export default {
|
||||
//
|
||||
maxLength(vm, ref, max) {
|
||||
if (vm.formState.loading) {
|
||||
return false;
|
||||
return true;
|
||||
}
|
||||
var ctrl = getControl(vm, ref);
|
||||
if (typeof ctrl == "undefined") {
|
||||
return false;
|
||||
return true;
|
||||
}
|
||||
|
||||
var value = getControlValue(ctrl);
|
||||
if (isEmpty(value)) {
|
||||
return false;
|
||||
return true;
|
||||
}
|
||||
|
||||
if (value.length > max) {
|
||||
@@ -204,7 +204,7 @@ export default {
|
||||
});
|
||||
return err;
|
||||
} else {
|
||||
return false;
|
||||
return true;
|
||||
}
|
||||
},
|
||||
///////////////////////////////
|
||||
@@ -212,7 +212,7 @@ export default {
|
||||
//
|
||||
max255(vm, ref) {
|
||||
if (vm.formState.loading) {
|
||||
return false;
|
||||
return true;
|
||||
}
|
||||
return this.maxLength(vm, ref, 255);
|
||||
},
|
||||
@@ -222,26 +222,26 @@ export default {
|
||||
//
|
||||
datePrecedence(vm, refStart, refEnd) {
|
||||
if (vm.formState.loading) {
|
||||
return false;
|
||||
return true;
|
||||
}
|
||||
var ctrlStart = getControl(vm, refStart);
|
||||
if (typeof ctrlStart == "undefined") {
|
||||
return false;
|
||||
return true;
|
||||
}
|
||||
|
||||
var ctrlEnd = getControl(vm, refEnd);
|
||||
if (typeof ctrlEnd == "undefined") {
|
||||
return false;
|
||||
return true;
|
||||
}
|
||||
|
||||
var valueStart = getControlValue(ctrlStart);
|
||||
if (isEmpty(valueStart)) {
|
||||
return false;
|
||||
return true;
|
||||
}
|
||||
|
||||
var valueEnd = getControlValue(ctrlEnd);
|
||||
if (isEmpty(valueEnd)) {
|
||||
return false;
|
||||
return true;
|
||||
}
|
||||
|
||||
valueStart = window.$gz.DateTime.fromISO(valueStart);
|
||||
@@ -250,7 +250,7 @@ export default {
|
||||
// if either is not valid.
|
||||
//moment.github.io/luxon/docs/manual/validity.html
|
||||
https: if (!valueStart.isValid || !valueEnd.isValid) {
|
||||
return false;
|
||||
return true;
|
||||
}
|
||||
|
||||
if (valueStart > valueEnd) {
|
||||
@@ -263,7 +263,7 @@ export default {
|
||||
});
|
||||
return err;
|
||||
} else {
|
||||
return false;
|
||||
return true;
|
||||
}
|
||||
},
|
||||
///////////////////////////////
|
||||
@@ -272,16 +272,16 @@ export default {
|
||||
//
|
||||
confirmMatch(vm, refFirst, refSecond) {
|
||||
if (vm.formState.loading) {
|
||||
return false;
|
||||
return true;
|
||||
}
|
||||
var ctrlFirst = getControl(vm, refFirst);
|
||||
if (typeof ctrlFirst == "undefined") {
|
||||
return false;
|
||||
return true;
|
||||
}
|
||||
|
||||
var ctrlSecond = getControl(vm, refSecond);
|
||||
if (typeof ctrlSecond == "undefined") {
|
||||
return false;
|
||||
return true;
|
||||
}
|
||||
var valueFirst = getControlValue(ctrlFirst);
|
||||
var valueSecond = getControlValue(ctrlSecond);
|
||||
@@ -295,7 +295,7 @@ export default {
|
||||
});
|
||||
return err;
|
||||
} else {
|
||||
return false;
|
||||
return true;
|
||||
}
|
||||
},
|
||||
///////////////////////////////
|
||||
@@ -303,11 +303,11 @@ export default {
|
||||
//
|
||||
integerValid(vm, ref) {
|
||||
if (vm.formState.loading) {
|
||||
return false;
|
||||
return true;
|
||||
}
|
||||
var ctrl = getControl(vm, ref);
|
||||
if (typeof ctrl == "undefined") {
|
||||
return false;
|
||||
return true;
|
||||
}
|
||||
|
||||
//DEBUG
|
||||
@@ -315,11 +315,11 @@ export default {
|
||||
|
||||
var value = getControlValue(ctrl);
|
||||
if (isEmpty(value)) {
|
||||
return false;
|
||||
return true;
|
||||
}
|
||||
|
||||
if (isInt(value)) {
|
||||
return false;
|
||||
return true;
|
||||
}
|
||||
|
||||
// "ErrorFieldValueNotInteger": "Value must be an integer"
|
||||
@@ -337,14 +337,14 @@ export default {
|
||||
//
|
||||
decimalValid(vm, ref) {
|
||||
if (vm.formState.loading) {
|
||||
return false;
|
||||
return true;
|
||||
}
|
||||
//TODO: Handle commas and spaces in numbers
|
||||
//as per window.$gz.translation rules for numbers
|
||||
|
||||
var ctrl = getControl(vm, ref);
|
||||
if (typeof ctrl == "undefined") {
|
||||
return false;
|
||||
return true;
|
||||
}
|
||||
|
||||
//DEBUG
|
||||
@@ -352,11 +352,11 @@ export default {
|
||||
|
||||
var value = getControlValue(ctrl);
|
||||
if (isEmpty(value)) {
|
||||
return false;
|
||||
return true;
|
||||
}
|
||||
|
||||
if (isNumber(value)) {
|
||||
return false;
|
||||
return true;
|
||||
}
|
||||
|
||||
// "ErrorFieldValueNotDecimal": "Value must be a number"
|
||||
@@ -374,13 +374,13 @@ export default {
|
||||
// (was using this in testing on widget form notes field but not sure where else it's applicable)
|
||||
userRequiredFields(vm, ref, formCustomTemplateFieldName) {
|
||||
if (vm.formState.loading) {
|
||||
return false;
|
||||
return true;
|
||||
}
|
||||
|
||||
var template =
|
||||
window.$gz.store.state.formCustomTemplate[vm.formCustomTemplateKey];
|
||||
if (template === undefined) {
|
||||
return false;
|
||||
return true;
|
||||
}
|
||||
//See if control formCustomTemplateFieldName is in server required fields collection
|
||||
//this is a collection of both custom field definitions and standard form fields that are required
|
||||
@@ -393,17 +393,17 @@ export default {
|
||||
|
||||
//templateItem.required
|
||||
if (templateItem === undefined || templateItem.required !== true) {
|
||||
return false;
|
||||
return true;
|
||||
}
|
||||
|
||||
var ctrl = getControl(vm, ref);
|
||||
if (typeof ctrl == "undefined") {
|
||||
return false;
|
||||
return true;
|
||||
}
|
||||
|
||||
var value = getControlValue(ctrl);
|
||||
if (!isEmpty(value)) {
|
||||
return false;
|
||||
return true;
|
||||
}
|
||||
|
||||
// "ErrorRequiredFieldEmpty": "{0} is a required field. Please enter a value for {0}",
|
||||
@@ -432,16 +432,16 @@ export default {
|
||||
// type: "text"
|
||||
|
||||
if (vm.formState.loading) {
|
||||
return false;
|
||||
return true;
|
||||
}
|
||||
|
||||
if (templateItem.required !== true) {
|
||||
return false;
|
||||
return true;
|
||||
}
|
||||
|
||||
var value = subvm.GetValueForField(templateItem.dataKey);
|
||||
if (!isEmpty(value)) {
|
||||
return false;
|
||||
return true;
|
||||
}
|
||||
|
||||
//It's empty and it's required so return error
|
||||
|
||||
Reference in New Issue
Block a user