1/* 2 Umbraco Forms - Dependencies Checker 3*/ 4 5function performDependencyChecks(formId){ 6 7 //Only perform check if the global 'Umbraco.Sys' is null/undefined 8 //If present means we are in backoffice & that this is being rendered as a macro preview 9 //We do not need to perform this check here 10 if (typeof Umbraco !== 'undefined' && typeof Umbraco.Sys !== 'undefined'){ 11 return; 12 } 13 else { 14 //Check that a Form ID is passed into the function 15 if(formId){ 16 17 //Select the wrapping div around the form 18 //umbraco_form_GUID 19 var umbracoForm = document.getElementById('contour_form_' + formId); 20 21 var errorElement = document.createElement('div'); 22 errorElement.className='umbraco-forms missing-library'; 23 errorElement.style.color = '#fff'; 24 errorElement.style.backgroundColor = '#9d261d'; 25 errorElement.style.padding = '15px'; 26 errorElement.style.margin = '10px 0'; 27 var errorMessage = ""; 28 29 //Ensure umbracoForm is not null 30 if(umbracoForm) { 31 32 //Check for jQuery 33 if (typeof jQuery == 'undefined') { 34 errorMessage = errorMessage + 'jQuery has not been loaded & is required for Umbraco Forms.'; 35 } else { 36 //These only work if jQuery is present, so it's in the else block 37 38 //Check for jQuery Validation 39 if(!$.validator) { 40 errorMessage = errorMessage + '<br />jQuery Validate has not been loaded & is required for Umbraco Forms.' 41 } 42 43 //Check for jQuery Validation Unobtrusive 44 //Only works if jQuery validator has been loaded 45 if($.validator && !$.validator.unobtrusive) { 46 errorMessage = errorMessage + '<br />jQuery Validate Unobtrusive has not been loaded & is required for Umbraco Forms.'; 47 } 48 } 49 if(errorMessage !== "") { 50 errorElement.innerHTML = errorMessage + '<br/> <a href="https://our.umbraco.org/documentation/products/umbracoforms/developer/Prepping-Frontend/" target="_blank" style="text-decoration:underline; color:#fff;">See Umbraco Forms Documentation</a>'; 51 umbracoForm.insertBefore(errorElement, umbracoForm.childNodes[0]); 52 } 53 } 54 } 55 } 56} 57
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.