/* The following errors were found when attempting to minify this file: - Line 37: Parse error. missing : after property id - Line 37: Parse error. illegal character - Line 37: Parse error. missing ; before statement - Line 37: Parse error. illegal character - Line 37: Parse error. syntax error - Line 38: Parse error. syntax error - Line 39: Parse error. syntax error - Line 40: Parse error. syntax error - Line 42: Parse error. syntax error - Line 43: Parse error. illegal character - Line 43: Parse error. missing ) after argument list - Line 43: Parse error. illegal character - Line 43: Parse error. syntax error - Line 44: Parse error. syntax error - Line 45: Parse error. syntax error - Line 46: Parse error. syntax error - Line 47: Parse error. syntax error - Line 49: Parse error. syntax error - Line 51: Parse error. missing ; before statement - Line 59: Parse error. syntax error - Line 61: Parse error. syntax error - Line 66: Parse error. invalid return - Line 67: Parse error. syntax error - Line 69: Parse error. missing ; before statement - Line 73: Parse error. syntax error - Line 74: Parse error. syntax error - Line 75: Parse error. syntax error - Line 77: Parse error. syntax error - Line 79: Parse error. missing ; before statement - Line 85: Parse error. illegal character - Line 85: Parse error. missing ; before statement - Line 85: Parse error. illegal character - Line 86: Parse error. syntax error - Line 87: Parse error. syntax error - Line 90: Parse error. syntax error - Line 93: Parse error. illegal character - Line 93: Parse error. missing ; before statement - Line 93: Parse error. illegal character - Line 97: Parse error. invalid return - Line 98: Parse error. syntax error - Line 100: Parse error. missing ; before statement - Line 101: Parse error. syntax error - Line 102: Parse error. syntax error - Line 103: Parse error. syntax error - Line 108: Parse error. invalid return - Line 113: Parse error. missing ; after for-loop initializer - Line 113: Parse error. missing ; before statement - Line 120: Parse error. syntax error - Line 127: Parse error. syntax error - Line 129: Parse error. syntax error - Line 131: Parse error. syntax error - Line 132: Parse error. syntax error - Line 133: Parse error. syntax error - Line 423: Parse error. missing ; before statement */ // Gets Json object using a given url. function GetJson(url) { var result; $.ajaxSetup({ async: false }); $.post(url, function (data) { result = data; }); $.ajaxSetup({ async: true }); return result; } function maxLength(field, maxChars) { if (field.value.length >= maxChars) { event.returnValue = false; return false; } } function maxLengthPaste(field, maxChars) { var copyText = field.value + window.clipboardData.getData("Text"); field.value = copyText.substr(0, maxChars); if ((copyText.length) > maxChars) { return false; } event.returnValue = true; } function appendFilesToInput(appendInput, mainFileInput) { const valid = validateMultiFileUpload(appendInput, true); if (!valid) { alert("The file you are trying to upload is not an allowed file type or has an invalid file name. These are the accepted characters: A-z 0-9 ~ ! ( ) - + = [ ] { } , . _"); appendInput.value = null; return; } const dt = new DataTransfer(); const originalFiles = Array.from(mainFileInput.files); const existingSet = new Set(originalFiles.map(({ name, size, lastModified }) => `${name}-${size}-${lastModified}`)); originalFiles.forEach(file => { dt.items.add(file); }) const addedFiles = Array.from(appendInput.files); addedFiles.forEach(file => { if (!existingSet.has(`${file.name}-${file.size}-${file.lastModified}`)) { dt.items.add(file); } }) mainFileInput.files = dt.files; mainFileInput.dispatchEvent(new Event("change")); } function fileAppender(mainFileInput) { const li = document.createElement("li"); const label = document.createElement("label"); label.innerHTML = 'Add Files' const appendInput = document.createElement("input"); appendInput.type = "file"; appendInput.multiple = true; appendInput.className = "visuallyhidden"; appendInput.addEventListener("change", e => { appendFilesToInput(appendInput, mainFileInput); }); label.appendChild(appendInput); const placeholder = document.createElement("span"); li.appendChild(placeholder); li.appendChild(label); return li; } function removeFileFromInput(input, idx) { const dt = new DataTransfer(); const files = Array.from(input.files); files.splice(idx, 1); files.forEach(file => { dt.items.add(file); }); input.files = dt.files; } function listItemFile(input, file, idx) { const li = document.createElement("li"); const fileNameSpan = document.createElement("span"); fileNameSpan.textContent = file.name; li.appendChild(fileNameSpan); const removeButton = document.createElement("button"); removeButton.title = `Remove ${file.name}`; removeButton.addEventListener("click", e => { e.preventDefault(); removeFileFromInput(input, idx); input.dispatchEvent(new Event("change")); }); removeButton.innerHTML = ''; const removeButtonSpan = document.createElement("span"); removeButtonSpan.textContent = `Remove ${file.name}`; removeButtonSpan.className = "visuallyhidden"; removeButton.appendChild(removeButtonSpan); li.appendChild(removeButton); return li; } function listFileInputFiles(fileInput) { if (fileInput.nextElementSibling?.className === "file-list") { fileInput.nextElementSibling.remove(); } const files = fileInput.files || []; const valid = files.length && validateMultiFileUpload(fileInput, true) if (!valid) { fileInput.value = null; return; } if (files.length > 1) { const ul = document.createElement("ul"); ul.className = "file-list"; for (let i = 0; i < files.length; i++) { const li = listItemFile(fileInput, files[i], i); ul.appendChild(li); } const fileAppenderLi = fileAppender(fileInput); ul.appendChild(fileAppenderLi); fileInput.after(ul); } } function initFileInputs() { if (!window.FeatureToggles.isActive("CMS.FormCenter.MultipleFileUploadEnhancement")) { return; } document.querySelectorAll(".FileUpload input[type='file']").forEach(fileInput => { listFileInputFiles(fileInput); fileInput.addEventListener("change", e => { listFileInputFiles(fileInput) }) }); } ; /// /// /// /// /// /// /// /// /// //////// ENUMERATIONS /////////// var FormCenterHomeJS = (function ($) { var self = this; // This value is set on the ItemDetailFE.ascx page, using a value from the // View Model. self.submissionURL = ''; return self; }(jQuery)); var FormCenterHomeScriptResources = GetJson("/FormCenter/Localization"); // Field formats. var FieldValidation = { Any: 0, Letters: 1, Numeric: 2, PhoneNumber: 3, PostalCode: 4, EmailAddress: 5, RegEx: 6, Currency: 7, Date: 8, Time: 9, DateTime: 10, DateSpan: 11, TimeSpan: 12, DateTimeSpan: 13 }; // Supported field types. var FieldTypes = { ShortAnswer: 1, LongAnswer: 2, Checkboxes: 3, RadioButtons: 4, Dropdown: 5, FileUpload: 6, ReplyEmail: 10, Password: 11, DateTime: 18, EPayment: 23 }; //////// GLOBALS //////////////// // Stores instantiated form validator/condition instances for the current form. var formValidators = null; var formConditions = null; // Use with form submissions. var redirectNewWindow = null; //////// SUPPORT METHODS ////////f // Shows extra information for a form detail. function moreInfo(id) { changeInfo(id, 'addClass', 'removeClass'); } // Hides extra information for a form detail. function lessInfo(id) { changeInfo(id, 'removeClass', 'addClass'); } // Internal. Hides or shows extra information. function changeInfo(id, lessFn, moreFn) { $([document.getElementById('spnLess' + id), document.getElementById('lnkMore' + id)])[lessFn]('hidden'); $(document.getElementById('spnMore' + id))[moreFn]('hidden'); } // Used to expand and collapse category sections. function expandCollaspseCategory(catID) { var $elem = $('#section' + catID); var $elemArrow = $('#span' + catID); var supportSlide = !isie7; // If we can find a better way to detect the incorrect behavior IE7 mode is exhibiting, go for it... if ($elem.is(':visible')) { $elemArrow.html('►'); if (supportSlide) $elem.slideUp(150); else $elem.hide(); } else { $elemArrow.html('▼'); if (supportSlide) $elem.slideDown(150); else $elem.show(); } } // Assigns bulk action checkbox group to jQuery expression. function assignBulkCheckGroup($children, $parent) { // Isolate children from parent in event of overlap ($children containing the $parent). // Vastly simplifies the logic in the event handlers by doing this. var $isolatedChildren = $children.filter( function (index) { return $parent.filter(this).length == 0; } ); // Cache current number of checked children. $isolatedChildren.lengthChecked = $isolatedChildren.filter(':checked').length; // Hook childen change. $isolatedChildren.change(function (event) { $isolatedChildren.lengthChecked += (this.checked ? 1 : -1); var allChildrenChecked = ($isolatedChildren.lengthChecked == $isolatedChildren.length); $parent.each(function () { this.checked = allChildrenChecked; }); }); // Hook parent change. $parent.change(function (event) { var parentChecked = this.checked; $isolatedChildren.lengthChecked = this.checked ? $isolatedChildren.length : 0; $isolatedChildren.each(function () { this.checked = parentChecked; }); }); } function initCommon() { // Hack: Internet Explorer 7 mode bizarre display bugs. $('.sidebar .search.noStyles').css('zoom', '1'); // Hook search category bulk checks. var $bulkCheck = $('#categoryFilter_0'); var $bulkGroup = $('.categoryList input[type="checkbox"]'); assignBulkCheckGroup($bulkGroup, $bulkCheck); // Get input jQuery refs. var $inputFCTerm = $('#inputFCTerm'); var $inputFCSearch = $('#inputFCSearch'); // Hook search button and textbox to capture enter key. $inputFCTerm.keydown(function (event) { // If user presses enter, submit for search. switch (event.which) { case 10: // LF case 13: // CR event.preventDefault(); $inputFCSearch.click(); break; } }); $inputFCSearch.click(function (event) { event.preventDefault(); // Build search querystring. var qs = {}; var formID = extractFormIDFromURL(location.href); var categoryID = extractCategoryIDFromURL(location.href); var searchTerm = $.trim(isNull($inputFCTerm.val(), '')); if (formID) qs.formID = formID; if (categoryID) qs.categoryID = categoryID; if (searchTerm != '') qs.term = searchTerm; if (!$bulkCheck[0].checked) { var values = []; $bulkGroup.filter(':checked').each(function () { values.push(this.value); }); if (values.length > 0) qs.categoryFilter = values.join(','); } // Set search URL and go. window.location = '/FormCenter/Search' + (new QueryStringBuilder(qs)).toString(); }); // Hook search category dropdown. var $catList = $('#categoryList'); var $catListToggle = $('a.mega'); $catListToggle.click(function (e) { e.preventDefault(); if ($catList.hasClass('open')) $catList.slideUp(300); else $catList.slideDown(300); $catListToggle.toggleClass('active'); $catList.toggleClass('open'); }); // Show print dialog if URL contains standard print query string. if (containsPrint(location.href)) window.print(); } // Initialization for search (Search.aspx view). function initSearch() { if (this.wasInit) return; this.wasInit = true; attachCategoryVisibilityTogglers(); initCommon(); } // Initialization for category/form list (Index.aspx view). function initCategoryList() { if (this.wasInit) return; this.wasInit = true; attachCategoryVisibilityTogglers(); initCommon(); } // Initialization for confirmation (Confirmation.aspx view). function initConfirmation() { if (this.wasInit) return; this.wasInit = true; initCommon(); } function initPostSubmissionSpam() { initCommon(); } // Causes current form to be submitted for printing. function printForm(saveData) { if (formValidate()) { //check for valid responses before creating print window var frm = document.aspnetForm; var $form = $(document.aspnetForm); var printPrevType = (getPrintPreviewType() == 1 ? 'Print' : 'Preview'); var formID = extractFormIDFromURL(location.href); $form.attr('target', 'PrintWindow'); // Change target/action to print data. frm.action = '/FormCenter/Print?formID=' + formID + '&' + printPrevType + '=YES&Save=' + (saveData ? 'True' : 'False'); var savedProgressID = $('#hdnSavedProgressID').val(); if (savedProgressID != null) { frm.action = frm.action + '&savedProgressID=' + savedProgressID; } submitForm($form, true, saveData, formID); } else { enableDisableSubmit(true); } } function submitFormHandler(e) { try { let json = JSON.parse(this.response); if (this.status !== 200 || json.Success !== true) { $('.submissionConfirmationMessage').html("Something went wrong with the submission. Please try again."); $('.submissionConfirmation').show(); enableDisableSubmit(true); return; } const responseUrl = this.responseURL && new URL(this.responseURL); const saveSubmission = responseUrl && responseUrl.searchParams.get('save') && responseUrl.searchParams.get('save').toLowerCase() === 'true'; const doPrint = responseUrl && responseUrl.searchParams.get('print') && responseUrl.searchParams.get('print').toLowerCase() === 'true'; const redirectAfterSubmissionSaved = json.Redirect && json.Redirect === true && saveSubmission === true; if (redirectAfterSubmissionSaved) { if (json.IsHttps === false) { json.Message = json.Message.replace("https://", "http://"); } location.href = json.Message; } else { if (saveSubmission === true) { $('.submissionConfirmationMessage').html(json.Message); typeof displayStep === "function" && displayStep(1); $('.submitForm').hide(); $('.submissionConfirmation').show(); } enableDisableSubmit(true); } if (doPrint === true) { window.open("/FormCenter/Print?formId=" + json.FormId.toString() + '&save=' + (saveSubmission ? 'True' : 'False')); } if (json.Success === true) { document.aspnetForm.reset(); if (typeof (grecaptcha) !== "undefined") { grecaptcha.reset(); } } !window.isRemoveSetHeights && typeof SetHeights === "function" && SetHeights(); } catch (ex) { console.log(ex); } } function submitForm($form, print, saveSubmission, formID) { var submittedViaWidget = $form.parents(".widgetBody").length > 0; serializeSpecialFields(); if (submittedViaWidget !== true) { var printWindow; if (print === true) { printWindow = window.open("", "PrintWindow"); // Deferred object at the window level, this becomes available on the opened window via window.opener // Whichever view gets rendered will resolve it and pass the appropriate status code. window.deferredStatus = $.Deferred(); } if (printWindow) { window.deferredStatus.done(function (status) { if (status === CP_DynamicForm_PrintSubmission.StatusCodes.Success) { if (saveSubmission && saveSubmission === true) { window.location = '/FormCenter/Confirmation?formID=' + formID; } } else { printWindow.close(); if (saveSubmission) { window.location = '/FormCenter/ErrorSubmittingForm?formID=' + formID; } } }); } $form.submit(); } else { var submissionUrl = FormCenterHomeJS.submissionURL + (saveSubmission ? '&save=True' : ""); submissionUrl = submissionUrl + (print ? '&print=True' : ''); var formData = new FormData($form[0]); var xhr = new XMLHttpRequest(); xhr.onload = submitFormHandler; xhr.onloadend = ajaxPostBackEnd; xhr.onerror = function() { console.log("A network error occurred with the transaction."); }; xhr.open("POST", submissionUrl); ajaxPostBackStart('Loading'); xhr.send(formData); } } function serializeSpecialFields() { submitCheckboxHandler(); submitRadioHandler(); submitDateTimeHandler(); } // Initialization for form item printing (Print.aspx view). function initFormPrint() { if (this.wasInit) return; this.wasInit = true; initCommon(); initValidationAndConditions(); registerFormPrintEvents(); } function initValidationAndConditions() { // Register validation. if (typeof getFormValidatorData !== 'undefined') { formValidators = FieldValidator.createMulti(getFormValidatorData()); } else { formValidators = []; } // Register conditions. if (getFormConditionData) { formConditions = FieldConditions.createMulti(getFormConditionData(), formValidators); } else { formConditions = FieldConditions.createMulti([], formValidators); } // Register condition runner and make initial condition check. formConditionsRunner = new FieldConditionsRunner(formConditions, $.noop, true, false); // TODO: Finish up, put debugCondRunnerLogResults for $.noop. formConditionsRunner.run(); } // Initialization for form item (Item.aspx view). function initForm() { if (this.wasInit) return; this.wasInit = true; initCommon(); initValidationAndConditions(); initDatePickers(); initTimePickers(); initFileInputs(); registerFormEvents(); // Hook up buttons (submit/cancel/etc). } function initDatePickers() { if ($('.telerikDatePicker').length > 0) { $('.telerikDatePicker').each(function () { if (typeof (cp) !== 'undefined') cp.datetimepicker && cp.datetimepicker.createDatePicker(this); }); } } function initTimePickers() { if ($('.formCenterTimePicker').length > 0) { $('.formCenterTimePicker').focusout(function () { var text = $(this).val().toLowerCase(); if (text != '' && (text.indexOf('am') < 0 && text.indexOf('pm') < 0)) { text = $(this).val().trim() + ' AM'; $(this).val(text); } }); } else { $('.telerikTimePicker').each(function () { if (typeof (cp) !== 'undefined') cp.datetimepicker && cp.datetimepicker.createTimePicker(this, { format: 'h:i A' }); }); } } // Registers event handlers for form. function registerFormPrintEvents() { $('#btnFormContinue').click(function (event) { event.preventDefault(); var frm = document.aspnetForm; var formID = extractFormIDFromURL(location.href); var $form = $(document.aspnetForm); // Change target/action to confirmation page. frm.action = '/FormCenter/Confirmation?formID=' + formID; $form.trigger("submit"); }); } // Registers event handlers for form. function registerFormEvents() { // Remove troublemakers (prevent the jQuery submit handler from ever firing, and not needed for this screen anyways). document.aspnetForm.removeAttribute('onsubmit'); document.aspnetForm.onsubmit = null; var $form = $(document.aspnetForm); // TODO: Plug this into other validation. var wantCopyAddr, $wantCopyAddrLI; var wantCopy = document.getElementById('wantCopy'); if (wantCopy) { wantCopyAddr = document.getElementById('wantCopyAddress'); $wantCopyAddrLI = $(wantCopyAddr.parentNode.parentNode); $(wantCopy).change(function (event) { if (this.checked) $wantCopyAddrLI.show(); else $wantCopyAddrLI.hide(); }); } /* #2378*/ $(document).keydown(function (event) { if ((event.keyCode == 13) && (event.target.id != 'btnFormSubmit') && (event.target.tagName != 'TEXTAREA') && (event.target.getAttribute('data-enable-enter-keypress') != 'true')) { event.preventDefault(); return false; } if (event.keyCode === 32 && event.target.tagName === 'A' && event.target.getAttribute('role') === 'button') { $(event.target).trigger('click'); event.preventDefault(); return false; } }); $form.submit(function () { // Run validation, stop data submission if necessary. if (!formValidate()) { enableDisableSubmit(true); return false; } if (isNull(redirectNewWindow, '').trimEnd() != '') window.open(redirectNewWindow); // Field types requiring special serialization code (radio/check/file). // The deserialization of dictionaries from forms in MVC 2 is somewhat sensitive. serializeSpecialFields(); return true; }); $('#btnFormSubmit').click(function (event) { event.preventDefault(); if (formValidate()) { processSubmit(handleSubmitClick); } }); $('#btnFormPrint').click(function (event) { event.preventDefault(); printForm(false); }); $('#btnFormSubmitPrint').click(function (event) { event.preventDefault(); if (formValidate()) { processSubmit(handleSubmitPrintClick); } }); $('#btnCalculateTotals').click(function (e) { e.preventDefault(); submitCheckboxHandler(); submitRadioHandler(); if (formValidate()) { var $form = $(document.aspnetForm); $.ajax({ url: '/FormCenter/Home/CalculateTotal?formID=' + $('#hdnFormID').val(), type: 'POST', data: $(document.aspnetForm).serializeArray(), success: function (response) { openCpModal({ title: FormCenterHomeScriptResources.CalculateTotals, className: 'modalCalculateTotal', isFrontEnd: window.location.href.indexOf('/Admin/FormCenter') == -1, htmlContent: response }); }, error: function (xhr, textStatus, exception) { alert('Error: ' + xhr.statusText + '\nStatus: ' + xhr.status); } }); } }); $('#btnProceedToCheckOut').click(function (e) { proceedToCheckOut(e); }); if ($('.submissionConfirmationOk').length > 0) { $('.submissionConfirmationOk').unbind('click').click(function () { $('.submitForm').show(); $('.submissionConfirmation').hide(); !window.isRemoveSetHeights && typeof SetHeights === "function" && SetHeights(); }) } } function onRecaptchaLoadCallback() { window.gRecaptchaClientId = grecaptcha.render('inline-recaptcha', { 'sitekey': document.querySelector('#inline-recaptcha').dataset.sitekey, 'badge': 'inline', 'size': 'invisible' }); } function processSubmit(callback) { const recaptcha = document.querySelector('.recaptcha'); if (!recaptcha) { callback(); return; } if (!window.FeatureToggles.isActive("CMS.FormCenter.RecaptchaV3Enabled")) { window.recaptchaCallback = callback; grecaptcha.execute(); return; } grecaptcha.ready(function() { grecaptcha.execute(window.gRecaptchaClientId, { action: 'submit' }).then(callback); }); } function enableDisableSubmit(enable) { if (enable) { if ($('#btnFormSubmitPrint').length > 0) { $('#btnFormSubmitPrint').removeClass('inactive'); $('#btnFormSubmitPrint').click(function (event) { handleSubmitPrintClick(); }); } if ($('#btnFormSubmit').length > 0) { $('#btnFormSubmit').removeClass('inactive'); $('#btnFormSubmit').click(function (event) { event.preventDefault(); if (formValidate()) { closeModalDialog('editItemBehavior'); processSubmit(handleSubmitClick); } }); } } else { if ($('#btnFormSubmitPrint').length > 0) { $('#btnFormSubmitPrint').addClass("inactive"); $('#btnFormSubmitPrint').unbind(); } if ($('#btnFormSubmit').length > 0) { $('#btnFormSubmit').addClass("inactive"); $('#btnFormSubmit').unbind(); } } } function handleSubmitClick() { enableDisableSubmit(false); var frm = document.aspnetForm; frm.action = FormCenterHomeJS.submissionURL; var $form = $(frm); var formID = extractFormIDFromURL(location.href); submitForm($form, false, true, formID); } function handleSubmitPrintClick() { enableDisableSubmit(false); printForm(true); } function proceedToCheckOut(e) { e.preventDefault(); serializeSpecialFields(); if (formValidate()) { var savedProgressID = $('#hdnSavedProgressID').val(); var submitUrl = '/FormCenter/Home/ProceedToCheckOut?formID=' + $('#hdnFormID').val(); if (savedProgressID != null) { submitUrl = submitUrl + '&savedProgressID=' + savedProgressID; } var $form = $(document.aspnetForm); $form.attr('action', submitUrl); $form.submit(); } } function getModalDialogObjects() { return { iframe: document.getElementById('liveEditDialog'), windowElement: $('.modalContainerCP')[0], behavior: $find('editItemBehavior'), titleElement: $('.modalTitle')[0] }; } function getBooleanValue(value) { switch (value.toLowerCase()) { case "true": case "yes": case "1": return true; case "false": case "no": case "0": case null: return false; default: return Boolean(string); } } // Validates current form. function formValidate() { var assignFocus = true; var ERROR_MSG = FormCenterHomeScriptResources.InvalidEmailAddressFormat2; var wantCopy = document.getElementById('wantCopy'); if (wantCopy) { wantCopyAddr = document.getElementById('wantCopyAddress'); $wantCopyAddrLI = $(wantCopyAddr.parentNode.parentNode); if ($wantCopyAddrLI.is(":visible") && wantCopyAddr.value != "") { if (!emailValidate(wantCopyAddr.value)) { errorShow(ERROR_MSG); return false; } } if (wantCopy.checked == false)//if the checkbox is not checked then empty the emailaddress textbox document.getElementById('wantCopyAddress').value = ""; } else { //if the checkbox is not checked then empty the emailaddress textbox var wantCopyAddress = document.getElementById('wantCopyAddress'); if (wantCopyAddress) document.getElementById('wantCopyAddress').value = ""; } if (typeof formValidators.keys !== 'undefined') { var liCurrent = $('li.current'); var step = "1"; if (liCurrent.length > 0) { step = liCurrent.attr('id').replace('liStep', ''); } var wizardStep = $('#wizard' + step); if (wizardStep.length > 0) { wizardStep = wizardStep[0]; } var checkForInappropriateWords = new Array(); for (var i = 0, len = formValidators.keys.length; i < len; i++) { var key = formValidators.keys[i]; if (wizardStep == null || wizardStep.length == 0 || (wizardStep != null && wizardStep.contains(formValidators[key].elemContainer))) { if (!formValidators[key].validate(assignFocus, checkForInappropriateWords)) assignFocus = false; } } if (validateInappropriateWords(checkForInappropriateWords)) { assignFocus = false; } } return assignFocus; } function validateInappropriateWords(checkForInappropriateWords) { var data = {}; var j = 0; var inappropriateWordsFound = false; for (j = 0; j < checkForInappropriateWords.length; j++) { data[checkForInappropriateWords[j].id.toString()] = checkForInappropriateWords[j].elemInput.value.trim(); } var results = HasInappropriateWordsMultiple(data); for (j = 0; j < checkForInappropriateWords.length; j++) { if (results[checkForInappropriateWords[j].id.toString()] == true) { checkForInappropriateWords[j].handleInappropriateWords(inappropriateWordsFound == false); inappropriateWordsFound = true; } } return inappropriateWordsFound; } // Displays error message if email validation failed function errorShow(message) { var elemContainer = $('.anonEmail'); elemContainer.addClass('error'); if (elemContainer.find('.explanation').length == 0) { var errorElemMsg = document.createElement('p'); errorElemMsg.className = 'explanation'; errorElemMsg.innerHTML = message; elemContainer.append(errorElemMsg); } } // Determines if URL contains print querystring. function containsPrint(url) { return url.search(/(&|\?)print\=yes(&.*|)$/i) > -1; } // Extracts CategoryID identifier from URL specified. function extractCategoryIDFromURL(url) { url = url.toLowerCase(); var indexOfForm = url.lastIndexOf("/formcenter/"); if (indexOfForm > -1) { //extract the categoryurl var formURL = url.substr(indexOfForm + 12); //check whether u have formid appended if (formURL.indexOf("/") > -1) formURL = formURL.substr(0, formURL.indexOf("/")); //check wheter the url has categoryName var indexOfHypen = formURL.lastIndexOf("-"); var categoryID = 0; if (indexOfHypen > -1) categoryID = formURL.substr(indexOfHypen + 1); else categoryID = formURL; return categoryID; } else return null; } // Extracts form identifier from URL specified. function extractFormIDFromURL(url) { return $('#hdnFormID').val(); //there is some query string appended if so remove those if (url.indexOf("/?") > -1) { url = url.substr(0, url.indexOf("/?")); } url = url.toLowerCase(); var indexOfForm = url.lastIndexOf("/formcenter/"); if (indexOfForm > -1) { //extract the url var formURL = url.substr(indexOfForm + 12); if (formURL.indexOf("/") > -1) { formURL = formURL.substr(formURL.indexOf("/") + 1); //check wheter the url has categoryName var indexOfHypen = formURL.lastIndexOf("-"); var formID = 0; if (indexOfHypen > -1) formID = formURL.substr(indexOfHypen + 1); else if (formURL == "") return null; else formID = formURL; return formID; } else return null; } else return null; } // Attaches expand/collapse handlers to section headers. function attachCategoryVisibilityTogglers() { $('#FormCenterContent .contentMain').click(function (event) { var target = event.target; if (/^lnkLess[0-9]*$/.test(target.id)) { // Form details should shrink. lessInfo(parseInt(target.id.substr(7), 10)); event.preventDefault(); } else if (/^lnkMore[0-9]*$/.test(target.id)) { // Form details should expand. moreInfo(parseInt(target.id.substr(7), 10)); event.preventDefault(); } else { // If the arrow glyph was clicked, treat it as if the header was clicked. if (target.nodeName == 'SPAN' && target.className == 'arrow') target = target.parentNode; // If the header was clicked. if (target.nodeName == 'H2') { var parent = target.parentNode; // If parent identifier matches expected pattern, get category ID and expand/collapse it. if (parent && /^cat[0-9]*$/.test(parent.id)) { var categoryID = parseInt(parent.id.substr(3), 10); expandCollaspseCategory(categoryID); // Prevent default code from executing. event.preventDefault(); } } } }); } // Called by form submittal to handle radio buttons for serialization. function submitRadioHandler() { var names = []; var values = {}; $checkBoxSelector = null; $webCheckBox = $('div.formWrap ol.cpForm input[type=radio]'); $mobileCheckBox = $('.mobileGuts input[type=radio]'); if ($webCheckBox.length != 0 && $mobileCheckBox.length == 0) $checkBoxSelector = $webCheckBox; if ($webCheckBox.length == 0 && $mobileCheckBox.length != 0) $checkBoxSelector = $mobileCheckBox; if ($checkBoxSelector != null) { // Get list of radio inputs and their values. $checkBoxSelector.each(function () { if (!names.contains(this.name)) { names.push(this.name); values[this.name] = ''; } if (this.checked) values[this.name] = this.value; }) } // Map collected data to hidden inputs submitted to server. for (var i = 0, len = names.length; i < len; i++) { var inputName = names[i]; var id = (inputName.match(/_/g) || []).length == 2 ? inputName.substring(inputName.indexOf('_') + 1) : inputName; document.getElementById(id).value = values[inputName]; } } // Called by form submittal to handle checkboxes for serialization. function submitCheckboxHandler() { var names = []; var values = {}; $checkBoxSelector = null; $webCheckBox = $('div.formWrap ol.cpForm input[type=checkbox]'); $mobileCheckBox = $('.mobileGuts input[type=checkbox]'); if ($webCheckBox.length != 0 && $mobileCheckBox.length == 0) $checkBoxSelector = $webCheckBox; if ($webCheckBox.length == 0 && $mobileCheckBox.length != 0) $checkBoxSelector = $mobileCheckBox; // Get list of checkbox inputs and their values. if ($checkBoxSelector != null) { $checkBoxSelector.each(function () { if (!names.contains(this.name)) { names.push(this.name); values[this.name] = []; } if (this.checked) { var val = this.value.replace(/\,/g, '_comma_'); if (val.trim() == '') val = '_empty_value_'; values[this.name].push(val); } }); } // Map collected data to hidden inputs submitted to server. for (var i = 0, len = names.length; i < len; i++) document.getElementById(names[i]).value = values[names[i]].join(','); } function submitDateTimeHandler() { var names = []; var values = []; var $datePickers, $timePickers; if ($('.formCenterDatePicker').length > 0) { $datePickers = $('.formCenterDatePicker'); $timePickers = $('.formCenterTimePicker'); } else { $datePickers = $('.telerikDatePicker'); $timePickers = $('.telerikTimePicker'); } $datePickers.each(function () { if (!names.contains(this.name)) { names.push(this.name); values[this.name] = [this.value]; } else { values[this.name].push(this.value); } }); $timePickers.each(function () { if (!names.contains(this.name)) { names.push(this.name); values[this.name] = ['', '', this.value]; } else { if (values[this.name].length == 1) { values[this.name].push(''); } values[this.name].push(this.value); } }); for (var i = 0, len = names.length; i < len; i++) document.getElementById(names[i]).value = values[names[i]].join(); } $(function () { $('#aspnetForm,form[name=aspnetForm]').attr('enctype', "multipart/form-data"); $('#aspnetForm,form[name=aspnetForm]').addClass('submitForm'); }); ; window.pageHandleResponsive = true; $.when(window.Pages.rwdReady).done(function () { toggleClassMedia("maxWidth600px", ".cpForm:media(this-max-width: 600px)"); toggleClassMedia("maxWidth515px", "#FormCenterContent:media(this-max-width: 515px)"); toggleClassMedia("maxWidth485px", "#FormCenterContent:media(this-max-width: 485px)"); toggleClassMedia("maxWidth440px", ".cpForm:media(this-max-width: 440px)"); toggleClassMedia("maxWidth395px", "#FormCenterContent:media(this-max-width: 395px)"); toggleClassMedia("maxWidth380px", ".cpForm:media(this-max-width: 380px)"); });