var xa = {};// validate_IsFilled xa.input_not_filled = function(fieldName, postedValues) { // function err_notfilled_v2(fieldName, postedValues) { // console.log("err_notfilled_v2"); // console.log(arguments); // console.log("te"); // console.log(fieldName, postedValues); // console.log("DA"); var input = postedValues.find((item) => { return item.name == fieldName; }); if (input && input.value) { return ((input.value + "").length > 0); } else return false; } // module.exports = err_notfilled_v2; // validate_IsFilled xa.input_not_same = function(otherField, fieldName, postedValues) { // function err_notfilled_v2(fieldName, postedValues) { // console.log("err_notfilled_v2"); // console.log(arguments); // console.log("te"); // console.log(fieldName, postedValues); // console.log("DA"); var input = postedValues.find((item) => { return item.name == fieldName; }); var otherInput = postedValues.find((item) => { return item.name == otherField; }); console.log("START DEBUG"); console.log(input); console.log(otherInput); if (input && input.value && otherInput && otherInput.value) { return (input.value === otherInput.value); } else return false; } // module.exports = err_notfilled_v2; // validate_IsFilled xa.input_not_between = function(min, max, fieldName, postedValues) { // console.log("err_notfilled_v2"); // console.log(arguments); // console.log("err_notfilled_v2"); // console.log(fieldName, postedValues); var input = postedValues.find((item) => { return item.name == fieldName; }); if (input && input.value) { var number = Number(input.value); return (number >= min && number <= max); } else return false; // ((input.value + "").length > 0); } // module.exports = err_notbetween;// validate_IsFilled xa.input_not_email = function(fieldName, postedValues) { // function err_notfilled_v2(fieldName, postedValues) { // console.log("err_notfilled_v2"); // console.log(arguments); // console.log("te"); // console.log(fieldName, postedValues); // console.log("DA"); var input = postedValues.find((item) => { return item.name == fieldName; }); if (input && input.value) { var regex = /^(([^<>()\[\]\\.,;:\s@"]+(\.[^<>()\[\]\\.,;:\s@"]+)*)|(".+"))@((\[[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\])|(([a-zA-Z\-0-9]+\.)+[a-zA-Z]{2,}))$/; return regex.test(String(input.value).toLowerCase());; } else return false; } // module.exports = err_notfilled_v2; // validate_IsFilled xa.input_over_max_length = function(maxLength, fieldName, postedValues) { // function err_notfilled_v2(fieldName, postedValues) { // console.log("err_notfilled_v2"); // console.log(arguments); // console.log("te"); // console.log(fieldName, postedValues); // console.log("DA"); var input = postedValues.find((item) => { return item.name == fieldName; }); if (input && input.value) { console.log("MAX LENG", maxLength, input.length); return ((input.value + "").length <= maxLength); } else return true; } // module.exports = err_notfilled_v2;