Enter address manually
When autocomplete results are available use up and down arrows to review and enter to select.
");
$targetInput.parent().find("i").addClass("qas-loader");
}
var code, formattedNumber;
if (form_type.Donation == true) {
code = allTimeZone.filter((timeZone) => timeZone.Name === $("[id$='_dd_Country']").val())[0].MobileCode;
} else if (form_type.Interaction == true) {
if ($("[id$='_dd_Country']").length != 0) {
code = allTimeZone.filter((timeZone) => timeZone.Name === $("[id$='_dd_Country']").val())[0].MobileCode;
} else {
code = "+61";
}
} else if (form_type.ADF == true) {
code = allTimeZone.filter((timeZone) => timeZone.Name === $("#country").val())[0].MobileCode;
}
console.log(phoneNumber.charAt(0));
if (phoneNumber.charAt(0) != "+") {
formattedNumber = code + phoneNumber;
} else if (phoneNumber.charAt(0) == "+") {
formattedNumber = phoneNumber;
}
//console.log("phone number to validate: " + formattedNumber);
//console.log("phone number code: " + formattedNumber.slice(3, 5));
var formattedNumberAreaCode = formattedNumber.slice(3, 5);
//check if landline
if (formattedNumberAreaCode == "02" || formattedNumberAreaCode == "07" || formattedNumberAreaCode == "03" || formattedNumberAreaCode == "08") {
//don't show tick as it bypasses experian validation
validListener(true, $targetInput, jqueryValidator, "phone", false);
EDQ_phone.validatedNumbers.push(formattedNumber);
} else {
EDQ_phone.client.validate(formattedNumber).done(function (data) {
console.log(data);
console.log(data.certainty);
console.log(data.resultCode);
if ((data.certainty == "Verified" && data.resultCode == "3") || (data.certainty == "Absent" && data.resultCode == "2")) {
validListener(true, $targetInput, jqueryValidator, "phone", true);
var validatedPhoneNumber = {
phoneNumber: data.number,
};
EDQ_phone.validatedNumbers.push(validatedPhoneNumber);
} else {
validListener(false, $targetInput, jqueryValidator, "phone", true);
}
});
}
}
function checkEmail($targetInput, email, jqueryValidator) {
$targetInput.parent().addClass("position-relative");
$targetInput.parent().find("i").attr("class", "");
if ($targetInput.parent().find("div[class^='loadingio']").length == 0) {
//$targetInput.parent().append("
");
$targetInput.parent().find("i").addClass("qas-loader");
}
EDQ_email.client.validate(email).done(function (data) {
console.log(data);
//to verify work, org emails change to != "undeliverable" instead of == "verified"
if (data.certainty == "verified" || (data.certainty == "unknown" && data.message == "OK")) {
/* add to an array so that we don't double check an email address */
var validatedEmail = {
email: data.email,
};
EDQ_email.validatedEmails.push(validatedEmail);
validListener(true, $targetInput, jqueryValidator, "email", true);
} else {
validListener(false, $targetInput, jqueryValidator, "email", true);
}
});
}
function validListener(valid, $targetInput, jqueryValidator, type, showTick) {
console.log("valid listener: " + valid);
console.log("jqueryValidator: " + jqueryValidator);
var edqObj;
if ($targetInput.hasClass("phone-number")) {
edqObj = EDQ_phone;
} else if ($targetInput.hasClass("email")) {
edqObj = EDQ_email;
}
$targetInput.parent().find("div[class^='loadingio']").remove();
if (valid) {
if (jqueryValidator == false) {
$targetInput.parent().find(".custom-error").remove();
$targetInput.parent().find("input").addClass("custom-valid");
if (showTick || showTick == undefined) {
$targetInput.parent().find("i").attr("class", "fas fa-solid fa-circle-check valid");
} else {
$targetInput.parent().find("i").attr("class", "");
}
if (form_type.Interaction == true) {
$targetInput.parent().find(".error").hide();
}
} else {
if (showTick || showTick == undefined) {
$targetInput.parent().find("i").attr("class", "fas fa-solid fa-circle-check valid");
} else {
$targetInput.parent().find("i").attr("class", "");
}
}
edqObj.valid = true;
$targetInput.attr("data-experian-valid", "true");
} else {
if (jqueryValidator == false) {
$targetInput.parent().find(".custom-error").remove();
$targetInput.parent().find("class[id^='fa-']").remove();
if (form_type.Donation == true) {
$targetInput.prev().val("").change();
} else if (form_type.Interaction == true) {
//if ($targetInput.attr("placeholder").includes("*")) {
//interaction add form - changes
$targetInput.parent().find("input:not(.qas-field)").val("").change();
//}
}
if ($targetInput.parent().find(".custom-error").length == 0) {
if (form_type.Donation == true) {
$targetInput.parent().find(".error").hide();
}
if (type != "email") {
var phone_validation_text = EDQ_phone.errorMessage;
var bypass_text;
if (EDQ_phone.configByPass == true) {
bypass_text = ", click
here to bypass validation.";
} else {
bypass_text = "";
}
if (form_type.Donation == true) {
$targetInput.parent().append("
" + phone_validation_text + bypass_text + "");
}
if (form_type.Interaction == true) {
$targetInput.parent().find("span[id$='valPhone'].error").show();
} else {
$targetInput.parent().find("i").attr("class", "");
}
} else {
$targetInput.parent().find("span[id$='valEmail'].error").show();
}
}
if (showTick || showTick == undefined) {
$targetInput.parent().find("i").attr("class", "fas fa-solid fa-circle-exclamation invalid");
}
}
qasPhoneEmailCustomListener();
$targetInput.removeClass("valid");
edqObj.valid = false;
$targetInput.attr("data-experian-valid", "false");
if (jqueryValidator == true) {
$("#form1")
.validate()
.element("#" + $targetInput.attr("id"));
}
}
}
function emailValidation() {
var jqueryValidator = false;
var formNoValidatorObject;
if (form_type.Interaction == true) {
$("input[id$='_txtEmail']").parent().addClass("row-email");
formNoValidatorObject = true;
} else if (form_type.Donation == true) {
$("input[id$='_txtEmail']").parent().parent().addClass("row-email");
formNoValidatorObject = $("#form1").data("validator") == false || $("#form1").data("validator") == undefined;
} else if (form_type.ADF == true) {
$("#email").parents(".row").addClass("row-email");
formNoValidatorObject = $("#form1").data("validator") == false || $("#form1").data("validator") == undefined;
}
// EDQ_phone.country = $('select[id$="_dd_Country"]').val();
if (EDQ_email.client != undefined) {
var $targetInput;
var _regex = new RegExp("^[a-zA-Z0-9._%+-]+@[a-zA-Z0-9.-]+\.[a-zA-Z]{2,}$");
_regex = new RegExp("^[a-zA-Z0-9._%+-]+@[a-zA-Z0-9.-]+\.[a-zA-Z]{2,}(?:\.[a-zA-Z]{2,})?$");
console.log(inlineValidation);
if (inlineValidation == false && formNoValidatorObject) {
console.log("email validation: no jquery validation");
//no jQuery validation
if ($("input[id$='_txtEmail']").parent().find(".qas-field").length == 0) {
$("
").insertAfter("input[id$='_txtEmail']");
$("input[id$='_txtEmail']").hide();
}
$targetInput = $(".email.qas-field");
if ($("input[id$='_txtEmail']").val() == "") {
$targetInput.val(EDQ_email.term);
} else {
$targetInput.val($("input[id$='_txtEmail']").val());
}
if ($targetInput.parent().find("i").length == 0) {
$targetInput.parent().append("
");
}
if (form_type.Interaction == true) {
$targetInput.parent().find(".error").text(EDQ_email.errorMessage);
$targetInput.attr("placeholder", "Email address *");
}
if (EDQ_email.valid == true) {
$targetInput.parent().addClass("position-relative");
$targetInput.parent().append("
");
}
} else {
//has jQuery validation
jqueryValidator = true;
// $targetInput = $("input[id$='_txtEmail']");
$targetInput = (form_type.Donation == true || form_type.Interaction == true) ? $("input[id$='_txtEmail']") : $("#emailAddress");
$targetInput.addClass("experian-field email");
$targetInput.parent().addClass("position-relative");
//add the icon for loader, failed, succesful validation
if ($targetInput.parent().find("i").length == 0) {
$targetInput.parent().append("
");
}
//set the experian call made to false
EDQ_email.experianCallMade = false;
//on email value change
$targetInput.off("change").on("change", function () {
EDQ_email.experianCallMade = false;
$targetInput.parent().removeClass("qas-checking");
});
//on input hide any icons
$targetInput.off("input").on("input", function () {
$targetInput.parent().find("i").attr("class", "");
});
//set the default focused state to false
EDQ_email.focusedOut = false;
//focused out
$targetInput.off("focusout").on("focusout", function () {
if (EDQ_email.experianCallMade == false) {
if (_regex.test($(this).val())) {
$targetInput.parent().find("i").attr("class", "qas-loader");
} else {
$targetInput.parent().find("i").attr("class", "");
}
}
EDQ_email.focusedOut = true;
});
//on focus
$targetInput.off("focus").on("focus", function () {
EDQ_email.focusedOut = false;
});
$("#btnContinue").click(function () {
EDQ_email.focusedOut = true;
});
/* custom jQuery validator for validating email addresses */
$.validator.addMethod(
"emailexperian",
function (value, element, params) {
var _regex = new RegExp("^[a-zA-Z0-9._%+-]+@[a-zA-Z0-9.-]+\.[a-zA-Z]{2,}$");
_regex = new RegExp("^[a-zA-Z0-9._%+-]+@[a-zA-Z0-9.-]+\.[a-zA-Z]{2,}(?:\.[a-zA-Z]{2,})?$");
console.log("EDQ_email.experianCallMade: " + EDQ_email.experianCallMade);
if (EDQ_email.experianCallMade == false) {
if (_regex.test(value)) {
if (pageRefreshed == false) {
//set the default state to false so that form can't be submitted, moved forward
EDQ_email.valid = false;
$targetInput.parent().addClass("qas-checking");
console.log("EDQ_email.focusedOut: " + EDQ_email.focusedOut);
if (EDQ_email.focusedOut) {
/** check if the email has already been validated **/
if (p_checkIfEmailChecked($(element).val()) == false) {
//only show the loader once email field focused out and confirmation that email hasn't been checked prior
$(element).parent().find("i").attr("class", "qas-loader");
EDQ_email.client.validate(value).done(function (data) {
console.log(data);
if (data.certainty == "verified" || (data.certainty == "unknown" && data.message == "OK")) {
var validatedEmail = {
email: data.email,
};
EDQ_email.validatedEmails.push(validatedEmail);
EDQ_email.experianCallMade = true;
EDQ_email.valid = true;
$("#form1")
.validate()
.element("#" + $(element).attr("id"));
$(element).parent().find("i").attr("class", "fas fa-solid fa-circle-check valid");
} else {
EDQ_email.valid = false;
EDQ_email.experianCallMade = true;
$targetInput.parent().removeClass("qas-checking");
$("#form1")
.validate()
.element("#" + $(element).attr("id"));
$(element).parent().find("i").attr("class", "fas fa-solid fa-circle-exclamation invalid");
}
});
} else {
$(element).parent().find("i").attr("class", "fas fa-solid fa-circle-check valid");
EDQ_email.valid = true;
return EDQ_email.valid;
}
}
} else {
var emailValidated = EDQ_email.validatedEmails.filter((email) => email.email === value);
if (emailValidated.length == 0) {
EDQ_email.valid = false;
$(element).parent().find("i").attr("class", "fas fa-solid fa-circle-exclamation invalid");
return false;
} else {
$(element).parent().find("i").attr("class", "fas fa-solid fa-circle-check valid");
EDQ_email.valid = true;
return EDQ_email.valid;
}
}
} else {
//$(element).parent().find("i").attr("class", "fa-solid fa-circle-exclamation");
/* regex fail */
EDQ_email.valid = false;
return EDQ_email.valid;
}
return EDQ_email.valid;
} else {
return EDQ_email.valid;
}
},
function (params, element) {
var message;
if (!_regex.test($(element).val())) {
//regex fail error message
message = EDQ_email.errorMessage;
} else {
//experian validation failed error message
message = EDQ_email.errorMessage;
}
return message;
}
);
//asign the custom rule, validation won't happen without this
$targetInput.attr("data-rule-emailexperian", "true");
}
$targetInput.on("input", function () {
$(this).prev().val($(this).val());
});
/***** no jQuery validation on the form, to be used on OOB donation forms, IAF ******/
if (jqueryValidator == false) {
$targetInput.off("change").on("change", function () {
$(this).removeClass("custom-valid");
});
$targetInput.off("focusout").on("focusout", function () {
$targetInput.parent().addClass("position-relative");
if ($(this).val().length >= 10) {
EDQ_email.term = $(this).val();
//console.log("email value to check: " + $(this).val());
//console.log("regex pass: " + _regex.test($(this).val()));
if (_regex.test($(this).val()) && !$targetInput.hasClass("custom-valid")) {
//$targetInput.parent().find(".invalid-email-format").remove();
$targetInput.parent().find("i").attr("class", "");
if (p_checkIfEmailChecked($(this).val()) == false) {
checkEmail($targetInput, $(this).val(), jqueryValidator);
} else {
EDQ_email.valid = true;
$targetInput.parent().find("i").attr("class", "fas fa-solid fa-circle-check valid");
$targetInput.parent().find("span[id$='_valEmail'].error").hide();
}
} else if (!$targetInput.hasClass("custom-valid")) {
$targetInput.removeClass("custom-valid");
$targetInput.parent().find("i").attr("class", "fas fa-solid fa-circle-exclamation invalid invalid-email");
tippy(".invalid-email", {
content: EDQ_email.errorMessage,
});
}
} else {
$(this).prev().val("");
EDQ_email.valid = false;
$targetInput.removeClass("custom-valid");
$targetInput.parent().find("i").attr("class", "fas fa-solid fa-circle-exclamation invalid invalid-email");
tippy(".invalid-email", {
content: EDQ_email.errorMessage,
});
$targetInput.parent().find("span[id$='_valEmail'].error").show();
}
});
}
}
}
/**** check if phone number and email exist in the array, so we don't double check the same phone, email *****/
function p_checkIfPhoneNumberChecked(formattedNumber) {
if (EDQ_phone.validatedNumbers.length != 0) {
var numberValidated = EDQ_phone.validatedNumbers.filter((number) => number.phoneNumber === formattedNumber);
if (numberValidated.length == 0) {
return false;
} else {
return true;
}
}
return false;
}
function p_checkIfEmailChecked(_email) {
if (EDQ_email.validatedEmails.length != 0) {
var emailValidated = EDQ_email.validatedEmails.filter((emailObj) => emailObj.email === _email);
if (emailValidated.length == 0) {
return false;
} else {
return true;
}
}
return false;
}
/**** check if phone number and email exist in the array, so we don't double check the same phone, email *****/
/** check if internation area code entered is within validation configured on the form **/
function validateCountryCode(countryCode) {
var valid = EDQ_phone.validCountries.filter((validCountry) => validCountry.MobileCode === countryCode);
return valid.length > 0;
}
/****** PHONE VALIDATION ******/
function phoneValidation() {
var jqueryValidator = false;
var formNoValidatorObject;
if (form_type.Interaction == true) {
$("input[id$='_txtPhone']").parent().addClass("row-phone");
formNoValidatorObject = true;
} else if (form_type.Donation == true) {
$("input[id$='_txtPhone']").parent().parent().addClass("row-phone");
formNoValidatorObject = $("#form1").data("validator") == false || $("#form1").data("validator") == undefined;
} else if (form_type.ADF == true) {
$("#phone").parents(".row").addClass("row-phone");
formNoValidatorObject = $("#form1").data("validator") == false || $("#form1").data("validator") == undefined;
}
//get the country code
if (form_type.ADF != true) {
EDQ_phone.country = $('select[id$="_dd_Country"]').val();
} else {
EDQ_phone.country = $("#country").val();
}
EDQ_phone.validCountries = [];
EDQ_phone.validCountries = allTimeZone.filter((timeZone) => EDQ_phone.enabledCountries.includes(timeZone.Name));
console.log("validCountries: ");
console.log(EDQ_phone.validCountries);
validateCountryCode("+61");
if (EDQ_phone.client != undefined) {
var $targetInput;
//check if jQuery validation exists on the form
if (inlineValidation == false && formNoValidatorObject) {
console.log("no jquery validator");
//no jQuery validation
if ($("input[id$='_txtPhone']").parent().find(".qas-field").length == 0) {
$("
").insertAfter("input[id$='_txtPhone']");
$("input[id$='_txtPhone']").hide();
}
if ($("input[id$='_txtPhone']").val() != "") {
EDQ_phone.term = $("input[id$='_txtPhone']").val();
}
$targetInput = $(".phone-number.qas-field");
$targetInput.val(EDQ_phone.term);
if (form_type.Interaction == true) {
$targetInput.parent().find(".error").text(EDQ_phone.errorMessage);
if ($("input[id$='_txtPhone']").attr("placeholder").includes("*")) {
$targetInput.attr("placeholder", $("input[id$='_txtPhone']").attr("placeholder"));
} else {
$targetInput.attr("placeholder", $("input[id$='_txtPhone']").attr("placeholder"));
$targetInput.parent().find(".error").text("");
}
//$targetInput.attr("placeholder", $("input[id$='_txtPhone']").attr("placeholder") + " *");
}
if ($targetInput.parent().find("i").length == 0) {
$targetInput.parent().append("
");
}
} else {
jqueryValidator = true;
EDQ_phone.experianCallMade = false;
//has jQuery validation
console.log("has jquery validator");
if (form_type.Donation == true || form_type.Interaction == true) {
$targetInput = $("input[id$='_txtPhone']");
} else if (form_type.ADF == true) {
$targetInput = $("#phone");
}
$targetInput.addClass("experian-validation phone-number");
$targetInput.parent().addClass("position-relative");
if ($targetInput.parent().find("i").length == 0) {
$targetInput.parent().append("
");
}
$targetInput.off("change").on("change", function () {
console.log("yeah changed");
$targetInput.parent().find("i").attr("class", "");
EDQ_phone.experianCallMade = false;
pageRefreshed = false;
EDQ_phone.valid = false;
});
/* jquery validator custom validation - phone */
$.validator.addMethod(
"phoneexperian",
function (value, element, params) {
console.log("phoneexperian validator");
//get country code
readCountry();
var code = allTimeZone.filter((timeZone) => timeZone.Name === EDQ.country)[0].MobileCode;
var formattedNumber;
//check if bypass enabled
if (EDQ_phone.bypass == false) {
console.log("1");
//check if Experian call has been made prior
if (EDQ_phone.experianCallMade == false) {
console.log("2");
//check the phone number length
if ($(element).val().length >= 10) {
console.log("3");
// check if country code has been added
if ($(element).val().charAt(0) != "+") {
formattedNumber = code + $(element).val();
} else {
formattedNumber = $(element).val();
}
var formattedNumberAreaCode = formattedNumber.slice(3, 5);
if (formattedNumberAreaCode == "02" || formattedNumberAreaCode == "07" || formattedNumberAreaCode == "03" || formattedNumberAreaCode == "08") {
EDQ_phone.valid = true;
EDQ_phone.validatedNumbers.push(formattedNumber);
EDQ_phone.experianCallMade = true;
$(element).parent().find("i").attr("class", "fas fa-solid fa-circle-check valid");
$("#form1")
.validate()
.element("#" + $(element).attr("id"));
} else {
$(element).parent().find("i").attr("class", "qas-loader");
//set valid to false
EDQ_phone.valid = false;
$targetInput.parent().addClass("qas-checking");
//check if phone number has already been checked
if (p_checkIfPhoneNumberChecked(formattedNumber) == false) {
if (pageRefreshed == false) {
EDQ_phone.client.validate(formattedNumber).done(function (data) {
console.log(data);
if ((data.certainty == "Verified" && data.resultCode == "3") || (data.certainty == "Absent" && data.resultCode == "2")) {
EDQ_phone.valid = true;
var validatedPhoneNumber = {
phoneNumber: data.number,
};
EDQ_phone.validatedNumbers.push(validatedPhoneNumber);
EDQ_phone.experianCallMade = true;
$(element).parent().find("i").attr("class", "fas fa-solid fa-circle-check valid");
$("#form1")
.validate()
.element("#" + $(element).attr("id"));
$targetInput.parent().removeClass("qas-checking");
} else {
EDQ_phone.valid = false;
EDQ_phone.experianCallMade = true;
$targetInput.parent().removeClass("qas-checking");
$(element).parent().find("i").attr("class", "fas fa-solid fa-circle-exclamation invalid");
$("#form1")
.validate()
.element("#" + $(element).attr("id"));
}
});
} else {
var numberValidated = EDQ_phone.validatedNumbers.filter((number) => number.phoneNumber === code + value);
if (numberValidated.length == 0) {
EDQ_phone.valid = false;
$(element).parent().find("i").attr("class", "fas fa-solid fa-circle-exclamation invalid");
return EDQ_phone.valid;
}
}
} else {
console.log("4");
$(element).parent().find("i").attr("class", "fas fa-solid fa-circle-check valid");
EDQ_phone.valid = true;
return EDQ_phone.valid;
}
}
} else {
console.log("6");
//$(element).parent().find("i").attr("class", "fas fa-solid fa-circle-exclamation");
EDQ_phone.valid = false;
$targetInput.parent().removeClass("qas-checking");
$(element).parent().find("i").attr("class", "fas fa-solid fa-circle-exclamation invalid");
return EDQ_phone.valid;
}
return EDQ_phone.valid;
} else {
if (EDQ_phone.valid == true) {
$(element).parent().find("i").attr("class", "fas fa-solid fa-circle-check valid");
} else {
$(element).parent().find("i").attr("class", "fas fa-solid fa-circle-exclamation invalid");
}
return EDQ_phone.valid;
}
} else {
console.log("77");
$(element).parent().find("i").attr("class", "fas fa-solid fa-circle-check bypass");
tippy(".bypass", {
content: "Phone validation bypassed.",
});
return value.length >= 10;
}
},
function (params, element) {
var message;
if (pageRefreshed == false) {
if ($(element).val().length < 10) {
message = "Please enter a valid phone number";
} else {
if (EDQ_phone.configByPass == true) {
message = EDQ_phone.errorMessage + ", please click
here to bypass.";
} else {
//message = EDQ_phone.errorMessage + ", please click
here to try again."
message = EDQ_phone.errorMessage;
}
}
} else {
if ($(element).val().length < 10) {
message = "Please enter a valid phone number";
} else {
message = "Validation failed because of country change, click
here to try again.";
}
}
qasPhoneEmailCustomListener();
return message;
}
);
if (jQuery.inArray(EDQ_phone.country, EDQ_phone.enabledCountries) >= 0) {
$targetInput.removeClass("phone").attr("data-rule-phoneexperian", "true");
} else {
$targetInput.addClass("phone").removeAttr("data-rule-phoneexperian");
}
}
$targetInput.on("input", function () {
$(this).prev().val($(this).val());
});
/* donation forms without inline validation, IAF */
if (jqueryValidator == false) {
$targetInput.off("change").on("change", function () {
$targetInput.removeClass("custom-valid");
$targetInput.parent().addClass("position-relative");
});
$targetInput.off("focusout").on("focusout", function () {
readCountry();
if ($("[id$='_dd_Country']").length != 0) {
code = allTimeZone.filter((timeZone) => timeZone.Name === EDQ.country)[0].MobileCode;
} else {
code = "+61";
}
var formattedNumber;
if ($(this).val().charAt(0) != "+") {
formattedNumber = code + $(this).val();
} else {
formattedNumber = $(this).val();
}
if ($(this).val().length >= 10) {
EDQ_phone.term = $(this).val();
if (formattedNumber.includes("+") && validateCountryCode(formattedNumber.substr(0, 3)) == true) {
if (!$targetInput.hasClass("custom-valid")) {
if (p_checkIfPhoneNumberChecked(formattedNumber) == false) {
checkPhoneNumber($targetInput, $(this).val(), jqueryValidator);
} else {
EDQ_phone.valid = true;
$targetInput.parent().find("i").attr("class", "fas fa-solid fa-circle-check valid");
$targetInput.parent().find("span[id$='_valPhone'].error").hide();
}
}
} else {
EDQ_phone.valid = false;
$targetInput.prev().val("").change();
$(this).prev().val("");
$targetInput.parent().find("i").attr("class", "fas fa-solid fa-circle-exclamation invalid invalid-email");
tippy(".invalid-email", {
content: EDQ_phone.errorMessage,
});
}
} else {
EDQ_phone.valid = false;
$targetInput.prev().val("").change();
$(this).prev().val("");
//$targetInput.parent().find("i").attr("class", "fas fa-solid fa-circle-exclamation invalid invalid-email");
$targetInput.parent().find("i").attr("class", "");
tippy(".invalid-email", {
content: EDQ_phone.errorMessage,
});
}
});
}
$("select[id$='_dd_Country'], input[name$='rdoGiftType'], #country").change(function () {
pageRefreshed = true;
});
if (pageRefreshed == true) {
if ($("#form1").data("validator") == false || $("#form1").data("validator") == undefined) {
if ($targetInput.val() != "") {
if ($targetInput.parent().find("custom-error validation-error").length == 0) {
$targetInput.parent().append("
Validation failed because of country change, click here to validate again.");
qasPhoneEmailCustomListener();
}
}
} else {
//check if phone number is in the array
EDQ_phone.valid = false;
//only trigger revalidation if value is over 10 chars
if ($targetInput.val().length >= 10) {
$("#form1")
.validate()
.element("#" + $targetInput.attr("id"));
}
}
}
}
}
function qasPhoneEmailCustomListener() {
if ($("#form1").data("validator") == false || $("#form1").data("validator") == undefined) {
$(".custom-revalidate")
.off("click")
.on("click", function () {
checkPhoneNumber($(this).parent().parent().find(".qas-field"), $(this).parent().parent().find(".qas-field").val());
});
$(".custom-bypass")
.off("click")
.on("click", function () {
if (form_type.Donation == true) {
if ($(this).parent().parent().parent().hasClass("row-phone")) {
$(this).parent().parent().find("input[id$='_txtPhone']").val($(this).parent().parent().find(".qas-field").val()).change();
$(this).parent().remove();
} else if ($(this).parent().parent().parent().hasClass("row-email")) {
$(this).parent().parent().find("input[id$='_txtEmail']").val($(this).parent().parent().find(".qas-field").val()).change();
$(this).parent().remove();
}
} else if (form_type.Interaction == true) {
if ($(this).parent().parent().hasClass("row-phone")) {
console.log("interaction: phone bypass");
$(this).parent().parent().find("input[id$='_txtPhone']").val($(this).parent().parent().find(".qas-field").val()).change();
$(this).parent().remove();
$(".row-phone").find("i").attr("class", "fas fa-solid fa-circle-check bypass");
tippy(".bypass", {
content: "Phone validation bypassed.",
});
} else if ($(this).parent().parent().parent().hasClass("row-email")) {
$(this).parent().parent().find("input[id$='_txtEmail']").val($(this).parent().parent().find(".qas-field").val()).change();
$(this).parent().remove();
}
}
});
} else {
$(document)
.off("click")
.on("click", ".custom-revalidate", function () {
pageRefreshed = false;
$("#form1")
.validate()
.element("#" + $(this).parent().parent().find("input").attr("id"));
});
$(document).on("click", ".custom-bypass", function () {
EDQ_phone.bypass = true;
$("#form1")
.validate()
.element("#" + $(this).parent().parent().find("input").attr("id"));
});
}
}