This commit is contained in:
@@ -31,6 +31,7 @@ function isInt(value) {
|
||||
return false;
|
||||
}
|
||||
x = parseFloat(value);
|
||||
// console.log("isInt:", x);
|
||||
return (x | 0) === x;
|
||||
}
|
||||
|
||||
@@ -47,7 +48,7 @@ function isNumber(n) {
|
||||
//
|
||||
function getControl(vm, ref) {
|
||||
let ctrl = vm.$refs[ref];
|
||||
console.log("getcontrol refs are", vm.$refs);
|
||||
|
||||
//I don't think this is required anymore
|
||||
// if (ctrl === undefined) {
|
||||
// //it's either a sub field in custom fields component or it's a coding error
|
||||
@@ -146,16 +147,9 @@ export default {
|
||||
if (vm.formState.loading) {
|
||||
return true;
|
||||
}
|
||||
console.log("form-Required ref is:", ref); //Items[0].Notes
|
||||
// if (ref.includes(".")) {
|
||||
// let xxx = ref.split(".");
|
||||
// console.log("split ref=", xxx);
|
||||
// ref = `${xxx[xxx.length - 2]}.${xxx[xxx.length - 1]}`;
|
||||
// }
|
||||
// console.log("actual ref is ", ref);
|
||||
|
||||
let ctrl = getControl(vm, ref);
|
||||
if (typeof ctrl == "undefined") {
|
||||
console.log("not found");
|
||||
return true;
|
||||
}
|
||||
|
||||
@@ -164,8 +158,6 @@ export default {
|
||||
return true;
|
||||
}
|
||||
|
||||
console.log("HERE");
|
||||
|
||||
// "ErrorRequiredFieldEmpty": "{0} is a required field. Please enter a value for {0}",
|
||||
let err = vm.$ay.t("ErrorRequiredFieldEmpty");
|
||||
let fieldName = getControlLabel(ctrl);
|
||||
@@ -317,13 +309,14 @@ export default {
|
||||
return true;
|
||||
}
|
||||
|
||||
//DEBUG
|
||||
//logControl("integerValid", ctrl, ref);
|
||||
|
||||
let value = getControlValue(ctrl);
|
||||
if (isEmpty(value)) {
|
||||
return true;
|
||||
}
|
||||
|
||||
//this block doesn't work and shouldn't be here afaict
|
||||
//if you type a letter for example it presents as empty, I guess because it's set to a numeric input type
|
||||
//in any case, empty isn't a valid integer so it should show as a broken rule when a letter or empty is entered
|
||||
// if (isEmpty(value)) {
|
||||
// return true;
|
||||
// }
|
||||
|
||||
if (isInt(value)) {
|
||||
return true;
|
||||
|
||||
Reference in New Issue
Block a user