function validatenumerics(e) { var t = e.which ? e.which : e.keyCode; return !(t > 31 && (t < 48 || t > 57)) } function SaveAndResume() { $(".Field.Currency input").each((function () { $(this).select(), $(this).next().val($(this).maskMoney("unmasked")[0]) })) } function ValidateAndSubmit(e) { jQuery(".lfoverlay").show(), jQuery(".lfmodal").show(), $(".Field.Currency input").each((function () { $(this).select(), $(this).next().val($(this).maskMoney("unmasked")[0]) })), $(".Field.Dropdown select").each((function () { $(this).prev().val($(this).find("option:selected").text()) })), $(".Field.Radiobutton table").each((function () { $(this).prev().val($(this).find("input:checked").next().text()) })), $(".Field.Checkbox table").each((function () { $(this).prev().val($(this).find("input:checkbox:checked").map((function () { return $(this).next().text() })).get().join(",")) })); var t = $(e.currentTarget).parents(".validationGroup"), i = !0; t.validate(); var r = new Array; if (t.find(":input").each((function (e, t) { $(t).is(":visible") && !$(t).valid() ? (r.push(t), i = !1) : ("furequired" != $(t).attr("furequired") || $(t).valid()) && ("fbrequired" != $(t).attr("fbrequired") || $(t).valid()) ? "tagrequired" == $(t).attr("tagrequired") ? null != $(t).parent("div").attr("tagrequired") && "true" == $(t).parent("div").attr("tagrequired") && ($(t).parent("div").find("tag").length < 1 ? ($("#label" + $(t).attr("tag")).remove(), $("").insertAfter($(t)), i = !1) : $("#label" + $(t).attr("tag")).remove()) : "required" == $(t).attr("ckeditor") && null != $(t).parent("div").attr("editorrequired") && "true" == $(t).parent("div").attr("editorrequired") && $.each(CKEDITOR.instances, (function (e, r) { null != $(r.element.$).parent("div").parent("li") && 1 == $(r.element.$).parent("div").parent("li").is(":visible") && $(t).attr("ckeditor") == $(r.element.$).attr("ckeditor") && ("" == r.getData() ? ($("#label" + $(t).attr("ckeditor")).remove(), $("").insertAfter($(t).parent("div").children("div")), i = !1) : $("#label" + $(t).attr("ckeditor")).remove()) })) : (r.push(t), i = !1); var a = !0, d = $(t).closest("ul.page-break-section"); if (d && !$(d).is(":visible") && (a = !1), a && $(t).hasClass("g-recaptcha-response") && !$(t).hasClass("novalidate")) { var n = $(t).closest("div[googlerecaptchaid]"), l = grecaptcha.getResponse($(n).attr("googlerecaptchaid")); $("#" + $(n).attr("id") + " .error").remove(), 0 == l.length && (i = !1, $("#" + $(n).attr("id")).append('")) } })), t.find(".Field.Password").each((function (e, t) { var a = "", d = ""; $(t).find(":input").each((function (e, t) { $(t).is(":visible") && ($(t).next(".conmessage").remove(), $(t).hasClass("password") ? a = t.value : $(t).hasClass("confirmpassword") && ($(t).next(".conmessage").remove(), d = t.value, a != d && (r.push(t), $('").insertAfter(t), i = !1))) })) })), i = ValidateExtension(t, r, i), $(r).length > 0 && $("html,body").animate({ scrollTop: $(r).first().closest("li").first().offset().top - 100 }, 500, (function () { $(r).first().focus() })), i) { if (13 == e.keyCode) { var a = t.find(".causesValidation.bSubmit"); a.length > 0 && (a.click(), e.preventDefault()) } } else jQuery(".lfoverlay").hide(), jQuery(".lfmodal").hide(), e.preventDefault() } $.validator.addMethod("vmaxlength", $.validator.methods.maxlength, LFValidations.vmaxlength), $.validator.addMethod("rbrequired", (function (e, t) { return 1 != $(t).closest(".Field.Radiobutton").find("input:checked").length || "&%&" != $(t).closest(".Field.Radiobutton").find("input:checked").val() || "" != $(t).closest(".Field.Radiobutton").find("input[type=hidden]").val() }), LFValidations.required), $.validator.addMethod("cbrequired", (function (e, t) { return (1 != $(t).closest(".Field.Checkbox").find("input:checked").length || "&%&" != $(t).closest(".Field.Checkbox").find("input:checked").val() || "" != $(t).closest(".Field.Checkbox").find("input[type=hidden]").val()) && !($(t).closest(".Field.Checkbox").find("input:checked").length < 1) }), LFValidations.cbrequired), $.validator.addMethod("matrixCbrequired", (function (e, t) { return !($(t).closest("tr").find("input:checked").length < 1) }), LFValidations.required), $.validator.addMethod("matrixddlrequired", (function (e, t) { return 0 != $(t).find("option:selected").index() }), LFValidations.required), $.validator.addMethod("checkCaptcha", (function (e, t) { return !($(t).closest(".Field.Checkbox").find("input:checked").length < 1) }), LFValidations.cbrequired), $.validator.addMethod("wordcount", (function (e, t) { var i = $(t).attr("wordcount"); return !($(t).val().split(" ").length > i) }), LFValidations.wordcount), $.validator.addMethod("alphanumeric", (function (e, t) { var i = $(t).val(); if ("" != i) { return !!/^[a-zA-Z0-9]+$/.test(i) } return !0 }), LFValidations.alphanumeric), $.validator.addMethod("alphabetic", (function (e, t) { var i = $(t).val(); if ("" != i) { return !!/^[a-zA-Zs]+$/.test(i) } return !0 }), LFValidations.alphabetic), $.validator.addMethod("numeric", (function (e, t) { var i = $(t).val(); return "" == i || !!new RegExp("^[0-9]{" + i.length + "}$").test(i) }), LFValidations.numeric), $.validator.addMethod("custom", (function (e, t) { return "" == $(t).parent().children(".customsetting").html() || !!new RegExp($(t).parent().children(".customsetting").html()).test(e) }), LFValidations.custom), $.validator.addMethod("scorerequired", (function (e, t) { return "" != $(t).parent().find("div input[type=hidden]").val() }), LFValidations.scorerequired), $.validator.addMethod("scalerequired", (function (e, t) { return 1 == $(t).parent().parent().find("input[type=radio]").is(":checked") }), LFValidations.scalerequired), $.validator.addMethod("isvaliddate", (function (e, t) { var i, r, a, d, n, l; return "" == $(t).val() || ($($(t).parent().parent().find("span.Field-SubLabel-TextBox")).each((function (e, t) { 0 != $(t).find("input").length && (-1 != $(t).find("input").attr("class").indexOf("datepicker_month") ? i = $(t).find("input").val() : -1 != $(t).find("input").attr("class").indexOf("datepicker_day") ? r = $(t).find("input").val() : -1 != $(t).find("input").attr("class").indexOf("datepicker_year") && (a = $(t).find("input").val())), 0 != $(t).find("select").length && (-1 != $(t).find("select").attr("class").indexOf("datepicker_month") && (i = $(t).find("select").val()), "0" == i && (i = ""), -1 != $(t).find("select").attr("class").indexOf("datepicker_hour") ? d = $(t).find("select").val() : -1 != $(t).find("select").attr("class").indexOf("datepicker_minute") && (n = $(t).find("select").val())) })), null == i && (i = ""), null == r && (r = ""), null == a && (a = ""), null == d && (d = ""), null == n && (n = ""), "" != i && "" != r && "" != a && "" != d && "" != n ? (l = new Date(parseInt(a, 10), parseInt(i, 10) - 1, parseInt(r, 10), parseInt(d, 10), parseInt(n, 10), 0, 0)).getDate() == parseInt(r, 10) && l.getMonth() == parseInt(i, 10) - 1 && l.getFullYear() == parseInt(a, 10) : "" != i && "" != r && "" != a && "" == d && "" == n ? (l = new Date(parseInt(a, 10), parseInt(i, 10) - 1, parseInt(r, 10), 0, 0, 0, 0)).getDate() == parseInt(r, 10) && l.getMonth() == parseInt(i, 10) - 1 && l.getFullYear() == parseInt(a, 10) : ("" != i || "" == r && "" == a) && (("" != r || "" == i && "" == a) && (("" != a || "" == r && "" == i) && (("" != a || "" != r || "" != i || "" == d && "" == n) && ("" == a || "" == r || "" == i || "" != d && "" != n))))) }), LFValidations.isvaliddate), $.validator.addMethod("furequired", (function (value, element) { if (0 == $(element).parent().find(".plupload_content").length) return !0; if ($(element).parent().find(".plupload_content").attr("controlid").length > 0) { var object = $(element).parent().find(".plupload_content").attr("controlid") + ".files.length==0", resume = !0; if ($(element).parent().find(".fileresume").length > 0) { var val = $("#" + $(element).parent().find(".fileresume").attr("id")).val(); null !== val && "" !== val.trim() && (resume = !1) } return !eval(object) || !resume } return !0 }), LFValidations.furequired), $.validator.addMethod("fbrequired", (function (e, t) { return !!$(t).val() }), LFValidations.fbrequired), $(document).ready((function () { $(".Field.Phone input[type=text].phone").each((function (e) { void 0 !== $(this).attr("placeholder") && $("#" + $(this).attr("id")).mask($(this).attr("placeholder"), { clearIfNotMatch: !0 }) })), $(".Field.Textbox input[type=text].mask").each((function (e) { void 0 !== $(this).attr("placeholder") && $("#" + $(this).attr("id")).mask($(this).attr("placeholder"), { clearIfNotMatch: !0 }) })), $(".Field.Password .strength").each((function (e) { var t = {}; t.ui = { container: "#" + $(this).attr("id"), showVerdictsInsideProgressBar: !0, progressBarEmptyPercentage: 0, progressBarMinPercentage: 25, viewports: { progress: "#" + $(this).attr("id") + "_viewport_progress" } }, $("#" + $(this).attr("id") + "_Password").pwstrength(t), $("#" + $(this).attr("id") + "_Password").pwstrength("addRule", "testRule" + e, (function (e, t, i) { return t.match(/[0-9]/) && i }), 5, !0) })), $(".Field.Required.Fileupload input").attr("furequired", "furequired"), $(".Field.Required.Fileupload input.fileresume").removeAttr("furequired"), $(".Field.CkEditor.Required div.Field-Container-Wide").attr("editorrequired", "true"), $(".Field.CkEditor.Required div.Field-Container").attr("editorrequired", "true"), $(".Field.CkEditor").each((function (e) { if (void 0 !== $(this).attr("guid")) { var t = $(this).attr("guid").replace(/-/g, ""); $(this).addClass("ck" + t.toLowerCase() + "ck") } })), $(".Field input[type=hidden]").addClass("nrequired"), $(".Field.Required:not(.Checkbox) input:not(.nrequired),.Field.Required select,.Field.Required textarea").attr("required", ""), $(".Field.Required.Radiobutton input[type=radio]:not(.nrequired)").attr("rbrequired", "rbrequired"), $(".Field.Tag.Required input").attr("tagrequired", "tagrequired"), $(".Field.Tag.Required div.Field-Container-Wide").attr("tagrequired", "true"), $(".Field.Tag.Required div.Field-Container").attr("tagrequired", "true"), $(".Field.SingleReference.Required input").attr("tagrequired", "tagrequired"), $(".Field.SingleReference.Required div.Field-Container-Wide").attr("tagrequired", "true"), $(".Field.SingleReference.Required div.Field-Container").attr("tagrequired", "true"), $(".Field.MultiReference.Required input").attr("tagrequired", "tagrequired"), $(".Field.MultiReference.Required div.Field-Container-Wide").attr("tagrequired", "true"), $(".Field.MultiReference.Required div.Field-Container").attr("tagrequired", "true"), $(".Field.Captcha .mliveformcaptcha .textarea").attr("aria-label", "No value"), $(".Field.Required.Checkbox input[type=checkbox]:not(.nrequired)").attr("cbrequired", "cbrequired"), $(".Field.Required.Matrix input[type=checkbox]").removeAttr("required"), $(".Field.Required.Matrix input[type=checkbox]").attr("matrixCbrequired", "matrixCbrequired"), $(".Field.Matrix input[type=checkbox]").attr("aria-label", "Close"), $(".Field.Matrix input[type=radio]").attr("aria-label", "Close"), $(".Field.Required.Matrix select").removeAttr("required"), $(".Field.Required.Matrix select").attr("matrixddlrequired", "matrixddlrequired"), $(".Field.Email input[type=text]").attr("email", "email"), $(".Field.Email.Custom input[type=text]").removeAttr("email"), $(".Field.Email.Custom input[type=text]").attr("custom", "custom"), jQuery(window).on("load", (function () { $(".Field.Fileupload input[type=file]").attr("aria-readonly", "true"); let e = document.getElementById("g-recaptcha-response"); null != e && (e.setAttribute("aria-hidden", "true"), e.setAttribute("aria-label", "do not use"), e.setAttribute("aria-readonly", "true")) })), $(".Field.AlphaNumeric input[type=text]").attr("alphanumeric", "alphanumeric"), $(".Field.Textbox.Custom input[type=text]").attr("custom", "custom"), $(".Field.Textarea.Custom textarea").attr("custom", "custom"), $(".Field.Alphabetic input[type=text]").attr("alphabetic", "alphabetic"), $(".Field.Numeric input[type=text]").attr("numeric", "numeric"), $(".Field.CreditCard input[type=text].CVV").attr("numeric", "numeric"), $(".Field.Datetime input[type=text]").attr("isvaliddate", "isvaliddate"), $(".Field.Datetime select").attr("isvaliddate", "isvaliddate"), $(".Field.Birthdate input[type=text]").attr("isvaliddate", "isvaliddate"), $(".Field.Birthdate select").attr("isvaliddate", "isvaliddate"), $(".Field.Required.StarRating input[type=hidden].starratinghidden").removeClass("nrequired").attr("scorerequired", "scorerequired"), $(".Field.Required.ScaleRating input[type=hidden]").attr("scalerequired", "scalerequired"), $(".Field.Required.ScaleRating input[type=radio]").removeAttr("required"), $(".Field.BrowseFile.Required input[required=required]").removeAttr("required"), jQuery.validator.setDefaults({ onsubmit: !1, ignore: ".novalidate", rules: { success: function (e) { e.remove() } }, errorPlacement: function (e, t) { if (t.closest(".ms-form-group").hasClass("Radiobutton") || t.closest(".ms-form-group").hasClass("Checkbox")) e.appendTo(t.closest(".ms-form-group")); else { if (t.closest(".Field").hasClass("Radiobutton")) return e.insertAfter(t.closest(".Field").find(".Field-Container")), void e.insertAfter(t.closest(".Field").find(".Field-Container-Wide")); if (t.closest(".Field").hasClass("Matrix")) { if ("radio" == $(t).attr("type") || "checkbox" == $(t).attr("type")) return void ($(t).closest("tr").find(".tdBlank").find(".error").length < 1 && t.closest("tr").find(".tdBlank").append(e)); if ("text" == $(t).attr("type") || "number" == $(t).attr("type") || $(t).is("select")) return $(t).closest("tbody").find(".tdBlank").find(".error").remove(), void $(t).closest("tbody").find(".tdBlank").first().append(e) } else if (t.closest(".Field").hasClass("Phone")) { if (t.hasClass("AreaCode")) return } else if (t.closest(".Field").hasClass("Checkbox") || t.closest(".Field").hasClass("Datetime") || t.closest(".Field").hasClass("Time") || t.closest(".Field").hasClass("Birthdate") || t.closest(".Field").hasClass("Fullname") || t.closest(".Field").hasClass("Address")) return void ((0 == t.closest(".Field").find("label.error").length || t.closest(".Field").find("label.error").length > 0 && 0 == t.closest(".Field").find("label.error").is(":visible")) && (e.insertAfter(t.closest(".Field").find(".Field-Container")), e.insertAfter(t.closest(".Field").find(".Field-Container-Wide")))); e.insertAfter(t) } } }), $(".validationGroup .causesValidation").click(ValidateAndSubmit), $(".validationGroup .SaveAndResume").click(SaveAndResume), $(".validationGroup :password,.validationGroup :text").keydown((function (e) { 13 == e.keyCode && ValidateAndSubmit(e) })) }));