1(function () { 2 3 4 // polyfill for matches and closest 5 if (!Element.prototype.matches) Element.prototype.matches = Element.prototype.msMatchesSelector; 6 if (!Element.prototype.closest) Element.prototype.closest = function (selector) { 7 var el = this; 8 while (el) { 9 if (el.matches(selector)) { 10 return el; 11 } 12 el = el.parentElement; 13 } 14 }; 15 16 17 18 //execute init() on document ready 19 if (document.readyState === "complete" || (document.readyState !== "loading" && !document.documentElement.doScroll)) { 20 listen(); 21 } else { 22 document.addEventListener("DOMContentLoaded", listen); 23 } 24 25 function listen() { 26 27 // Inline script setting umbracoFormsCollection was removed in 8.11/9.3, and replaced by config elements. 28 // So if we have them, use it, otherwise fall-back to legacy method. 29 var configElements = document.getElementsByClassName("umbraco-forms-form-config"); 30 if (configElements.length > 0) { 31 var umbracoFormsCollectionFromConfig = []; 32 for (var i = 0; i < configElements.length; i++) { 33 var configElement = configElements[i]; 34 var form = { 35 formId: configElement.dataset.id, 36 pageButtonConditions: JSON.parse(configElement.dataset.serializedPageButtonConditions), 37 fieldSetConditions: JSON.parse(configElement.dataset.serializedFieldsetConditions), 38 fieldConditions: JSON.parse(configElement.dataset.serializedFieldConditions), 39 recordValues: JSON.parse(configElement.dataset.serializedFieldsNotDisplayed) 40 }; 41 umbracoFormsCollectionFromConfig.push(form); 42 } 43 initCollection(umbracoFormsCollectionFromConfig, true); // Set the 'jsonParsed' flag, indicating that we already have a JSON structure, which we don't have with the legacy, inline script method. 44 } else { 45 if (typeof umbracoFormsCollection === "undefined") { 46 //this will occur if this js file is loaded before the inline scripts, in which case 47 //we'll listen for the inline scripts to execute a custom event. 48 document.addEventListener("umbracoFormLoaded", init); 49 } 50 else { 51 initCollection(umbracoFormsCollection); 52 } 53 } 54 55 // Scrolling to the submitted form was also moved from an inline script in 8.11/9.3. 56 var submittedFormElement = document.getElementById("umbraco-forms-form-submitted"); 57 if (submittedFormElement) { 58 scrollToSubmittedForm(); 59 } 60 } 61 62 function initCollection(formsCollection, jsonParsed) { 63 configureUmbracoFormsValidation(); 64 65 for (var i = 0; i < formsCollection.length; i++) { 66 init({ form: formsCollection[i] }, jsonParsed); 67 } 68 } 69 70 function init(e, jsonParsed) { 71 72 var formItem = jsonParsed ? e.form : JSON.parse(decodeURI(e.form)); 73 74 var forms = document.querySelectorAll('.umbraco-forms-form'); 75 76 for(var i = 0; i < forms.length; i++) { 77 var form = forms[i]; 78 79 dependencyCheck(form); 80 81 var page = form.querySelector('.umbraco-forms-page'); 82 var conditions = new UmbracoFormsConditions(page, 83 formItem.pageButtonConditions, 84 formItem.fieldSetConditions, 85 formItem.fieldConditions, 86 formItem.recordValues); 87 conditions.watch(); 88 89 applyFormAccessibility(form); 90 } 91 } 92 93 function scrollToSubmittedForm() { 94 document.onreadystatechange = function () { 95 96 if (document.readyState == "complete") { 97 var validationsDivs = document.querySelectorAll(".field-validation-error, .umbraco-forms-submitmessage"); 98 var scrollY = 0; 99 for (var i = 0; i < validationsDivs.length; i++) { 100 var node = getNode(validationsDivs[i]); 101 var offset = node.getBoundingClientRect().top; 102 if (0 < offset && (offset < scrollY || scrollY === 0)) { 103 scrollY = offset; 104 } 105 } 106 107 if (scrollY > 0) { 108 window.scrollTo(0, scrollY); 109 } 110 } 111 } 112 113 function getNode(node) { 114 var runner = node; 115 while (runner.tagName !== "BODY") { 116 if (runner.classList.contains("umbraco-forms-field")) { 117 return runner; 118 } 119 120 runner = runner.parentNode; 121 } 122 123 return node; 124 } 125 } 126 127 /** Configures the jquery validation for Umbraco forms */ 128 function configureUmbracoFormsValidation() { 129 130 if (window.aspnetValidation !== undefined) { 131 // Asp-net validation setup: 132
133 var validationService = new aspnetValidation.ValidationService(); 134 135 // TODO: equivilant to this: 136 /* 137 $.validator.setDefaults({ 138 ignore: ":hidden" 139 }); 140 */ 141 142 var required = function (value, element) { 143 // Handle single and multiple checkboxes: 144 if(element.type.toLowerCase() === "checkbox" || element.type.toLowerCase() === "radio") { 145 var allCheckboxesOfThisName = element.form.querySelectorAll("input[name='"+element.name+"']"); 146 for (var i=0; i<allCheckboxesOfThisName.length; i++) { 147 if (allCheckboxesOfThisName[i].checked === true) { 148 return true; 149 } 150 } 151 return false; 152 } 153 return Boolean(value); 154 } 155 validationService.addProvider("requiredcb", required); 156 validationService.addProvider("required", required);// this will go instead of the build-in required. 157 158 159 var umbracoforms_regex = function (value, element, params) { 160 if (!value || !params.pattern) { 161 return true; 162 } 163 164 var r = new RegExp(params.pattern); 165 return r.test(value); 166 } 167 validationService.addProvider("umbracoforms_regex", umbracoforms_regex); 168 169 var wrapProviderWithIgnorerBehaviour = function (provider) { 170 return function(value, element, params) { 171 172 // If field is hidden we ignorer the validation. 173 if (element.offsetParent === null) { 174 return true; 175 } 176 177 return provider(value, element, params); 178 } 179 } 180 181 // we can only incept with default validator if we do it after bootstrapping but before window load event triggers validationservice. 182 window.addEventListener('load', function() { 183 184 // Wrap all providers with ignorer hidden fields logic: 185 for (var key in validationService.providers) { 186 validationService.providers[key] = wrapProviderWithIgnorerBehaviour(validationService.providers[key]); 187 } 188 }); 189 190 // bootstrap validation service. 191 validationService.bootstrap(); 192
193 // Without jquery validation, the previous page submit button click isn't sent with it's name, 194 // so can't be used server-side to determine whether to go forward or back. 195 // Hence we'll use an alternate method, setting a hidden field that's also used in the check. 196 var handlePreviousClicked = function () { 197 this.form.elements["PreviousClicked"].value = "clicked"; 198 }; 199 200 // - previous buttons are indicated by a data attribute of data-umb="prev-forms-form", introduced in 8.12/9.4. 201 var previousButtonElements = document.querySelectorAll("[data-umb='prev-forms-form']"); 202 203 // - prior to that classes were used to identify them, so for compatibility with custom themes, we'll check for those too 204 // if we haven't found any via the data attribute. 205 if (previousButtonElements.length === 0) { 206 previousButtonElements = document.getElementsByClassName("prev cancel"); 207 } 208 209 for (var i = 0; i < previousButtonElements.length; i++) { 210 previousButtonElements[i].form.elements["PreviousClicked"].value = ""; 211 previousButtonElements[i].addEventListener('click', handlePreviousClicked, false); 212 } 213 214 } else if (typeof jQuery === "function" && $.validator && $.validator.unobtrusive) { 215 //Jquery validation setup 216 217 $.validator.setDefaults({ 218 ignore: ":hidden" 219 }); 220 221 $.validator.unobtrusive.adapters.addBool("requiredcb", "required"); 222 223 224 $.validator.addMethod("umbracoforms_regex", function (value, element) { 225 226 var regex = $(element).attr("data-regex"); 227 var val = $(element).val(); 228 if (val.length === 0) { 229 return true; 230 } 231 return val.match(regex); 232 }); 233 234 $.validator.unobtrusive.adapters.addBool("regex", "umbracoforms_regex"); 235 236 var submitInputs = document.querySelectorAll(".umbraco-forms-form input[type=submit]:not(.cancel)"); 237 for (let i = 0; i < submitInputs.length; i++) { 238 var input = submitInputs[i]; 239 input.addEventListener("click", function (evt) { 240 evt.preventDefault(); 241 var frm = $(this).closest("form"); 242 resetValidationMessages(frm[0]); 243 frm.validate(); 244 if (frm.valid()) { 245 frm.submit(); 246 this.setAttribute("disabled", "disabled"); 247 248 } 249 }.bind(input)); 250 } 251 } 252 253 } 254 255 /** 256 * method to determine if Umbraco Forms can run and has the required dependencies loaded 257 * @param {Form Element} formEl the element of the form 258 */ 259 function dependencyCheck(formEl) { 260 // Only perform check if the global 'Umbraco.Sys' is null/undefined. 261 // If present means we are in backoffice & that this is being rendered as a macro preview and We do not need to perform this check here. 262 // Similarly we need a check for if running in a rich text editor. 263 var isBackOffice = function () { 264 return typeof Umbraco !== "undefined" && typeof Umbraco.Sys !== "undefined"; 265 }; 266 var isBackOfficeRte = function () { 267 return document.body.id === "tinymce"; 268 }; 269 if (isBackOffice() || isBackOfficeRte()) { 270 return; 271 } 272 273 var errorElement = document.createElement("div"); 274 errorElement.className = "umbraco-forms missing-library"; 275 errorElement.style.color = "#fff"; 276 errorElement.style.backgroundColor = "#9d261d"; 277 errorElement.style.padding = "15px"; 278 errorElement.style.margin = "10px 0"; 279 var errorMessage = ""; 280 281 //Ensure umbracoForm is not null 282 if (formEl) { 283 284 //Check to see if the message for the form has been inserted already 285 var checkForExistinhgErr = formEl.getElementsByClassName('umbraco-forms missing-library'); 286 if (checkForExistinhgErr.length > 0) { 287 return; 288 } 289 290 var hasValidationFramework = false; 291 292 if (window.jQuery && $ && $.validator !== undefined) { 293 hasValidationFramework = true; 294 } else if (window.aspnetValidation !== undefined) { 295 hasValidationFramework = true; 296 } 297 298 if(hasValidationFramework === false) { 299 errorMessage = errorMessage + "Umbraco Forms requires a validation framework to run, please read documentation for posible options."; 300 } 301 302 if (errorMessage !== "") { 303 errorElement.innerHTML = errorMessage + '<br/> <a href="https://our.umbraco.org/documentation/products/umbracoforms/developer/Prepping-Frontend/" target="_blank" style="text-decoration:underline;
303 color:#fff;">See Umbraco Forms Documentation</a>'; 304 305 formEl.insertBefore(errorElement, formEl.childNodes[0]); 306 } 307 } 308 } 309 310 /** 311 * Applies form accessibility improvements. 312 * @param {Element} formEl the element of the form. 313 */ 314 function applyFormAccessibility(formEl) { 315 setFocusToFirstElementOnValidationError(formEl); 316 } 317 318 /** 319 * Monitors for validation errors and when found sets the focus to the first field with an error. 320 * @param {Element} formEl the element of the form. 321 */ 322 function setFocusToFirstElementOnValidationError(formEl) { 323 if ("MutationObserver" in window === false) { 324 return; 325 } 326 327 // To implement this, we are relying on on monitoring for validation message elements, which only fires when there are changes. 328 // So if you have two errors, and fix the first one, it wouldn't then highlight the second one on re-submitting the form. 329 // Unless we reset the validation messages on submit, so they get changed back on errors. 330 if (window.aspnetValidation !== undefined) { 331 var form = formEl.getElementsByTagName('form')[0]; 332 var handleResetValidationMessages = function (event) { 333 resetValidationMessages(form); 334 }; 335 form.addEventListener('submit', handleResetValidationMessages, false); 336 } else { 337 // For jquery.validate, we need to hook this in as part of the submit handler coded in configureUmbracoFormsValidation(); 338 } 339 340 // Watch for changes to the validation error messages in the DOM tree using a MutationObserver. 341 // See: https://developer.mozilla.org/en-US/docs/Web/API/MutationObserver 342 var observer = new MutationObserver(function (mutationRecords) { 343 for (var i = 0; i < mutationRecords.length; i++) { 344 var mutationRecord = mutationRecords[i]; 345 if (mutationRecord.target.className === 'field-validation-error') { 346 setFocusOnFormField(mutationRecord.target); 347 break; 348 } 349 } 350 }); 351 352 observer.observe(formEl, { 353 attributes: true, 354 attributeFilter: ['class'], 355 childList: false, 356 characterData: false, 357 subtree: true 358 }); 359 } 360 361 /** 362 * Resets the validation messages for a form. 363 * @param {Element} formEl the element of the form. 364 */ 365 function resetValidationMessages(formEl) { 366 var validationErrorMessageElements = formEl.getElementsByClassName('field-validation-error'); 367 for (var i = 0; i < validationErrorMessageElements.length; i++) { 368 validationErrorMessageElements[i].className = 'field-validation-valid'; 369 } 370 } 371 372 /** 373 * Sets the focus to the form field input element associated with the provided validation message element. 374 * @param {Element} validationErrorEl the element of the validation error. 375 */ 376 function setFocusOnFormField(validationErrorEl) { 377 var formFieldElement = validationErrorEl.previousElementSibling; 378 while (formFieldElement) { 379 if (formFieldElement.tagName.toLowerCase() === 'input' || 380 formFieldElement.tagName.toLowerCase() === 'textarea' || 381 formFieldElement.tagName.toLowerCase() === 'select') { 382 formFieldElement.focus(); 383 break; 384 } 385 386 if (formFieldElement.classList.contains("radiobuttonlist") || 387 formFieldElement.classList.contains("checkboxlist")) { 388 for (var i = 0; i < formFieldElement.children.length; i++) { 389 var formFieldChildElement = formFieldElement.children[i]; 390 if (formFieldChildElement.tagName.toLowerCase() === 'input') { 391 formFieldChildElement.focus(); 392 break; 393 } 394 } 395 396 break; 397 } 398 399 formFieldElement = formFieldElement.previousElementSibling; 400 } 401 } 402 403 /** 404 * Class to handle Umbraco Forms conditional statements 405 * @param {any} form a reference to the form 406 * @param {any} pageButtonConditions a reference to the page button conditions 407 * @param {any} fieldsetConditions a reference to the fieldset conditions 408 * @param {any} fieldConditions a reference to the field conditions 409 * @param {any} values the form values 410 * @return {Object} reference to the created class 411 */ 412 function UmbracoFormsConditions(form, pageButtonConditions, fieldsetConditions, fieldConditions, values) { 413
414 //our conditions "class" - must always be newed to work as it uses a form instance to operate on 415 //load all the information from the dom and serverside info and then the class will take care of the rest 416 417 var self = {}; 418 self.form = form; 419 self.pageButtonConditions = pageButtonConditions; 420 self.fieldsetConditions = fieldsetConditions; 421 self.fieldConditions = fieldConditions; 422 self.values = values; 423 self.dataTypes = {}; 424 425 //Iterates through all the form elements found on the page to update the registered value 426 function populateFieldValues(page, formValues, dataTypes) { 427 428 var selectFields = page.querySelectorAll("select"); 429 for (let i = 0; i < selectFields.length; i++) { 430 const field = selectFields[i]; 431 formValues[field.getAttribute("id")] = field.value ? field.querySelector("option[value='" + field.value.replace(/'/g, "\\'") + "']").innerText : null; 432 dataTypes[field.getAttribute("id")] = "select"; 433 } 434 435 var textareaFields = page.querySelectorAll("textarea"); 436 for (let i=0; i<textareaFields.length; i++) { 437 const field = textareaFields[i]; 438 formValues[field.getAttribute("id")] = field.value; 439 dataTypes[field.getAttribute("id")] = "textarea"; 440 } 441 442 // clear out all saved checkbox values to we can safely append 443 var checkboxFields = page.querySelectorAll("input[type=checkbox]"); 444 for (let i=0; i<checkboxFields.length; i++) { 445 const field = checkboxFields[i]; 446 formValues[field.getAttribute("name")] = null; 447 dataTypes[field.getAttribute("id")] = "checkbox"; 448 } 449 450 //$page.find("input").each(function () { 451 var inputFields = page.querySelectorAll("input"); 452 for (let i=0; i<inputFields.length; i++) { 453 const field = inputFields[i]; 454 455 if (field.getAttribute('type') === "text" || 456 field.getAttribute('type') === "number" || 457 field.getAttribute('type') === "email" || 458 field.getAttribute('type') === "url" || 459 field.getAttribute('type') === "tel" || 460 field.getAttribute('type') === "date" || 461 field.getAttribute('type') === "datetime-local" || 462 field.getAttribute("type") === "hidden") { 463 formValues[field.getAttribute("id")] = field.value; 464 dataTypes[field.getAttribute("id")] = "text"; 465 } 466 467 if (field.getAttribute('type') === "radio") { 468 if (field.matches(':checked')) { 469 formValues[field.getAttribute("name")] = field.value; 470 dataTypes[field.getAttribute("id")] = "radio"; 471 } 472 } 473 474 if (field.getAttribute("type") === "checkbox") { 475 if (field.getAttribute("id") !== field.getAttribute("name")) { 476 if (field.matches(":checked")) { 477 if (formValues[field.getAttribute("name")] === null) { 478 formValues[field.getAttribute("name")] = field.value; 479 } 480 else { 481 formValues[field.getAttribute("name")] += ";;" + field.value; 482 } 483 } 484 } 485 else { 486 formValues[field.getAttribute("name")] = (field.matches(":checked") ? "true" : "false"); 487 } 488 } 489 } 490 } 491 492 /* Public api */ 493 494 self.operators = { 495 Is: function (value, expected, dataType) { 496 if ((value || "") === expected) { 497 return true; 498 } 499 if (value == null) { 500 return (expected == value); 501 } 502 503 if (dataType === "checkbox") { 504 if (expected.toUpperCase() === "TRUE" || expected.toUpperCase() === "ON") { 505 expected = "true" 506 } else if (expected.toUpperCase() === "FALSE" || expected.toUpperCase() === "OFF") { 507 expected = "false" 508 } 509 } 510 511 var values = value.split(';;'); 512 var matchingExpected = values.filter( 513 function (o) { 514 return o === expected; 515 }); 516 return matchingExpected.length > 0;
517 }, 518 IsNot: function (value, unexpected, dataType) { 519 if (value == null) { 520 return (unexpected != value); 521 } 522 var values = value.split(';;'); 523 var matchingUnexpected = values.filter( 524 function (o) { 525 return o === unexpected; 526 }); 527 528 if (dataType === "checkbox") { 529 if (unexpected.toUpperCase() === "TRUE" || unexpected.toUpperCase() === "ON") { 530 unexpected = "true" 531 } else if (unexpected.toUpperCase() === "FALSE" || unexpected.toUpperCase() === "OFF") { 532 unexpected = "false" 533 } 534 } 535 return (value || "") !== unexpected && matchingUnexpected.length === 0; 536 }, 537 GreaterThen: function (value, limit) { 538 if (isNaN(value) || isNaN(limit)) { 539 return value > limit; 540 } 541 542 return parseInt(value) > parseInt(limit); 543 }, 544 LessThen: function (value, limit) { 545 if (isNaN(value) || isNaN(limit)) { 546 return value < limit; 547 } 548 549 return parseInt(value) < parseInt(limit); 550 }, 551 StartsWith: function (value, criteria) { 552 return value && value.indexOf(criteria) === 0; 553 }, 554 EndsWith: function (value, criteria) { 555 return value && value.indexOf(criteria) === value.length - criteria.length; 556 }, 557 Contains: function (value, criteria) { 558 return value && value.indexOf(criteria) > -1; 559 } 560 }; 561 562 self.watch = function () { 563 // This is a special case for pikaday 564 // The only way around to pickup the value, for now, is to 565 // subscribe to blur events 566 var datepickerfields = self.form.querySelectorAll('.datepickerfield'); 567 for(let i = 0; i < datepickerfields.length; i++) { 568 const field = datepickerfields[i]; 569 field.addEventListener('blur', function () { 570 if(this.value===""){ 571 // Here comes the hack 572 // Force the hidden datepicker field the datepicker field 573 var id = this.getAttribute("id"); 574 var hiddenDatePickerField = id.substr(0, id.length-2); 575 self.values[hiddenDatePickerField]=""; 576 document.getElementById(hiddenDatePickerField).value="";// sadly we cant use querySelector with current mark-up (would need to prefix IDs) 577 } 578 579 populateFieldValues(self.form, self.values, self.dataTypes); 580 //process the conditions 581 self.run(); 582 }.bind(field)); 583 } 584 //subscribe to change events 585 var changeablefields = self.form.querySelectorAll("input, textarea, select"); 586 for(let i = 0; i < changeablefields.length; i++) { 587 const field = changeablefields[i]; 588 field.addEventListener("change", function () { 589 populateFieldValues(self.form, self.values, self.dataTypes); 590 //process the conditions 591 self.run(); 592 }.bind(field)); 593 } 594 595 //register all values from the current fields on the page 596 populateFieldValues(self.form, self.values, self.dataTypes); 597 598 //the initial run-through of all the conditions 599 self.run(); 600 }; 601 602 self.run = function () { 603 var fsId, 604 fieldId, 605 606 /* 607 fsConditions = params.fsConditions || {}, 608 fieldConditions = params.fieldConditions || {}, 609 values = params.values || {},*/ 610 611 cachedResults = {}; 612 613 function evaluateRuleInstance(rule) { 614 var value = self.values[rule.field], 615 dataType = self.dataTypes[rule.field], 616 func = self.operators[rule.operator], 617 result = value !== null && func(value, rule.value, dataType); 618 return result; 619 } 620 621 function evaluateRule(rule) { 622 var dependencyIsVisible = true; 623 624 if (self.fieldConditions[rule.field]) { 625 dependencyIsVisible = isVisible(rule.field, self.fieldConditions[rule.field]); 626 } 627 628 if (dependencyIsVisible) { 629 return evaluateRuleInstance(rule); 630 } 631 else { 632 return false; 633 } 634 } 635 636 function evaluateCondition(id, condition) { 637 // This was once pretty. Now it needs refactoring again. :) 638 639 var any = condition.logicType === "Any", 640 all = condition.logicType === "All", 641 fieldsetVisibilities = {}, 642 hasHiddenFieldset = false, 643 success = true, 644 rule, 645 i; 646 647 // If we don't have any rules defined, we must return false (as neither 'any' nor 'all' of the conditions 648 // can be considered passing). 649 if (condition.rules.length === 0) { 650 return false; 651 } 652 653 for (i = 0; i < condition.rules.length; i++) { 654 rule = condition.rules[i]; 655 656 if (id === rule.field || id === rule.fieldsetId) { 657 throw new Error("Field or fieldset " + id + " has a condition on itself."); 658 } 659 660 if (fieldsetVisibilities[rule.fieldsetId] !== undefined) { 661 continue; 662 } 663 664 if (self.fieldsetConditions[rule.fieldsetId]) { 665 666 fieldsetVisibilities[rule.fieldsetId] = 667 isVisible(rule.fieldsetId, self.fieldsetConditions[rule.fieldsetId]); 668 669 if (!fieldsetVisibilities[rule.fieldsetId]) { 670 hasHiddenFieldset = true; 671 } 672 } 673 else { 674 fieldsetVisibilities[rule.fieldsetId] = true; 675 } 676 } 677 678 if (all && hasHiddenFieldset) { 679 return false; 680 } 681 682 for (i = 0; i < condition.rules.length; i++) { 683 rule = condition.rules[i]; 684 685 if (fieldsetVisibilities[rule.fieldsetId]) { 686 success = evaluateRule(condition.rules[i]); 687 } 688 else { 689 success = false; 690 } 691 692 if (any && success) { 693 break; 694 } 695 if (all && !success) { 696 break; 697 } 698 } 699 return success; 700 } 701 702 function evaluateConditionVisibility(id, condition) { 703 var show = condition.actionType === "Show", 704 cachedResult = cachedResults[id]; 705 706 var success; 707 if (cachedResult === undefined) { 708 cachedResults[id] = show; // set default value to avoid circular issues 709 success = (cachedResults[id] = evaluateCondition(id, condition)); 710 } else { 711 success = cachedResult; 712 } 713 714 var visible = !(success ^ show); 715 return visible; 716 } 717 718 function isVisible(id, condition) { 719 if (condition) { 720 return evaluateConditionVisibility(id, condition); 721 } 722 return true; 723 } 724 725 function handleCondition(element, id, condition) { 726 var shouldShow = isVisible(id, condition); 727 if (element) { 728 if (shouldShow) { 729 element.style.display = ""; 730 } 731 else { 732 element.style.display = "none"; 733 } 734 } 735 } 736 737 for (pageId in self.pageButtonConditions) { 738 if (Object.prototype.hasOwnProperty.call(self.pageButtonConditions, pageId)) { 739 var pageElem = document.getElementById(pageId); 740 if (pageElem) { 741 handleCondition(pageElem.querySelector("input[name='__next'], button[name='__next']"), fsId, self.pageButtonConditions[pageId], "Page"); 742 } 743 } 744 } 745 746 for (fsId in self.fieldsetConditions) { 747 if (Object.prototype.hasOwnProperty.call(self.fieldsetConditions, fsId)) { 748 handleCondition(document.getElementById(fsId), fsId, self.fieldsetConditions[fsId], "Fieldset");// sadly we cant use querySelector with current mark-up (would need to prefix IDs) 749 } 750 } 751 752 for (fieldId in self.fieldConditions) { 753 if (Object.prototype.hasOwnProperty.call(self.fieldConditions, fieldId)) { 754 if (document.getElementById(fieldId)) { 755 handleCondition(document.getElementById(fieldId).closest(".umbraco-forms-field"),// sadly we cant use querySelector with current mark-up (would need to prefix IDs) 756 fieldId, 757 self.fieldConditions[fieldId], 758 "Field"); 759 } 760 } 761 } 762 }; 763 764 return self; 765 } 766})();
Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.