// Copyright Nintex ´╗┐Type.registerNamespace('NWF');Type.registerNamespace('NWF.FormFiller');if(typeof console==="undefined"){console={log:function(){},debug:function(){}};} NWF.AdjustDialogOverlay=function(){var doc=window.parent.document;var overlays=doc.getElementsByClassName("ms-dlgOverlay");if(overlays.length==0){return;} var overlay=overlays[0];if(overlay.style.display==="none"){return;} var dialogs=doc.getElementsByClassName("ms-dlgContent");var dialogCount=dialogs.length;if(dialogCount==0){return;} var maxZindex=0;for(var i=0;imaxZindex) {maxZindex=dialogs[i].style.zIndex;}} if(overlay.style.zIndex>maxZindex){overlay.style.zIndex=maxZindex-1;}};NWF.FormFiller.Attachments=function(){var fileUploadInputPrefix="fileupload";var fileUploadHiddenPrefix="HID_";var FileUploadIndex=0;var OkInProgress=false;var attachmentFileNameLookUp={};var attachmentNameMappingLookup={};var getUniqueAttachmentName=function(f){var uniqueFileName=f;var newFileName;var fileSuffixIndex=1;var i=0;if(attachmentFileNameLookUp[uniqueFileName]){do{newFileName=uniqueFileName;if(newFileName.lastIndexOf(".")!=-1){newFileName=newFileName.substring(0,newFileName.lastIndexOf("."))+"_"+fileSuffixIndex+++newFileName.substring(newFileName.lastIndexOf("."));}else{newFileName=newFileName+"_"+fileSuffixIndex++;}}while(attachmentFileNameLookUp[newFileName]) uniqueFileName=newFileName;} attachmentFileNameLookUp[uniqueFileName]=true;return uniqueFileName;};var createBrowseFileControl=function(oAttachments,browseFileControlId){var L_FileUploadToolTip_text="Select a file";if(NWF.Language&&NWF.Language.Filler_Attachments_Tooltip_Select_File){L_FileUploadToolTip_text=NWF.Language.Filler_Attachments_Tooltip_Select_File;} var inputNode=document.createElement("input");inputNode.tabIndex="1";inputNode.type="File";inputNode.className="nf-attachmentFileInput";inputNode.title=L_FileUploadToolTip_text;inputNode.name=browseFileControlId;inputNode.id=browseFileControlId;oAttachments.appendChild(inputNode);};var recreateBrowseFileControl=function(oAttachments,fileInput){var oldBrowseFileControlId=fileInput.id;NWF$(fileInput).remove();createBrowseFileControl(oAttachments,oldBrowseFileControlId);};var createFileNameControl=function(oAttachments,browseFileControlId){var inputNode2=document.createElement("input");inputNode2.type="hidden";inputNode2.name=fileUploadHiddenPrefix+browseFileControlId;inputNode2.id=fileUploadHiddenPrefix+browseFileControlId;inputNode2.value="";oAttachments.appendChild(inputNode2);};var whitelistedAttachment=function(fileExtension,attachmentControlWhiteList){if(attachmentControlWhiteList.length>0){if(fileExtension!=""&&attachmentControlWhiteList.indexOf("|"+fileExtension+"|",0)!=-1){return true;} return false;}else{return true;}};var blockedAttachment=function(fileExtension){if(fileExtension!=""&&NWF.Utilities.GetIndexOf(NWF.FormFiller.Attachments.BlockedFileExtenstions,fileExtension,0)==-1){return false;} return true;};var getAttachedFilesCount=function(attachmentControlId){if(attachmentNameMappingLookup[attachmentControlId]){return attachmentNameMappingLookup[attachmentControlId].length;} return 0;};var disableEnableAddAttachmentLink=function(attachmentControl){var addAttachmentLink=attachmentControl.children(".nf-attachmentsLink");if(canaddMoreAttachments(attachmentControl)){if(addAttachmentLink.hasClass("nf-disabled")){addAttachmentLink.removeClass("nf-disabled");}} else{if(!addAttachmentLink.hasClass("nf-disabled")){addAttachmentLink.addClass("nf-disabled");}}};var canaddMoreAttachments=function(attachmentControl){var attachedFilesCount=NWF.FormFiller.Attachments.GetAttachedFilesCount(NWF.FormFiller.Functions.GetFillerDivObjectForControl(attachmentControl).data('controlid'));var maxFiles=parseInt(attachmentControl.attr('data-maxFiles'));if(maxFiles!=0&&attachedFilesCount>=maxFiles){return false;}else{return true;}};var addOrphanedAttachment=function(attachmentFileName,defaultAttachmentControl){var orphanedAttachmentCloneNode=NWF$(".nf-orphaned-attachment").clone();var orphanattachmentLinks=orphanedAttachmentCloneNode.find("a");if(orphanattachmentLinks.length){orphanedAttachmentCloneNode[0].id=orphanedAttachmentCloneNode[0].id.replace(/##attname##/g,attachmentFileName);orphanattachmentLinks[0].href=orphanattachmentLinks[0].href.replace(/##attname##/g,attachmentFileName);orphanattachmentLinks[0].innerHTML=orphanattachmentLinks[0].innerHTML.replace(/##attname##/g,attachmentFileName);} if(orphanattachmentLinks.length>1){orphanattachmentLinks[1].href=orphanattachmentLinks[1].href.replace(/##attname##/g,attachmentFileName.replace(/'/g,"\\\'"));} orphanedAttachmentCloneNode.removeClass("nf-orphaned-attachment");defaultAttachmentControl.append(orphanedAttachmentCloneNode);};var processOrphanedAttachments=function(){var defaultAttachmentControls=NWF$(".nf-default-attachment-control");if(defaultAttachmentControls.length){var defaultAttachmentControl=NWF$(defaultAttachmentControls[defaultAttachmentControls.length-1]);if(OrphanAttachments.length){for(var i=0;i"+formattedFileName+"";oCellControl=oRow.insertCell(-1);oCellControl.className="ms-propertysheet";oCellControl.innerHTML=""+attachmentDeleteLabel+"";fileInput.style.display="none";++FileUploadIndex;var browseFileControlId=fileUploadInputPrefix+controlId+FileUploadIndex;createBrowseFileControl(oAttachments,browseFileControlId);createFileNameControl(oAttachments,browseFileControlId);var theForm=fileInput.form;theForm.encoding='multipart/form-data';attachmentsRow.children(".nf-attachmentsLink").css({"display":"block"});attachmentsRow.children(".nf-partAttachment").css({"display":"none"});NWF$("#"+fileUploadHiddenPrefix+fileControlId).val(formattedFileName);disableEnableAddAttachmentLink(attachmentsRow);OkInProgress=false;return true;}},RemoveLocal:function(RowID,FileID,fileName){var fileControl=NWF$("#"+FileID);var hiddenControl=NWF$("#"+fileUploadHiddenPrefix+FileID);var attachmentNewName=hiddenControl.val();var attachmentsRow=fileControl.parents(".nf-attachmentsRow");var controlId=NWF.FormFiller.Functions.GetFillerDivObjectForControl(attachmentsRow).data('controlid');attachmentsRow.children(".nf-partAttachment").css("display");if(attachmentsRow.children(".nf-partAttachment").css("display")=="block"){attachmentsRow.children(".nf-attachmentsLink").css({"display":"block"});attachmentsRow.children(".nf-partAttachment").css({"display":"none"});NWF.FormFiller.Attachments.AdjustAttachmentControlHeight.call(attachmentsRow);} var rowHeight=NWF$("#"+RowID).outerHeight();NWF$("#"+RowID).remove();fileControl.remove();NWF$("#"+fileUploadHiddenPrefix+FileID).remove();NWF.FormFiller.Attachments.AdjustAttachmentControlHeight.call(attachmentsRow,-rowHeight);NWF.FormFiller.Attachments.RemovefromAttachmentNameMappingLookup(controlId,attachmentNewName);disableEnableAddAttachmentLink(attachmentsRow);},RemoveAttachmentFromServer:function(attachmentName,recycleBinEnabled,controServerId){var confirmMessage;if(recycleBinEnabled){confirmMessage="Are you sure you want to send this attachment to the site Recycle Bin?";if(NWF.Language&&NWF.Language.Filler_Attachments_RecycleAttachments_Confirm){confirmMessage=NWF.Language.Filler_Attachments_RecycleAttachments_Confirm;}}else{confirmMessage="Are you sure you want to delete this attachment?";if(NWF.Language&&NWF.Language.Filler_Attachments_DeleteAttachments_Confirm){confirmMessage=NWF.Language.Filler_Attachments_DeleteAttachments_Confirm;}} if(confirm(confirmMessage)){var attachmentFileRow=document.getElementById(controServerId+attachmentName);var rowHeight=NWF$(attachmentFileRow).height();NWF$(attachmentFileRow).remove();NWF.FormFiller.Attachments.AdjustAttachmentControlHeight.call(this,-rowHeight);document.getElementsByName("attachmentsToBeRemovedFromServer").item(0).value+=attachmentName+";";var controlId=NWF.FormFiller.Functions.GetFillerDivObjectForControl(this).data('controlid');NWF.FormFiller.Attachments.RemovefromAttachmentNameMappingLookup(controlId,attachmentName);disableEnableAddAttachmentLink(this);}},TrimWhiteSpaces:function(str){var start;var end;str=str.toString();var len=str.length;for(start=0;startstart;end--){ch=str.charAt(end);if(ch!=' '&&ch!='\t'&&ch!='\n'&&ch!='\r'&&ch!='\f') break;} end++;return str.substring(start,end);},AdjustAttachmentControlHeight:function(heightDifference){var attachmentFormControl=this;if(heightDifference==undefined){var attachmentControlFillerInnerDiv=attachmentFormControl.parent();heightDifference=attachmentFormControl.outerHeight()-attachmentControlFillerInnerDiv.outerHeight();} NWF.FormFiller.Functions.BubbleControlHeightChange(attachmentFormControl,heightDifference);},};}();NWF.FormFiller.PrintToPDF=function(){var nintexPrintPdfPrefix="Nintex_PrintPdf";var nintexPrintPdfFormId='';var nintexPrintPdfIframeId='';var printToPDF=function(){NWF.Utilities.ShowProgressDiv("Converting to PDF...");NWF$(".ms-notif-box").css({"right":"auto"});var siteUrl=_spPageContextInfo.siteAbsoluteUrl;var formUrl=window.location.href.split('Source=')[0];formUrl=formUrl.substring(0,formUrl.length-1);var formHtml=NWF$(NWF$('#formFillerDiv')[0]).clone();fillInputs(formHtml);var images=getNoneBase64Images();var cssContent=extractCSS();var formOuterHTML=formHtml[0].outerHTML;if(document.documentMode<=9){formOuterHTML=formOuterHTML.replace(/selected=""/g,"");} nintexPrintPdfFormId=nintexPrintPdfPrefix+'_Form_'+generateGUID();var formData={FormHtml:formOuterHTML,FormLayoutWidth:NWF.FormFiller.PrintToPDF.FormLayoutWidth,FormLayoutHeight:NWF.FormFiller.PrintToPDF.FormLayoutHeight,FormUrl:formUrl,FormInlineCss:cssContent.CssInline,FormCssUrls:cssContent.CssUrls,FormImages:images,SiteUrl:siteUrl,FormId:nintexPrintPdfFormId};var formSetting={PageOrientation:NWF.FormFiller.PrintToPDF.PageOrientation,PageSize:NWF.FormFiller.PrintToPDF.PageSize};callPrintService(formData,formSetting);setTimeout(function(){closeProgressIndicator(nintexPrintPdfFormId);},1000);};var callPrintService=function(formData,formSetting){if(nintexPrintPdfIframeId==''){nintexPrintPdfIframeId=nintexPrintPdfPrefix+'_Iframe_'+generateGUID();} var iframe=document.getElementById(nintexPrintPdfIframeId);if(iframe===null){iframe=document.createElement('iframe');iframe.id=nintexPrintPdfIframeId;iframe.name=nintexPrintPdfIframeId;iframe.style.display='none';document.body.appendChild(iframe);} var form=document.createElement("form");form.setAttribute("method","post");form.setAttribute("target",nintexPrintPdfIframeId);form.setAttribute("action",SP.Utilities.Utility.getLayoutsPageUrl('nintexforms/PrintPdf.aspx'));var hfFormData=document.createElement("input");hfFormData.setAttribute("type","hidden");hfFormData.setAttribute("name","formData");hfFormData.setAttribute("value",JSON.stringify(formData));form.appendChild(hfFormData);var hfFormData=document.createElement("input");hfFormData.setAttribute("type","hidden");hfFormData.setAttribute("name","formSetting");hfFormData.setAttribute("value",JSON.stringify(formSetting));form.appendChild(hfFormData);document.body.appendChild(form);form.submit();};var closeProgressIndicator=function(formId){var iframe=document.getElementById(nintexPrintPdfIframeId);if(iframe!=null){if(document.documentMode>=-1){var iframeDoc=iframe.contentDocument||iframe.contentWindow.document;if(iframeDoc.readyState=='complete'||iframeDoc.readyState=='interactive'){NWF.Utilities.HideProgressDiv();} else{setTimeout(function(){closeProgressIndicator(formId);},1000);}} else{var cookieEnabled=(navigator.cookieEnabled)?true:false if(typeof navigator.cookieEnabled=="undefined"&&!cookieEnabled){var cookieName=nintexPrintPdfPrefix+"_Test_Cookie";var now=new Date();var time=now.getTime();var expireTime=time+60000;now.setTime(expireTime);document.cookie='cookie='+cookieName+';expires='+now.toGMTString()+';path=/';cookieEnabled=(document.cookie.indexOf(cookieName)!=-1)?true:false} if(cookieEnabled){if(document.cookie.indexOf(formId)>=0){NWF.Utilities.HideProgressDiv();} else{setTimeout(function(){closeProgressIndicator(formId);},1000);}} else{setTimeout(function(){NWF.Utilities.HideProgressDiv();},3500);}}}} var generateGUID=function(){var d=new Date().getTime();var uuid='xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx'.replace(/[xy]/g,function(c){var r=(d+Math.random()*16)%16|0;d=Math.floor(d/16);return(c=='x'?r:(r&0x3|0x8)).toString(16);});return uuid;};var extractCSS=function(){var cssUrls=[];var cssInlines=[];var currentDocumentStyleElements=document.getElementsByTagName('style');var currentDocumentStyleElementsCount=currentDocumentStyleElements.length;for(var i=0;i0){var inputElement=clonedFormFiller.find("#"+this.id);if(this.type=="text"){inputElement.attr("value",this.value);} else if(this.type=="checkbox"){if(this.checked){inputElement.attr("checked","checked");} else{inputElement.removeAttr("checked");}} else if(this.type=="radio"){if(this.checked){inputElement.attr("checked",true);} else{inputElement.removeAttr("checked");}}}});NWF$("#formFillerDiv select").each(function(i,select){if(this.id.length>0){var selectId=this.id;var isMultiple=(typeof this.multiple!==typeof undefined&&this.multiple==true);var isDisabled=(typeof this.disabled!==typeof undefined&&this.disabled==true);var isSelected=false;NWF$("option",this).each(function(i,option){var optionElement=NWF$("#"+selectId+" option[value='"+NWF$(option).val()+"']",formFillerHtml);if(option.selected){if(isMultiple&&isDisabled){isSelected=false;} else{isSelected=true;}} else{isSelected=false;} if(isSelected){optionElement.attr("selected","selected");optionElement.prop("selected","selected");}else{this.selectedIndex=-1;if(document.documentMode<=9){optionElement.prop("selected",null);} else{optionElement.attr("selected","selected");optionElement.removeAttr("selected");}}});}});NWF$("#formFillerDiv textarea").each(function(){if(NWF$(this).attr("formcontrolid")&&NWF$(this).attr("formcontrolid").length>0){clonedFormFiller.find("textarea[formcontrolid='"+NWF$(this).attr("formcontrolid")+"']").val(NWF$(this).val());clonedFormFiller.find("textarea[formcontrolid='"+NWF$(this).attr("formcontrolid")+"']").text(NWF$(this).val());}});};return{PrintToPDF:printToPDF};}();NWF.FormFiller.Functions=function(){return{LoadControlInitScripts:function(){for(var i in nfFillerLoadFunctions){nfFillerLoadFunctions[i]();}},AjaxPost:function(service,requestData,cbSuccess){var NFApplicationWebUrl=NFApplicationWebUrl||"";var webserviceUrl=NFApplicationWebUrl+service;if(!SP.ScriptUtility.isUndefined(window._spPageContextInfo)&&!SP.ScriptUtility.isUndefined(window._spFormDigestRefreshInterval)&&!SP.ScriptUtility.isUndefined(window.UpdateFormDigest)){var context=window._spPageContextInfo;var webServerUrl=context.webServerRelativeUrl;var refreshInterval=window._spFormDigestRefreshInterval;window.UpdateFormDigest(webServerUrl,refreshInterval);} NWF$.ajax({type:"POST",url:webserviceUrl,data:requestData,headers:{"X-RequestDigest":NWF$("#__REQUESTDIGEST").val()},contentType:"application/json; charset=utf-8",dataType:"json",success:cbSuccess,error:function(XMLHttpRequest,textStatus,errorThrown){NWF.Utilities.HideProgressDiv();}});},BubbleControlHeightChange:function(formControl,heightDifference){var fillerDiv=NWF$(formControl.parent().parent().parent());var fillerDivHeight=NWF$(fillerDiv).outerHeight();if(fillerDiv.data("FillerDivInitHeight")==undefined){fillerDiv.data("FillerDivInitHeight",fillerDiv.outerHeight());} if(fillerDivHeight+heightDifferencefillerDivHeight){fillerDiv.height(newFillerDivHeight,true);returnValue=newFillerDivHeight;} var borderDivHeight=borderDiv.outerHeight();if(newborderDivHeight>borderDivHeight){borderDiv.height(newborderDivHeight,true);} var fillerInnerDivHeight=fillerInnerDiv.outerHeight();if(newFillerInnerDivHeight>fillerInnerDivHeight){fillerInnerDiv.height(newFillerInnerDivHeight,true);} return returnValue;},AdjustO365DyanmicControlsHeights:function(fillerDiv,fillerInnerDiv,borderDiv,formControl){},HighlightO365RTEControl:function(control,errorMessage){},ClearO365RTEControl:function(control){},ConfirmationCancelled:function(){},AdjustControlWidths:function(fillerDiv,fillerInnerDiv,borderDiv,formControl,fillerDivWidth){var returnValue=fillerDivWidth;var formControlWidthOriginal=formControl.outerWidth();var fillerInnerDivCss=NWF.Utilities.GetAllStyles(fillerInnerDiv[0]);var fillerDivCss=NWF.Utilities.GetAllStyles(fillerDiv[0]);var formControlCss=NWF.Utilities.GetAllStyles(formControl[0]);var borderDivCss=NWF.Utilities.GetAllStyles(borderDiv[0]);var fillerInnerDivBorderLeftWidth=NWF.Utilities.GetStyle(fillerInnerDivCss,"borderLeftWidth",fillerInnerDiv,"border-left-width");var fillerInnerDivBorderRightWidth=NWF.Utilities.GetStyle(fillerInnerDivCss,"borderRightWidth",fillerInnerDiv,"border-right-width");var fillerInnerDivLeft=NWF.Utilities.GetStyle(fillerInnerDivCss,"left",fillerInnerDiv,"left");var fillerInnerDivRight=NWF.Utilities.GetStyle(fillerInnerDivCss,"right",fillerInnerDiv,"right");var fillerInnerDivPaddingLeft=NWF.Utilities.GetStyle(fillerInnerDivCss,"paddingLeft",fillerInnerDiv,"padding-left");var fillerInnerDivPaddingRight=NWF.Utilities.GetStyle(fillerInnerDivCss,"paddingRight",fillerInnerDiv,"padding-right");var fillerDivBorderLeftWidth=NWF.Utilities.GetStyle(fillerDivCss,"borderLeftWidth",fillerDiv,"border-left-width");var fillerDivBorderRightWidth=NWF.Utilities.GetStyle(fillerDivCss,"borderRightWidth",fillerDiv,"border-right-width");var fillerDivMarginLeft=NWF.Utilities.GetStyle(fillerDivCss,"marginLeft",fillerDiv,"margin-left");var fillerDivMarginRight=NWF.Utilities.GetStyle(fillerDivCss,"marginRight",fillerDiv,"margin-right");var formControlMaginLeft=NWF.Utilities.GetStyle(formControlCss,"marginLeft",formControl,"margin-left");var formControlMaginRight=NWF.Utilities.GetStyle(formControlCss,"marginRight",formControl,"margin-right");var borderDivBorderLeftWidth=NWF.Utilities.GetStyle(borderDivCss,"borderLeftWidth",borderDiv,"border-left-width");var borderDivBorderRightWidth=NWF.Utilities.GetStyle(borderDivCss,"borderRightWidth",borderDiv,"border-right-width");var fillerInnerDivExtraWidth=fillerInnerDivBorderLeftWidth+fillerInnerDivBorderRightWidth+fillerInnerDivPaddingLeft+fillerInnerDivPaddingRight+fillerDivMarginLeft+fillerDivMarginRight+formControlMaginLeft+formControlMaginRight;var borderDivExtraWidth=borderDivBorderLeftWidth+borderDivBorderRightWidth+fillerInnerDivExtraWidth;var fillerDivExtraWidth=borderDivExtraWidth+fillerDivBorderLeftWidth+fillerDivBorderRightWidth+fillerInnerDivLeft+fillerInnerDivRight;var newFillerDivWidth=formControlWidthOriginal+fillerDivExtraWidth;var newborderDivWidth=formControlWidthOriginal+borderDivExtraWidth;var newFillerInnerDivWidth=formControlWidthOriginal+fillerInnerDivExtraWidth;if(newFillerDivWidth>fillerDivWidth){fillerDiv.width(newFillerDivWidth,true);returnValue=newFillerDivWidth;} var borderDivWidth=borderDiv.outerWidth();if(newborderDivWidth>borderDivWidth){borderDiv.width(newborderDivWidth,true);} var fillerInnerDivWidth=fillerInnerDiv.outerWidth();if(newFillerInnerDivWidth>fillerInnerDivWidth){fillerInnerDiv.width(newFillerInnerDivWidth,true);} return returnValue;},RepositionAndResizeOtherControlsAndFillerContainerHeight:function(currentControl,heightIncrease,heightDifferenceWithBorders,formFillerDivCurrent){var currentControlCss=NWF.Utilities.GetAllStyles(currentControl[0]);var currentControlTop=NWF.Utilities.GetStyle(currentControlCss,"top",currentControl,"top");if(heightIncrease!=0||heightDifferenceWithBorders!=0){var outermostContainerResized=NWF.Utilities.RepositionAndResizeOtherControls(currentControl,currentControlTop,heightIncrease,heightDifferenceWithBorders);if(outermostContainerResized){NWF.Utilities.ResizeFillerContainerHeight(heightDifferenceWithBorders,formFillerDivCurrent);}}},RepositionAndResizeOtherControlsAndContainerWidth:function(currentControl,widthIncrease,widthDifferenceWithBorders,formFillerDivCurrent){if(widthIncrease!=0||widthDifferenceWithBorders!=0){NWF.Utilities.ResizeFillerContainerWidth(widthDifferenceWithBorders,formFillerDivCurrent);}},GetRowControlIds:function(control,thisRepeaterControl,controlIds){var controlId=control.attr('id');var controlName=control.prop('name');if(NWF.FormFiller.Functions.ControlIdIsValidForRename(controlId,controlName,false)){controlIds.push(controlId);} NWF$(control.children()).each(function(){return NWF.FormFiller.Functions.GetRowControlIds(NWF$(this),thisRepeaterControl,controlIds);});return controlIds;},DisableEnableAddRowLink:function(thisRepeaterControl,noOfRows,maxRows){var addROwDiv=NWF$(".nf-repeater-addrow",thisRepeaterControl);if(noOfRows>=maxRows){if(!addROwDiv.hasClass("nf-disabled")){addROwDiv.addClass("nf-disabled");}}else{if(addROwDiv.hasClass("nf-disabled")){addROwDiv.removeClass("nf-disabled");}}},DisableValidationForRow:function(thisRepeaterControl,rowControlIds,saveValidators){try{NWF$.each(Page_Validators,function(){var controlToValidate=NWF$('#'+this.controltovalidate);if(NWF.Utilities.GetIndexOf(rowControlIds,controlToValidate.attr('id'))!=-1){if(saveValidators){var disabledValidators=thisRepeaterControl.data('DisabledValidators');disabledValidators.push(this);thisRepeaterControl.data('DisabledValidators',disabledValidators);} ValidatorEnable(this,false);}});}catch(e){}},ProcessPageValidators:function(){try{NWF$.each(Page_Validators,function(){if(this.controltovalidate===undefined&&this.controltovalidateforrequiredval!=undefined){this.controltovalidate=this.controltovalidateforrequiredval;} if(this.controltovalidateoverride!=undefined){this.controltovalidate=this.controltovalidateoverride;} ControlsToValidate.push(this.controltovalidate);if(this.controltohighlightonerror!=undefined){ControlToHighlightOnError.push(this.controltohighlightonerror);} if(this.operator!=null&&this.operator=="DataTypeCheck"&&this.type=="Currency"){this.digits=14;}});}catch(e){}},DisableAllClientValidators:function(){try{NWF$.each(Page_Validators,function(){ValidatorEnable(this,false);});}catch(e){}},HasScrollbar:function(elem_id){elem=document.getElementById(elem_id);if(elem.clientHeight0){for(var i in controlCalculations){NWF.FormFiller.Functions.ProcessCalculationForControl(controlCalculations[i],control,isAsyncCall,asyncCallCount);}}}},ProcessRulesOnChange:function(control,isAsyncCall,asyncCallCount){if(NWF.FormFiller.Functions.PropagateEvent||isAsyncCall){var formControlId=control.attr("FormControlId");if(!formControlId){formControlId=control.parents(".nf-filler-control").attr("FormControlId");} var controlrules=NWF.FormFiller.Functions.GetAssociatedFunctions(Rules,"Control",formControlId,"Rules");if(controlrules.length>0){for(i in controlrules){if(!control){control=NWF$(NWF$(".nf-filler-container")[0]);} NWF.FormFiller.Functions.ProcessRuleForControl(controlrules[i],control);}}}},ProcessDataAccessTokensOnChange:function(control,isAsyncCall,asyncCallCount){if(NWF.FormFiller.Functions.PropagateEvent||isAsyncCall){var formControlId=control.attr("FormControlId");if(!formControlId){formControlId=control.parents(".nf-filler-control").attr("FormControlId");} var controlDataAccessTokens=NWF.FormFiller.Functions.GetAssociatedFunctions(DataAccessTokens,"Control",formControlId,"DataAccessTokens");if(controlDataAccessTokens.length>0){for(i in controlDataAccessTokens){if(!control){control=NWF$(NWF$(".nf-filler-container")[0]);} NWF.FormFiller.Functions.ProcessDataAccessTokensForControl(controlDataAccessTokens[i],control,isAsyncCall,asyncCallCount);}}}},ProcessOnChange:function(control,isAsyncCall,asyncCallCount){NWF.FormFiller.Functions.ProcessCalculationsOnChange(control,isAsyncCall,asyncCallCount);NWF.FormFiller.Functions.ProcessRulesOnChange(control,isAsyncCall,asyncCallCount);NWF.FormFiller.Functions.ProcessDataAccessTokensOnChange(control,isAsyncCall,asyncCallCount);},GetAssociatedFunctions:function(array,attrName,attrValue,cacheKey){var cache=NWF.FormFiller.Functions.AssociatedFunctionCache[cacheKey+attrName];if(!cache){cache={};for(index in array){var item=array[index];var itemKey=NWF$(item).attr(attrName);if(!cache[itemKey]){cache[itemKey]=[];} cache[itemKey].push(item);} NWF.FormFiller.Functions.AssociatedFunctionCache[cacheKey+attrName]=cache;} var result=[];if(cache[attrValue]){result=cache[attrValue];} return result;},GetTypedValue:function(rawValue,type){try{return NWF$.parseJSON(rawValue.toLowerCase());}catch(e){if(type&&type=="TimeOnly"){return rawValue;} return NWF.FormFiller.Functions.GetControlValue(rawValue);}},InvalidateControlCache:function(){NWF.FormFiller.Functions.FillerControlCache={};},GetFillerControls:function(sourceContext,controlId){var sourceContextId="nullContext";if(sourceContext){sourceContextId=sourceContext.nfSourceContextId;} if(!sourceContextId){if(sourceContext&&sourceContext.length>0){sourceContextId=sourceContext[0].id;} if(sourceContextId==""){sourceContextId="UniqueId_"+sourceContext[0].uniqueID;} sourceContext.nfSourceContextId=sourceContextId;} var context=NWF.FormFiller.Functions.FillerControlCache[sourceContextId];if(!context){context={FormControls:{}};var controls=NWF$(".nf-filler-control",sourceContext);for(var i=0;i0){sourceContextId=sourceContext[0].id;} if(sourceContextId==""){sourceContextId="UniqueId_"+sourceContext[0].uniqueID;} sourceContext.nfSourceContextId=sourceContextId;} var context=NWF.FormFiller.Functions.GetValueCache[sourceContextId];if(!context){context={};NWF.FormFiller.Functions.GetValueCache[sourceContextId]=context;} return context;},CacheLookupViewModel:function(repeaterFirstRow){var hiddenInputs=repeaterFirstRow.find('input.nf-lookup:text');hiddenInputs.each(function(){var hiddenInput=NWF$(this);var config=hiddenInput.data();var cacheKey=hiddenInput[0].id;var viewModel=ko.dataFor(hiddenInput[0]);if(viewModel&&NWF.FormFiller.Functions.LookupViewModelCache[cacheKey]==undefined){NWF.FormFiller.Functions.LookupViewModelCache[cacheKey]=viewModel;}});},GetParentContext:function(sourceContext){var parentRow=sourceContext.parent().closest(".nf-repeater-row");return parentRow.length>0?NWF$(parentRow[0]):NWF$(sourceContext.parents(".nf-filler-container")[0]);},GetValue:function(controlId,sourceContext,calculatedValueDataType){var contextCache=NWF.FormFiller.Functions.GetValueContextCache(sourceContext);var result=contextCache[controlId];if(result){return result;} var isDateValue=false;var isPeopleValue=false;var isRichText=false;var isMultiSelect=false;var controlMultiValues;var controlValues="";var controlValue="";var i;var valueControls;var fillerControl;var multiSelection;var checkedControlValue;var datetime;var hours;var hourspart;var minutes;var currentValueControl;var currentValueControlParents;fillerControl=NWF.FormFiller.Functions.GetFillerControls(sourceContext,controlId);if(NWF.FormFiller.Functions.UseServerValueForCalculations){var currentControlValue;var thisControlValue;var returnAsArray=false;if(fillerControl.length>1){returnAsArray=true;currentControlValue="";NWF$.each(fillerControl,function(){thisControlValue=NWF$(this).attr("data-currentcontrolvalue");if(thisControlValue!=undefined&&thisControlValue!==""){if(currentControlValue===""){currentControlValue=thisControlValue;}else{currentControlValue=currentControlValue+";#"+thisControlValue;}}});}else{currentControlValue=fillerControl.attr("data-currentcontrolvalue");if(fillerControl.attr("data-multiselectcontrol")==="True"){returnAsArray=true;}} if(currentControlValue!=undefined&&thisControlValue!=undefined){if(returnAsArray){return currentControlValue.split(";#");} else{return currentControlValue;}}} valueControls=fillerControl.find(".nf-associated-control");if(fillerControl.find('input.nf-ignore-getvalue').length>0){valueControls=fillerControl.find(".nf-associated-control").not('input.nf-ignore-getvalue');} if(valueControls.length==0){valueControls=fillerControl.find(".nf-hidden-associated-control");} if(valueControls.length==0){valueControls=fillerControl.find(".nf-calculation-control-value");} while(valueControls.length==0&&sourceContext.length!=0){sourceContext=NWF.FormFiller.Functions.GetParentContext(sourceContext);fillerControl=NWF.FormFiller.Functions.GetFillerControls(sourceContext,controlId);valueControls=fillerControl.find(".nf-associated-control");if(fillerControl.find('input.nf-ignore-getvalue').length>0){valueControls=fillerControl.find(".nf-associated-control").not('input.nf-ignore-getvalue');} if(valueControls.length==0){valueControls=fillerControl.find(".nf-hidden-associated-control");} if(valueControls.length==0){valueControls=fillerControl.find(".nf-calculation-control-value");}} if(valueControls!=null&&valueControls.length!=0){if(valueControls.length>1){controlValues=[];if(!fillerControl.hasClass("nf-associated-control-multiple")){for(i=0;i:input:checked",valueControl.closest(".nf-filler-control")).length>0){controlValue=NWF$(".nf-choice-control-textbox",valueControl.closest(".nf-filler-control")).val();controlValues.push(controlValue);}else{controlMultiValues=NWF$("option:selected",valueControl);if(controlMultiValues.length>0){for(j=0;j:input:checked",valueControl.closest(".nf-filler-control")).length>0){controlValue=NWF$(".nf-choice-control-textbox",valueControl.closest(".nf-filler-control")).val();}else{multiSelection=NWF$("option:selected",valueControl);if(multiSelection.length>0&&multiSelection.attr(valueControl.data().useAttributeAsValue)!=undefined){controlValue=multiSelection.attr(valueControl.data().useAttributeAsValue);}else{controlValue="";}} controlValues.push(controlValue);}else if(valueControls[i].type!="select-one"&&valueControl.data().useAttributeAsValue!=undefined){controlMultiValues=NWF$(":checked",valueControl);if(controlMultiValues.length>0){for(j=0;j0){var delimiter=valueControls.data().joinTextValueDelimiter;for(j=0;j0){controlValues[indexToAdd++]=subControlValues;}}}}else if(valueControls[0].type=="select-multiple"&&valueControls.data().useAttributeAsValue!=undefined){controlValues=[];if(valueControls.data().allowFillIn!=undefined&&NWF$(".nf-fillin-option>:input:checked",valueControls.closest(".nf-filler-control")).length>0){controlValue=NWF$(".nf-choice-control-textbox",valueControls.closest(".nf-filler-control")).val();controlValues.push(controlValue);}else{controlMultiValues=NWF$("option:selected",valueControls[0]);if(controlMultiValues.length>0){for(j=0;j0){var delimiter=valueControls.data().joinTextValueDelimiter;for(i=0;i:input:checked",valueControls.closest(".nf-filler-control")).length>0){controlValues=NWF$(".nf-choice-control-textbox",valueControls.closest(".nf-filler-control")).val();}else{multiSelection=NWF$("option:selected",valueControls);if(multiSelection.length>0&&multiSelection.attr(valueControls.data().useAttributeAsValue)!=undefined){controlValues=multiSelection.attr(valueControls.data().useAttributeAsValue);}else{controlValues="";}}}else if(valueControls[0].type!="select-one"&&valueControls.data().useAttributeAsValue!=undefined){controlMultiValues=NWF$(":checked",valueControls);var isSingleSelect=NWF$(":radio",valueControls).length>0;if(!isSingleSelect){controlValues=[];} if(controlMultiValues.length>0){for(j=0;j");element.append(controlValue);var plainText=element.text();if(plainText.length==1&&plainText.trim().length==0){plainText="";} plainTextArray=plainText.split(String.fromCharCode(8203));var newText="";for(index=0;index1?NWF.FormFiller.Functions.DecimalSymbol+x[1]:'';var rgx=/(\d+)(\d{3})/;while(rgx.test(x1)){x1=x1.replace(rgx,'$1'+NWF.FormFiller.Functions.ThousandSeparatorSymbol+'$2');} return x1+x2;},ConvertNumberToProcess:function(numberToFormat){if(isNaN(Number.parseLocale(numberToFormat))){return numberToFormat;} else{return Number.parseLocale(numberToFormat);}},ConvertNumberToDisplay:function(numberToDisplay,addThousandSeparator){if(NWF.FormFiller.Functions.DecimalSymbol!="."){numberToDisplay+='';x=numberToDisplay.split(".");x1=x[0];x2=x.length>1?NWF.FormFiller.Functions.DecimalSymbol+x[1]:'';numberToDisplay=x1+''+x2;} if(addThousandSeparator){numberToDisplay=NWF.FormFiller.Functions.AddThousandSeparator(numberToDisplay);} return numberToDisplay;},ProcessCalculationForControl:function(controlfunction,currentControl,isAsyncCall,asyncCallCount){var controlContext=NWF.FormFiller.Functions.GetParentContext(currentControl);NWF.FormFiller.Functions.ProcessCalculation(controlfunction,controlContext,isAsyncCall,asyncCallCount);},ProcessRuleForControl:function(controlRule,currentControl){var controlContext=NWF.FormFiller.Functions.GetParentContext(currentControl);NWF.FormFiller.Functions.ProcessRule(controlRule,controlContext);},ProcessDataAccessTokensForControl:function(controlRule,currentControl,isAsyncCall,asyncCallCount){var controlContext=NWF.FormFiller.Functions.GetParentContext(currentControl);NWF.FormFiller.Functions.ProcessDataAccessTokens(controlRule,controlContext,isAsyncCall,asyncCallCount);},HandleAsyncFormula:function(functionResult,resultControl,controlfunction,controlContext,asyncCallCount,formattedFunctionResult,asyncRowIndex){var deferred=NWF$.Deferred();formattedFunctionResult="Loading...";functionResult.deferred.done(function(asyncFormulaFunction){resultControl.find(".nf-calculation-control").html("");NWF.FormFiller.Functions.ProcessCalculation({Name:asyncFormulaFunction,Result:controlfunction.Result},controlContext,true,asyncCallCount==undefined?1:asyncCallCount+1,asyncRowIndex);deferred.resolve();}).fail(function(asyncFormulaError){NWF.FormFiller.Functions.ProcessCalculation({Name:function errInAsyncFormula(){return asyncFormulaError;},Result:controlfunction.Result},controlContext,true,asyncCallCount==undefined?1:asyncCallCount+1,asyncRowIndex);deferred.reject();});resultControl.find(".nf-calculation-control").html(formattedFunctionResult.toString());functionResult.run();return deferred.promise();},DisplayRuntimeFunctionErrorsAfterDelay:function(){var invaidFormulaException="";var invaidFormulaExceptionCount=NWF.FormFiller.Functions.InvalidFormulaExceptions.length;if(invaidFormulaExceptionCount>0){for(var invaidFormulaExceptionCtr=0;invaidFormulaExceptionCtr1&&resultControl.parents(".nf-repeater-row").length>1){var rcLength=resultControl.length;for(var rc=1;rcmaxOccurrences){isCircularReference=true;} if(asyncCallCount>maxAsyncDepth){isCircularReference=true;}}catch(err){isCircularReference=true;} return isCircularReference;},GetIdsFromIdValPairs:function(idValPairs){var separator=";#";if(idValPairs.toString().indexOf(separator)!=-1){var result=NWF$.map(idValPairs.split(','),function(item){return item.split(separator)[0];});return result.toString();} return idValPairs;},GetRuntimeTokenValue:function(controlId,sourceContext,useIdValPair){var tokenValue=NWF.FormFiller.Functions.GetValue(controlId,sourceContext,"string2");if(!useIdValPair){if(NWF$.isArray(tokenValue)){tokenValue=tokenValue.toString();} return NWF.FormFiller.Functions.GetIdsFromIdValPairs(tokenValue);} else{if(NWF$.isArray(tokenValue)){return tokenValue.join(";#");} return tokenValue;}},ProcessDataAccessTokens:function(controlfunction,originalControlContext,isAsyncCall,asyncCallCount){try{var controlContext=originalControlContext;var resultControl=NWF.FormFiller.Functions.GetFillerControls(controlContext,controlfunction.Result);if(resultControl.length==0){if(NWF.FormFiller.Functions.ProcessOnlyCurrentLevel){return;} while(resultControl.length==0&&controlContext.length!=0){controlContext=NWF.FormFiller.Functions.GetParentContext(controlContext);resultControl=NWF.FormFiller.Functions.GetFillerControls(controlContext,controlfunction.Result);}} var controlContexts=[];if(resultControl.length>1&&resultControl.parents(".nf-repeater-row").length>1){var rcLength=resultControl.length;for(var rc=1;rc0){resultControl.addClass("nfExcludethis");}} for(i=0;i=0;k--){subControls[k].disabled=true;if(subControls[k].contentEditable=="true"){subControls[k].contentEditable="false";}} var frames=NWF$(contextControl.find("iframe"));for(k=0;k=0;m--){frameContents[m].disabled=true;if(frameContents[m].contentEditable=="true"){frameContents[m].contentEditable="false";}}} contextControl.find("*:not(div)").attr("disabled","disabled");var dateControls=contextControl.find('.nf-date-picker');var dateControlsCount=dateControls.length;for(k=dateControlsCount-1;k>=0;k--){NWF$(dateControls[k]).datepicker('disable');} var peopleControls=contextControl.find('.nf-peoplepicker');var peopleControlsCount=peopleControls.length;for(k=peopleControlsCount-1;k>=0;k--){var $ctrl=NWF$(peopleControls[k]);if($ctrl.data("uiItempicker")){$ctrl.itempicker('disable');}} if(typeof(RefreshCommandUI)!='undefined'){RefreshCommandUI();}},RemoveDisableAttribute:function(contextControl){if(typeof contextControl.data('enabled')!="undefined"&&contextControl.data('enabled')=="False"){return;} var subControls=contextControl.find("*").not("iframe").not("input");for(k=0;k=0;k--){NWF$(dateControls[k]).datepicker('enable');} var peopleControls=contextControl.find('.nf-peoplepicker');var peopleControlsCount=peopleControls.length;for(k=peopleControlsCount-1;k>=0;k--){var $ctrl=NWF$(peopleControls[k]);if($ctrl.data("uiItempicker")){$ctrl.itempicker('enable');}} if(typeof(RefreshCommandUI)!='undefined'){RefreshCommandUI();}},ProcessDeferredCalculations:function(){NWF$.each(NWF.FormFiller.Functions.DeferredCalculations,function(){NWF.FormFiller.Functions.ProcessCalculation(this.controlfunction,this.controlContext,this.isAsyncCall,this.asyncCallCount,this.asyncRowCompleted);});NWF.FormFiller.Functions.DeferredCalculations={};},AttachAddNewRowEventForRepeaters:function(formFillerDivCurrent){formFillerDivCurrent.on('click','.nf-repeater-addrow-link',function(event){var addrowImage=NWF$(this);var thisRepeaterControl=NWF$(NWF$(addrowImage.closest('.nf-repeater'))[0]);NWF.FormFiller.Functions.BulkCalculationExecution=true;NWF.FormFiller.Functions.UseServerValueForCalculations=true;NWF.FormFiller.Functions.AddNewRepeaterRow(thisRepeaterControl,formFillerDivCurrent);NWF.FormFiller.Functions.BulkCalculationExecution=false;NWF.FormFiller.Functions.UseServerValueForCalculations=false;NWF.FormFiller.Functions.ProcessDeferredCalculations();});},GetFormFillerDiv:function(control){if(control!=undefined&&formfillerDivsCount>1){return control.parents("#formFillerDiv");} else if(formfillerDivsCount>1){return NWF$(formfillerDivs[processingFormFillerIndex]);} return formfillerDiv;},GetFillerDOMs:function(){formfillerDiv=NWF$('#formFillerDiv');container=formfillerDiv.find(".nf-filler-container");outerDiv=container.children(".nf-outer");formfillerDivs=NWF$('.formFillerDiv');focusOnLoadControl=NWF$("#FocusOnLoadControl");focusOnLoadControls=NWF$('.FocusOnLoadControl');},AddNewRepeaterRow:function(thisRepeaterControl,formFillerDivCurrent){var newRepeaterRow;var heightIncrease;NWF.FormFiller.Events.ExecuteRepeaterRowAdding(thisRepeaterControl);var repeaterRows=NWF$(thisRepeaterControl.children('.nf-repeater-row'));if(repeaterRows.length-10){newRepeaterRow.attr("class",repeaterFirstRow.data('itemClass'));} var beforeHeight=thisRepeaterControl.outerHeight();thisRepeaterControl.children(".nf-repeater-addeddrow-suffixes").before(newRepeaterRow);NWF.FormFiller.Functions.InvalidateControlCache();NWF.FormFiller.Functions.ProcessStaticFomulaeAndRules(newRepeaterRow);NWF$('.nf-repeater-row',newRepeaterRow).each(function(){var control=NWF$(this);if(control.closest('.nf-repeater-row-hidden').length==0){NWF.FormFiller.Functions.ProcessStaticFomulaeAndRules(control);}});if(thisRepeaterControl.outerHeight()==beforeHeight){thisRepeaterControl.outerHeight(beforeHeight+newRepeaterRow.outerHeight());} NWF$('.nf-repeater',newRepeaterRow).each(function(){var childRepeaterControl=NWF$(this);childRepeaterControl.data('CurrentRowControlIdPrefix',addedrowPrefix+childRepeaterControl.data('CurrentRowControlIdPrefix'));childRepeaterControl.data('AddedRowPrefixes',new Array());});newRepeaterRow.removeClass('nf-repeater-row-hidden');NWF.FormFiller.Functions.LoadControlInitScripts();NWF$('[data-formcontroltypeid]',newRepeaterRow).each(function(){var fn=nfClientInitializeFunctions[NWF$(this).data('formcontroltypeid')];if(fn&&NWF$.isFunction(fn)&&NWF$(this).closest('.nf-repeater-row-hidden').length==0){fn.call(this);}});var heightIncrease=newRepeaterRow.outerHeight();NWF$(".nf-filler-control",newRepeaterRow).find('input').each(function(){var control=NWF$(this);var isNotHiddenRow=control.closest('.nf-repeater-row-hidden').length==0;if(this.type=="text"&&isNotHiddenRow){control.val(control.data('defaultValue'));};if(isNotHiddenRow&&!control.hasClass("nf-ignore-for-calc")&&!control.hasClass("nf-settingsVal")){NWF.FormFiller.Functions.ProcessOnChange(control);if(control.parent().hasClass("nf-dataaccess")){var controlDataAccessTokens=NWF.FormFiller.Functions.GetAssociatedFunctions(DataAccessTokens,"Result",control.attr("FormControlId"),"DataAccessTokens");if(controlDataAccessTokens.length>0){for(var j in controlDataAccessTokens){NWF.FormFiller.Functions.ProcessDataAccessTokensForControl(controlDataAccessTokens[j],control);}} else{var formControl=NWF$(control.parent()[0]);var fillerInnerDiv=NWF$(formControl.parent()[0]);var heightDiff=formControl.outerHeight()-fillerInnerDiv.outerHeight();NWF.FormFiller.Functions.BubbleControlHeightChange(formControl,heightDiff);}}else if(control.hasClass("nf-calculation-control-value")){var controlCalculations=NWF.FormFiller.Functions.GetAssociatedFunctions(CalculationFunctions,"Result",control.attr("FormControlId"),"CalculationFunctions");if(controlCalculations.length>0){for(var i in controlCalculations){NWF.FormFiller.Functions.ProcessCalculationForControl(controlCalculations[i],control);}}}}});var hiddenLookupInputs=NWF$('input.nf-lookup:text',newRepeaterRow);hiddenLookupInputs.each(function(){NWF.FormFiller.Functions.ProcessLookupInRepeater(NWF$(this),repeaterFirstRow,currentRowControlIdPrefix,addedrowPrefix,newRepeaterRow);});var disabledValidators=thisRepeaterControl.data('DisabledValidators');var i=0;NWF$.each(disabledValidators,function(){var controlToValidate=NWF$('#'+this.controltovalidate);controlToValidate.attr('title',"");controlToValidate.attr('oldtitle',"");var hiddenControlIds=thisRepeaterControl.data('HiddenControlIds');if(NWF.Utilities.GetIndexOf(hiddenControlIds,controlToValidate.attr('id'))!=-1){var hiddenControlId=controlToValidate.attr('id');var newControlId=currentRowControlIdPrefix+hiddenControlId;var newValidator=NWF$(this).clone(true,true);NWF$(newValidator)[0].controltovalidate=newControlId;NWF$(newValidator)[0].validationGroup=this.validationGroup;NWF$(newValidator)[0].evaluationfunction=this.evaluationfunction;NWF$(newValidator)[0].initialvalue=this.initialvalue;NWF$(newValidator)[0].errormessage=this.errormessage;NWF$(newValidator)[0].operator=this.operator;NWF$(newValidator)[0].type=this.type;NWF$(newValidator)[0].decimalchar=this.decimalchar;NWF$(newValidator)[0].digits=this.digits;NWF$(newValidator)[0].groupsize=this.groupsize;NWF$(newValidator)[0].groupchar=this.groupchar;if(this.controltovalidateforrequiredval!=undefined){NWF$(newValidator)[0].controltovalidateforrequiredval=newControlId;} if(this.functionName!=undefined){NWF$(newValidator)[0].functionName=this.functionName;} if(this.ruleId!=undefined){NWF$(newValidator)[0].ruleId=this.ruleId;} if(this.insiderepeater!=undefined){NWF$(newValidator)[0].insiderepeater=this.insiderepeater;} NWF$(newValidator)[0].dateorder=this.dateorder;if(this.validationexpression!=undefined){NWF$(newValidator)[0].validationexpression=this.validationexpression;} if(this.controltohighlightonerror!=undefined){if(this.controltohighlightonerror==''){NWF$(newValidator)[0].controltohighlightonerror='';}else{var controltohighlightonerror=NWF$('#'+this.controltohighlightonerror);NWF$(newValidator)[0].controltohighlightonerror=currentRowControlIdPrefix+controltohighlightonerror.attr('id');}} if(this.valuetocompare!=undefined){NWF$(newValidator)[0].valuetocompare=this.valuetocompare;} if(this.controlhookup!=undefined){var controlhookup=NWF$('#'+this.controlhookup);NWF$(newValidator)[0].controlhookup=currentRowControlIdPrefix+controlhookup.attr('id');} if(this.clientvalidationfunction!=undefined){NWF$(newValidator)[0].clientvalidationfunction=this.clientvalidationfunction;} if(this.validateemptytext!=undefined){NWF$(newValidator)[0].validateemptytext=this.validateemptytext;} if(this.minimumNumberOfSelectedCheckBoxes!=undefined){NWF$(newValidator)[0].minimumNumberOfSelectedCheckBoxes=this.minimumNumberOfSelectedCheckBoxes;} if(this.mustBeChecked!=undefined){NWF$(newValidator)[0].mustBeChecked=this.mustBeChecked;} NWF$(newValidator).attr({"id":newControlId+"val"+i});NWF$(newValidator).prop({"name":newControlId+"val"+i++});Page_Validators.push(newValidator[0]);NWF$(newRepeaterRow[0]).append(newValidator);ValidatorEnable(newValidator[0],true);}});NWF$('.nf-repeater',newRepeaterRow).each(function(){var childRepeaterControl=NWF$(this);var childRepeaterRows=NWF$(childRepeaterControl.children('.nf-repeater-row'));if(childRepeaterRows.length>1){var childRepeaterFirstRow=NWF$(childRepeaterRows[0]);childRepeaterControl.data('CurrentRowControlIds',NWF.FormFiller.Functions.GetRowControlIds(childRepeaterFirstRow,childRepeaterControl,new Array()));NWF.FormFiller.Functions.DisableValidationForRow(childRepeaterControl,childRepeaterControl.data('CurrentRowControlIds'),false);}});var currentControl=thisRepeaterControl.parent().parent().parent();NWF.FormFiller.Functions.RepositionAndResizeOtherControlsAndFillerContainerHeight(currentControl,heightIncrease,heightIncrease,formFillerDivCurrent);thisRepeaterControl.data('AddedRowsCounter',NWF.FormFiller.Functions.AddedRowsCounter);thisRepeaterControl.data('AddedRowPrefixes',addedRowPrefixes);NWF.FormFiller.Functions.DisableEnableAddRowLink(thisRepeaterControl,repeaterRows.length,parseInt(thisRepeaterControl.data('MaxRows')));} formFillerDivCurrent.find('.nf-repeater').each(function(){var thisRepeaterControl=NWF$(this);var repeaterOuterControl=thisRepeaterControl.parent().parent().parent();var repeaterInnerControl=thisRepeaterControl.parent();var thisRepeaterControlHeight=parseInt(thisRepeaterControl.outerHeight());repeaterInnerControl.outerHeight(thisRepeaterControlHeight);if(repeaterOuterControl[0].className.indexOf('nf-error-highlight')!=-1){repeaterOuterControl.outerHeight(thisRepeaterControlHeight+4);}else{repeaterOuterControl.outerHeight(thisRepeaterControlHeight);}});if(ResizeWorkspace){NWF$("#s4-workspace").outerHeight(NWF$("#s4-mainarea").outerHeight());} NWF.FormFiller.Events.ExecuteRepeaterRowAdded(newRepeaterRow);},AttachDeleteRowEventForRepeaters:function(formFillerDivCurrent){formFillerDivCurrent.on('click','.nf-repeater-deleterow-image',function(event){var currentObject=NWF$(this);var thisRepeaterControl=NWF$(NWF$(currentObject.closest('.nf-repeater'))[0]);var repeaterRows=NWF$(thisRepeaterControl.children('.nf-repeater-row'));if(repeaterRows.length-1>parseInt(thisRepeaterControl.data('MinRows'))){NWF.FormFiller.Functions.BulkCalculationExecution=true;var currentControl=thisRepeaterControl.parent().parent().parent();var currentRow=NWF$(NWF$(currentObject.closest('.nf-repeater-row'))[0]);NWF.FormFiller.Events.ExecuteRepeaterRowDeleting(currentRow);var addedRowPrefixes=null;addedRowPrefixes=thisRepeaterControl.data('AddedRowPrefixes');var repeaterRowIdControl=NWF$(currentRow.children("."+RepeaterServerRowIndexClass));var rowToIdDelete=repeaterRowIdControl.attr('value');thisRepeaterControl.data('CurrentRowControlIds',NWF.FormFiller.Functions.GetRowControlIds(currentRow,thisRepeaterControl,new Array()));NWF.FormFiller.Functions.DisableValidationForRow(thisRepeaterControl,thisRepeaterControl.data('CurrentRowControlIds'),false);var deletedRowIndexInArray=NWF.Utilities.GetIndexOf(addedRowPrefixes,rowToIdDelete);if(deletedRowIndexInArray!=-1){addedRowPrefixes.splice(deletedRowIndexInArray,1);NWF$(thisRepeaterControl.children("."+RepeaterAddedRowPrefixesClass)).attr('value',addedRowPrefixes.join(","));} NWF$(currentRow.children("."+RepeaterServerRowIndexClass)).attr('value','');var beforeHeight=thisRepeaterControl.outerHeight();var heightIncrease=-currentRow.outerHeight();currentRow.css({"display":"none"});currentRow.remove();NWF.FormFiller.Functions.InvalidateControlCache();var repeaterRowsNew=NWF$(thisRepeaterControl.children('.nf-repeater-row'));for(var k=1;k0){currentRow.attr("class",repeaterFirstRow.data('itemClass'));} else{currentRow.attr("class",repeaterFirstRow.attr("class"));}}} thisRepeaterControl.data('AddedRowPrefixes',addedRowPrefixes);NWF.FormFiller.Functions.DisableEnableAddRowLink(thisRepeaterControl,repeaterRows.length-2,parseInt(thisRepeaterControl.data('MaxRows')));NWF.FormFiller.Functions.BulkCalculationExecution=false;NWF.FormFiller.Functions.ProcessDeferredCalculations();} formFillerDivCurrent.find('.nf-repeater').each(function(){var thisRepeaterControl=NWF$(this);var repeaterOuterControl=thisRepeaterControl.parent().parent().parent();var repeaterInnerControl=thisRepeaterControl.parent();var thisRepeaterControlHeight=thisRepeaterControl.outerHeight();repeaterInnerControl.outerHeight(thisRepeaterControlHeight);if(repeaterOuterControl[0].className.indexOf('nf-error-highlight')!=-1){repeaterOuterControl.outerHeight(thisRepeaterControlHeight+4);}else{repeaterOuterControl.outerHeight(thisRepeaterControlHeight);}});if(ResizeWorkspace){NWF$("#s4-workspace").outerHeight(NWF$("#s4-mainarea").outerHeight());} NWF.FormFiller.Events.ExecuteRepeaterRowDeleted(thisRepeaterControl);});},ProcessFillerControls:function(){try{NWF.Utilities.ShowProgressDiv("Please wait...");} catch(err){} var formFillerDivCurrent=NWF.FormFiller.Functions.GetFormFillerDiv();NWF.FormFiller.Functions.AddedRowsCounter=0;formFillerDivCurrent.find('.nf-repeater').each(function(){var thisRepeaterControl=NWF$(this);NWF.FormFiller.Functions.AddedRowsCounter=0;thisRepeaterControl.data('MaxRows',thisRepeaterControl.attr("maxRows")==""?1000:thisRepeaterControl.attr("maxRows"));thisRepeaterControl.data('MinRows',thisRepeaterControl.attr("maxRows")==""?0:thisRepeaterControl.attr("minRows"));thisRepeaterControl.data('AddedRowPrefixes',new Array());thisRepeaterControl.data('HiddenControlIds',new Array());thisRepeaterControl.data('DisabledValidators',new Array());thisRepeaterControl.data('CurrentRowControlIdPrefix',"");var repeaterReadOnlyMode=false;if(NWF$("."+RepeaterServerRowIndexClass,this).length==0){repeaterReadOnlyMode=true;} var repeaterRows=NWF$(thisRepeaterControl.children('.nf-repeater-row'));if(repeaterRows.length>1){var repeaterFirstRow=NWF$(repeaterRows[0]);NWF.FormFiller.Functions.CacheLookupViewModel(repeaterFirstRow);thisRepeaterControl.data('HiddenControlIds',NWF.FormFiller.Functions.GetRowControlIds(repeaterFirstRow,thisRepeaterControl,thisRepeaterControl.data('HiddenControlIds')));NWF.FormFiller.Functions.DisableValidationForRow(thisRepeaterControl,thisRepeaterControl.data('HiddenControlIds'),true);NWF$(".nf-filler-control",repeaterFirstRow).find('input').each(function(){if(this.type=="text"){var control=NWF$(this);if(control.data('defaultValue')==undefined){control.data('defaultValue',control.val());control.val("");}};});for(var rowCnt=0;rowCnt0){for(var i in controlRules){NWF.FormFiller.Functions.ProcessRule(controlRules[i],executionContext);}} var controlCalculations=NWF.FormFiller.Functions.GetAssociatedFunctions(CalculationFunctions,"Control","","CalculationFunctions");if(controlCalculations.length>0){NWF.FormFiller.Functions.ProcessOnlyCurrentLevel=true;for(var i in controlCalculations){NWF.FormFiller.Functions.ProcessCalculation(controlCalculations[i],executionContext);} NWF.FormFiller.Functions.ProcessOnlyCurrentLevel=false;}},AttachOnChangeEvents:function(formFillerDivCurrent){formFillerDivCurrent.on('blur','input:text',function(event){NWF.FormFiller.Functions.ResetCircularReferenceRelatedVariables();NWF.FormFiller.Functions.ProcessOnChange(NWF$(this));});formFillerDivCurrent.on('change','input:radio',function(event){NWF.FormFiller.Functions.ResetCircularReferenceRelatedVariables();NWF.FormFiller.Functions.ProcessOnChange(NWF$(this));});formFillerDivCurrent.on('change','input:checkbox',function(event){NWF.FormFiller.Functions.ResetCircularReferenceRelatedVariables();NWF.FormFiller.Functions.ProcessOnChange(NWF$(this));});formFillerDivCurrent.on('input propertychange blur change','textarea',function(event){NWF.FormFiller.Functions.ResetCircularReferenceRelatedVariables();NWF.FormFiller.Functions.ProcessOnChange(NWF$(this));});formFillerDivCurrent.on('change','select',function(event){NWF.FormFiller.Functions.ResetCircularReferenceRelatedVariables();NWF.FormFiller.Functions.ProcessOnChange(NWF$(this));});},ProcessOnChangeEvents:function(){NWF.FormFiller.Functions.ProcessingOnLoad=true;var changeEventsCount=NWF.FormFiller.Functions.ChangeEventsToProcess.length;for(var changeEventCtr=0;changeEventCtr0){var ayncFormula=NWF.FormFiller.Functions.AsyncFunctonsToProcess.shift();NWF.FormFiller.Functions.HandleAsyncFormula(ayncFormula.functionResult,ayncFormula.resultControl,ayncFormula.controlfunction,ayncFormula.controlContext,ayncFormula.asyncCallCount,ayncFormula.formattedFunctionResult,ayncFormula.cc);}},RepeatingOperationWithDelay:function(functionToRepeat,numberOfRepeats){var count=0;var instance=this;this.step=function(args){if(++count>=numberOfRepeats){count=0;setTimeout(function(){functionToRepeat(args);},1,[]);return;} functionToRepeat(args);};},SetFillerContainerHeight:function(formFillerDivCurrent){NWF.Utilities.SetContainerAndOuterDiv(formFillerDivCurrent);var maxHeight=NWF.FormFiller.Functions.MaxHeight;var maxWidth=NWF.FormFiller.Functions.MaxWidth;if(container.height()=0;a--){var thisRepeaterControl=NWF$(allRepeaters[a]);var repeaterRows=NWF$(thisRepeaterControl.children('.nf-repeater-row'));for(var rowCnt=0;rowCnt1){var totalRowHeights=0;for(var i=1;i0){currentControl.outerHeight(totalRowHeights,true);NWF.FormFiller.Functions.RepositionAndResizeOtherControlsAndFillerContainerHeight(currentControl,-firstRowHeight,-currentChildControlHeightWithBorders,formFillerDivCurrent);}}} try{NWF.Utilities.HideProgressDiv();} catch(err){}},SetFirstFocusableFillerControl:function(control){if(NWF.FormFiller.Functions.FirstFocusableFillerControl==null){NWF.FormFiller.Functions.FirstFocusableFillerControl=control;}},ProcessFillerControl:function(fillerDiv,formFillerDivCurrent){var borderDiv=NWF$(fillerDiv.children()[0]);var fillerInnerDiv=NWF$(borderDiv.children()[0]);var formControl=NWF$(fillerInnerDiv.children()[0]);if(formControl.length==0){if(NWF$(fillerDiv[0]).text()===""){borderDiv.hide();} return;} var fillerInnerDivBorderTopWidth;var fillerInnerDivBorderBottomWidth;var formControlId=fillerDiv.attr("FormControlId");if(fillerDiv.children().length==0)return;NWF.FormFiller.Events.ExecuteControlProcessing(formControl);if(fillerDiv.hasClass("nf-choiceAsTabs")&&NWF$(fillerDiv.closest('.nf-repeater-row')).length==0){formControl.buttonset();} var fn=nfClientInitializeFunctions[fillerDiv.data('formcontroltypeid')];if(fn&&NWF$.isFunction(fn)&&NWF$(fillerDiv.closest('.nf-repeater-row-hidden')).length==0&&formControl.data().ignoreoninit==undefined){fn.call(fillerDiv);} if(!formControl.hasClass("nf-droppable-container")){if(NWF.FormFiller.Functions.FirstFocusableFillerControl==null){var itemPickerInput=fillerDiv.find("div[contentEditable='true']:visible");if(itemPickerInput.length){NWF.FormFiller.Functions.SetFirstFocusableFillerControl(itemPickerInput);}} var controlCalculations=NWF.FormFiller.Functions.GetAssociatedFunctions(CalculationFunctions,"Control",formControlId,"CalculationFunctions");var controlrules=NWF.FormFiller.Functions.GetAssociatedFunctions(Rules,"Control",formControlId,"Rules");var controlDataAccessTokens=NWF.FormFiller.Functions.GetAssociatedFunctions(DataAccessTokens,"Control",formControlId,"DataAccessTokens");var currentControlValue=fillerDiv.attr("data-currentcontrolvalue");fillerDiv.find('textarea').each(function(){var control=NWF$(this);control.attr("FormControlId",formControlId);if(controlCalculations.length>0||controlrules.length>0||controlDataAccessTokens.length>0){NWF.FormFiller.Functions.ChangeEventsToProcess.push(control);} NWF.FormFiller.Functions.SetFirstFocusableFillerControl(control);});fillerDiv.find('input').each(function(){var control=NWF$(this);if(!control.hasClass("nf-ignore-for-calc")){control.attr("FormControlId",formControlId);if(controlCalculations.length>0||controlrules.length>0||controlDataAccessTokens.length>0){NWF.FormFiller.Functions.ChangeEventsToProcess.push(control);} if(control[0].type!="hidden"){NWF.FormFiller.Functions.SetFirstFocusableFillerControl(control);} if(currentControlValue!=undefined){return false;}}});fillerDiv.find('select').each(function(){var control=NWF$(this);control.attr("FormControlId",formControlId);if(controlCalculations.length>0||controlrules.length>0||controlDataAccessTokens.length>0){NWF.FormFiller.Functions.ChangeEventsToProcess.push(control);} NWF.FormFiller.Functions.SetFirstFocusableFillerControl(control);});} NWF.FormFiller.Functions.ProcessedControlCounter++;if(!fillerDiv.hasClass("nf-resizable")){NWF.FormFiller.Events.ExecuteControlProcessed(formControl);return;} NWF.FormFiller.Functions.ProcessedResizedControlCounter++;var fillerDivCss=NWF.Utilities.GetAllStyles(fillerDiv[0]);var fillerDivTop=NWF.Utilities.GetStyle(fillerDivCss,"top",fillerDiv,"top");var fillerDivLeft=NWF.Utilities.GetStyle(fillerDivCss,"left",fillerDiv,"left");var fillerDivHeightOriginal=fillerDiv.outerHeight(true);fillerDiv.data("FillerDivInitHeight",fillerDivHeightOriginal);if((fillerDivHeightOriginal+fillerDivTop)>NWF.FormFiller.Functions.MaxHeight)NWF.FormFiller.Functions.MaxHeight=fillerDivHeightOriginal+fillerDivTop;var formControlCss=NWF.Utilities.GetAllStyles(formControl[0]);var fillerInnerDivCss=NWF.Utilities.GetAllStyles(fillerInnerDiv[0]);var formControlMaginTop=NWF.Utilities.GetStyle(formControlCss,"marginTop",formControl,"margin-top");var formControlMaginBottom=NWF.Utilities.GetStyle(formControlCss,"marginBottom",formControl,"margin-bottom");var formControlHeightOriginal=parseInt(formControl.outerHeight())+formControlMaginTop+formControlMaginBottom;var fillerDivHeightNew=NWF.FormFiller.Functions.AdjustControlHeights(fillerDiv,fillerInnerDiv,borderDiv,formControl,fillerDivCss,fillerInnerDivCss,formControlCss,fillerDivHeightOriginal);NWF.FormFiller.Functions.AdjustO365DyanmicControlsHeights(fillerDiv,fillerInnerDiv,borderDiv,formControl);if((fillerDiv.hasClass("nf-recurrence-control"))&&(fillerDivHeightNew-fillerDivHeightOriginal<15)){NWF.FormFiller.Functions.ResizedControlCounterOuter++;NWF$(NWF$(formControl).children()).each(function(){if(NWF$(this).css("display")!="none"){formControlHeightOriginal+=NWF$(this).outerHeight();}});fillerInnerDivBorderTopWidth=NWF.Utilities.GetStyle(fillerInnerDivCss,"borderTopWidth",fillerInnerDiv,"border-top-width");fillerInnerDivBorderBottomWidth=NWF.Utilities.GetStyle(fillerInnerDivCss,"borderBottomWidth",fillerInnerDiv,"border-bottom-width");fillerDivHeightNew=formControlHeightOriginal+fillerInnerDivBorderTopWidth+fillerInnerDivBorderBottomWidth;if(fillerDivHeightOriginalNWF.FormFiller.Functions.MaxHeight)NWF.FormFiller.Functions.MaxHeight=formControlHeightOriginal+fillerDivTop;fillerDiv.outerHeight(formControlHeightOriginal);NWF.FormFiller.Functions.ResizedControlCounter++;NWF.FormFiller.Functions.RepositionAndResizeOtherControlsAndFillerContainerHeight(fillerDiv,formControlHeightOriginal-fillerDivHeightOriginal,fillerDivHeightNew-fillerDivHeightOriginal,formFillerDivCurrent);}} else if(fillerDiv.hasClass("nf-listview-control")){NWF.FormFiller.Functions.ResizedControlCounterOuter++;formControlHeightOriginal=0;NWF$(fillerInnerDiv.children()).each(function(){if(NWF$(this).css("display")!="none"){formControlHeightOriginal+=NWF$(this).outerHeight();}});fillerInnerDivBorderTopWidth=NWF.Utilities.GetStyle(fillerInnerDivCss,"borderTopWidth",fillerInnerDiv,"border-top-width");fillerInnerDivBorderBottomWidth=NWF.Utilities.GetStyle(fillerInnerDivCss,"borderBottomWidth",fillerInnerDiv,"border-bottom-width");fillerDivHeightNew=formControlHeightOriginal+fillerInnerDivBorderTopWidth+fillerInnerDivBorderBottomWidth;if(fillerDivHeightOriginalNWF.FormFiller.Functions.MaxHeight)NWF.FormFiller.Functions.MaxHeight=formControlHeightOriginal+fillerDivTop;fillerDiv.outerHeight(formControlHeightOriginal);NWF.FormFiller.Functions.ResizedControlCounter++;NWF.FormFiller.Functions.RepositionAndResizeOtherControlsAndFillerContainerHeight(fillerDiv,formControlHeightOriginal-fillerDivHeightOriginal,fillerDivHeightNew-fillerDivHeightOriginal,formFillerDivCurrent);}} else if(fillerDivHeightOriginalNWF.FormFiller.Functions.MaxHeight)NWF.FormFiller.Functions.MaxHeight=formControlHeightOriginal+fillerDivTop;NWF.FormFiller.Functions.ResizedControlCounter++;NWF.FormFiller.Functions.RepositionAndResizeOtherControlsAndFillerContainerHeight(fillerDiv,formControlHeightOriginal-fillerDivHeightOriginal,fillerDivHeightNew-fillerDivHeightOriginal,formFillerDivCurrent);} if(fillerDiv.hasClass("nf-recurrence-control")){var fillerDivWidthOriginal=fillerDiv.outerWidth(true);var fillerDivRight=fillerDivLeft+fillerDivWidthOriginal;if(fillerDivRight>NWF.FormFiller.Functions.MaxWidth)NWF.FormFiller.Functions.MaxWidth=fillerDivRight;var formControlMaginLeft=NWF.Utilities.GetStyle(formControlCss,"marginLeft",formControl,"margin-left");var formControlMaginRight=NWF.Utilities.GetStyle(formControlCss,"marginRight",formControl,"margin-right");var formControlWidthOriginal=formControl.outerWidth()+formControlMaginLeft+formControlMaginRight;var fillerDivWidthNew=NWF.FormFiller.Functions.AdjustControlWidths(fillerDiv,fillerInnerDiv,borderDiv,formControl,fillerDivWidthOriginal);if(fillerDivWidthOriginalNWF.FormFiller.Functions.MaxWidth)NWF.FormFiller.Functions.MaxWidth=formControlWidthOriginal+fillerDivLeft;NWF.FormFiller.Functions.RepositionAndResizeOtherControlsAndContainerWidth(fillerDiv,formControlWidthOriginal-fillerDivWidthOriginal,fillerDivWidthNew-fillerDivWidthOriginal,formFillerDivCurrent);}else{formControlWidthOriginal=0;NWF$(NWF$(formControl).children()).each(function(){if(NWF$(this).css("display")!="none"){if(formControlWidthOriginalNWF.FormFiller.Functions.MaxWidth)NWF.FormFiller.Functions.MaxWidth=formControlWidthOriginal+fillerDivLeft;NWF.FormFiller.Functions.RepositionAndResizeOtherControlsAndContainerWidth(fillerDiv,formControlWidthOriginal-fillerDivWidthOriginal,fillerDivWidthNew-fillerDivWidthOriginal,formFillerDivCurrent);}}} NWF.FormFiller.Events.ExecuteControlProcessed(formControl);},ResolvePeoplePickersOnForm:function(){var peoplepickerControlsOnForm=NWF$('.nf-people-picker');NWF$.each(peoplepickerControlsOnForm,function(){try{NWF$(this).trigger("blur");} catch(e){}});},PrepareFormForPostBack:function(){var formFillerDivCurrent=NWF.FormFiller.Functions.GetFormFillerDiv();var disabledControls=NWF$('.nf-filler-control').filter(function(){return NWF$(this).data("DisableCounter")>0;});disabledControls.each(function(index,item){var disabledControl=NWF$(item);NWF.FormFiller.Functions.RemoveDisableAttribute(disabledControl);disabledControl.data("DisableCounter",0);});formFillerDivCurrent.find(".nf-repeater-row").css({"visibility":"hidden"});formFillerDivCurrent.css({"visibility":"hidden"});NWF$(".nf-filler-wrapper-outer").css({"visibility":"hidden"});},ResolveMultiLineOnForm:function(){var richTextControlsOnForm=NWF$('.nf-richtextV3');NWF$.each(richTextControlsOnForm,function(){try{if(browseris.ie5up&&(browseris.win32||browseris.win64bit)&&!IsAccessibilityFeatureEnabled()){RTE_TransferIFrameContentsToTextArea(this.id);NWF.FormFiller.Functions.ProcessOnChange(NWF$(RTE_GetEditorTextArea(this.id)));}} catch(e){}});},ToggleValidator:function(clientId,enable){if(clientId&&NWF$("#"+clientId).length==1) ValidatorEnable(NWF$("#"+clientId).get(0),enable);},GetFillerDivObjectForControl:function(formControl){return formControl.parent().parent().parent();},GetFillerInnerDivObjectForControl:function(formControl){return formControl.parent();},GetBorderDivObjectForControl:function(formControl){return formControl.parent().parent();},AsyncCompletedValidationRules:function(){return{};}(),ProcessValidatorForAsync:function(val,validationGroup,deferreds){if((typeof(val.enabled)=="undefined"||val.enabled!=false)&&IsValidationGroupMatch(val,validationGroup)){if(typeof(val.evaluationfunction)=="function"){var ruleFunctionName=window[val.functionName];var ctrl=val.controltovalidate;if(typeof(ruleFunctionName)=="function"){if(ruleFunctionName.toString().toLowerCase().indexOf("nwf.formfiller.asyncformulamanager")>=0){var value="";if(typeof(val.controltovalidate)=="string"){value=ValidatorGetValue(val.controltovalidate);} var args={Value:value,IsValid:true};var result=null;if(typeof(val.clientvalidationfunction)=="string"){result=eval(val.clientvalidationfunction+"(val, args) ;");} if(result!==undefined&&result!=null&&result.deferred){deferreds.push(result.deferred);result.deferred.done(function(returnedFunction){if(NWF.FormFiller.Functions.AsyncCompletedValidationRules[ctrl+val.functionName]==null||NWF.FormFiller.Functions.AsyncCompletedValidationRules[ctrl+ruleFunctionName]==undefined){NWF.FormFiller.Functions.AsyncCompletedValidationRules[ctrl+val.functionName]=[];} NWF.FormFiller.Functions.AsyncCompletedValidationRules[ctrl+val.functionName]=returnedFunction;}).fail(function(){console.log("A Nintex asynchronous validation rule for control"+ctrl+" failed to execute on form submission.");});}}}}}},ProcessFormsValidation:function(source,validationGroup){var deferreds=[];if(!NWF.FormFiller.Functions.RulesAsyncReady){NWF.FormFiller.Functions.AsyncCompletedValidationRules=function(){return{};}();try{for(i=0;i0){try{if(NWF.Utilities.ProgressDlg==null||(NWF.Utilities.ProgressDlg!=null&&NWF.Utilities.ProgressDlg.get_closed()==true)){NWF.Utilities.ShowProgressDiv('Please wait...');}} catch(err){} NWF.FormFiller.Functions.RulesAsyncReady=false;NWF$.when.apply(NWF$,deferreds).done(function(){NWF.Utilities.HideProgressDiv();setTimeout(function(){NWF.FormFiller.Functions.RulesAsyncReady=true;NWF$(source).click();},50);}).fail(function(){try{NWF.Utilities.HideProgressDiv();console.log("Handling all asynchronous validation rules failed.");var dialog={html:NWF$("

There was an issue validating the data entered on the form; please try again. If the problem persists, contact the form owner.

")[0],title:"Validation Error",allowMaximize:false,showClose:true};SP.UI.ModalDialog.showModalDialog(dialog);}catch(err){console.log("An error ocurred notifying user of validation rule failure.");} return false;});}else{return true;}} if(NWF.FormFiller.Functions.RulesAsyncReady){NWF.FormFiller.Functions.RulesAsyncReady=false;return true;} else{return false;}},FillerPreReadyProcessing:function(formFillerDivCurrent){var highlightControlError=function(control,errorMessage,highlightfallback){NWF.FormFiller.Functions.HighlightO365RTEControl(control,errorMessage);errorMessage=NWF.Utilities.UnescapeString(errorMessage);if(!highlightfallback){if(!control.hasClass('nf-error-highlight')){control.addClass('nf-error-highlight');control.attr('title',errorMessage);}}else{if(control.children('.nf-error-left-div').length==0){control.append("
");control.append("
");control.append("
");control.append("
");control.zIndex(control.zIndex()+1);control.attr('title',errorMessage);}}};var clearControlError=function(control){NWF.FormFiller.Functions.ClearO365RTEControl(control);if(!control.data("helptextsaved")){control.data("helptext",control.attr('title'));control.data("helptextsaved",true);} control.removeClass('nf-error-highlight');if(control.children('.nf-error-left-div').length!=0){control.children('.nf-error-left-div').remove();control.children('.nf-error-right-div').remove();control.children('.nf-error-top-div').remove();control.children('.nf-error-bottom-div').remove();control.zIndex(control.zIndex()-1);} control.attr('title',control.data("helptext")||"");};NWF$('#aspnetForm').bind('submit',function(e){if(!NWF.FormFiller.Functions.SubmitInProgress){if(NWF$("input:focus").length==1){NWF$("input:focus").trigger("blur");} NWF.FormFiller.Functions.ResolvePeoplePickersOnForm();NWF.FormFiller.Functions.ResolveMultiLineOnForm();NWF$(".nf-disableonsubmit").css('filter','alpha(opacity = 40)');var errorDisplayed=false;if(typeof(Page_IsValid)!='undefined'&&!Page_IsValid&&typeof(Page_Validators)!='undefined'){var controlToHighlight;NWF$.each(Page_Validators,function(){if(this.controltohighlightonerror!=undefined){if(this.controltohighlightonerror==''){var currentControl=NWF$('#'+this.controltovalidate);controlToHighlight=NWF$(currentControl.parents('.nf-filler-highlightonvalidationerror')[0]);} else{controlToHighlight=NWF$('#'+this.controltohighlightonerror);}} else{controlToHighlight=NWF$('#'+this.controltovalidate);} clearControlError(controlToHighlight);});NWF$.each(Page_Validators,function(){if(!this.isvalid){var controlToHighlight;var highlightfallback=false;if(this.controltohighlightonerror!=undefined){if(this.controltohighlightonerror==''){var currentControl=NWF$('#'+this.controltovalidate);controlToHighlight=NWF$(currentControl.parents('.nf-filler-highlightonvalidationerror')[0]);if(controlToHighlight.hasClass('nf-filler-control')){highlightfallback=true;}} else{controlToHighlight=NWF$('#'+this.controltohighlightonerror);}} else{controlToHighlight=NWF$('#'+this.controltovalidate);} highlightControlError(controlToHighlight,this.errormessage,highlightfallback);errorDisplayed=true;}});if(ResizeWorkspace){NWF$("#s4-workspace").outerHeight(NWF$("#s4-mainarea").outerHeight());}} if(errorDisplayed){NWF$(".nf-disableonsubmit").css('filter','alpha(opacity = 100)');} else{NWF.FormFiller.Functions.PrepareFormForPostBack();NWF.FormFiller.Attachments.SaveAttachmentFilesNamesForDataBind();NWF.FormFiller.Functions.SubmitInProgress=true;} if(typeof(RefreshCommandUI)!='undefined'){RefreshCommandUI();}}});NWF.FormFiller.Events.ExecuteBeforeFillerVisible();NWF.FormFiller.Attachments.ProcessOrphanedAttachments();formFillerDivCurrent.css({"visibility":"visible"});NWF.FormFiller.Events.IsFillerVisible=false;NWF.FormFiller.Events.ExecuteAfterFillerVisible();if(NWF.FormFiller.Functions.FirstFocusableFillerControl!=null){NWF.FormFiller.Functions.FirstFocusableFillerControl.focus();} focusOnLoadControl.hide();NWF$("#s4-workspace").scrollTop(0);NWF$("#s4-workspace").scrollLeft(0);if(formfillerDivsCount>1&&++processingFormFillerIndex'+NWF.FormFiller.Functions.ThousandSeparatorSymbol+'

').text();NWF.FormFiller.Functions.DecimalSymbol=NWF$('

'+NWF.FormFiller.Functions.DecimalSymbol+'

').text();NWF.FormFiller.Functions.EnableDisableFillins=function(){var choiceControl=NWF$(this).parents(".nf-choice-control-fill-in");var fillInChoice=choiceControl.find(".nf-fillin-option > input")[0];var fillinTextBox=choiceControl.find(".nf-choice-control-textbox");if(choiceControl.parents(".nf-filler-control").data('enabled')=="True"){if(fillInChoice.checked){fillinTextBox.removeAttr("disabled");choiceControl.find("select.nf-choice-control").attr("disabled","disabled");}else{fillinTextBox.attr("disabled","disabled");choiceControl.find("select.nf-choice-control").removeAttr("disabled");}}};NWF.FormFiller.Functions.EnableTextBox=function(){var choiceControl=NWF$(this).parents(".nf-choice-control-fill-in");var fillinRadio=choiceControl.find(".nf-fillin-option > input")[0];if(choiceControl.parents(".nf-filler-control").data('enabled')=="True"){NWF$(fillinRadio).prop("checked",true);NWF.FormFiller.Functions.EnableDisableFillins.call(this);}};NWF.FormFiller.Functions.EnableChoice=function(){var choiceControl=NWF$(this).parents(".nf-choice-control-fill-in");var choiceRadio=choiceControl.find(".nf-choice-control-radio-button > input")[0];if(choiceControl.parents(".nf-filler-control").data('enabled')=="True"){NWF$(choiceRadio).prop("checked",true);NWF.FormFiller.Functions.EnableDisableFillins.call(this);}};if(NWF.FormFiller.Functions.IsiPad()){ResizeWorkspace=true;} if(typeof(ValidatorConvert)!="undefined"){var oldValidatorConvert=ValidatorConvert;ValidatorConvert=function(op,dataType,val){if(dataType=="Currency"&&val.currencysymbol){op=op.replace(val.currencysymbol,"");} else if((dataType=="Double"||dataType=="Integer")&&NWF.FormFiller.Functions.ThousandSeparatorSymbol&&NWF.FormFiller.Functions.DecimalSymbol){var temp=op.split(NWF.FormFiller.Functions.DecimalSymbol);temp[0]=temp[0].split(NWF.FormFiller.Functions.ThousandSeparatorSymbol).join('');op=temp.join(NWF.FormFiller.Functions.DecimalSymbol);} return oldValidatorConvert(op,dataType,val);};} if(typeof(ValidationSummaryOnSubmit)!="undefined"){ValidationSummaryOnSubmit=function(validationGroup){if(typeof(Page_ValidationSummaries)=="undefined") return;var summary,sums,s;var ruleIds=new Array();var headerSep,first,pre,post,end;for(sums=0;sums input').each(NWF.FormFiller.Functions.EnableDisableFillins);formFillerDivCurrent.on('change','.nf-fillin-option > input:checkbox',NWF.FormFiller.Functions.EnableDisableFillins);formFillerDivCurrent.on('change','.nf-choice-control-fill-in input:radio',NWF.FormFiller.Functions.EnableDisableFillins);formFillerDivCurrent.on('mousedown','.nf-choice-control-textbox',NWF.FormFiller.Functions.EnableTextBox);formFillerDivCurrent.on('mousedown','.nf-choice-control',NWF.FormFiller.Functions.EnableChoice);formFillerDivCurrent.css({"visibility":"visible"});focusOnLoadControl.focus();formFillerDivCurrent.css({"visibility":"hidden"});NWF.FormFiller.Functions.InitializeLookUp(formFillerDivCurrent);setTimeout("NWF.FormFiller.Functions.ProcessFillerControls();",1);},Ready:function(){if(processingFormFillerIndex==0){NWF.FormFiller.Functions.UseServerValueForCalculations=document.referrer.indexOf(document.location.href)==-1;NWF.FormFiller.Functions.PageInit();} NWF.FormFiller.Functions.FormInit();},InitializeLookUp:function(formFillerDivCurrent){if(typeof NF.Lookup=='undefined'){return;} NWF.FormFiller.Functions.OverrideCommonLookupFunctions();NF.LookupHelper.DomReady(formFillerDivCurrent);NWF.FormFiller.Events.RegisterAfterReady(function(){SP.SOD.executeFunc('sp.js','SP.ClientContext',function(){setTimeout(function(){NF.LookupHelper.Initialize("#formFillerDiv",new NF.Lookup.DataSource()),1});});});NF.LookupHelper.RegisterAfterLoadedEvent(NF.LookupHelper.AdjustCheckBoxRadioButtonListHeight);},SpClientContextCollection:[],OverrideCommonLookupFunctions:function(){NF.Lookup.Common.lookupClientContext=function(site){site=(site=="")?window._spPageContextInfo.webServerRelativeUrl:site;if(NWF.FormFiller.Functions.SpClientContextCollection[site]!=undefined){return NWF.FormFiller.Functions.SpClientContextCollection[site];} NWF.FormFiller.Functions.SpClientContextCollection[site]=new SP.ClientContext(decodeURIComponent(encodeURIComponent(site)));;return NWF.FormFiller.Functions.SpClientContextCollection[site];};NF.LookupHelper.Initialize=function(dom,dataSource){self.dataSource=dataSource;for(var i=0,total=self.modelCollection.length;ib?1:-1;});runAllAsyncFormulaLevels(allLevelsCompleteDeferred,sortedFunctionLevels);return allLevelsCompleteDeferred.promise();} function runAllAsyncFormulaLevels(allLevelsCompleteDeferred,sortedFunctionLevels){var currentLevel=sortedFunctionLevels.pop();if(currentLevel!=undefined&¤tLevel>=0){NWF$.when(runAsyncFormulasForLevel(currentLevel)).done(function(){if(sortedFunctionLevels.length>0){runAllAsyncFormulaLevels(allLevelsCompleteDeferred,sortedFunctionLevels);}else{allLevelsCompleteDeferred.resolve();}}).fail(function(){allLevelsCompleteDeferred.reject();});}} function runAsyncFormulasForLevel(level){var def=NWF$.Deferred();NWF$.when(runAsyncFormulaParts(self.asyncFormulaParts[level])).done(function(){def.resolve();}).fail(function(){def.reject();});return def.promise();} function runAsyncFormulaParts(asyncFormulaParts){var deferred=NWF$.Deferred();var asyncPartDeferreds=[];NWF$(asyncFormulaParts).each(function(index,asyncFormulaPart){if(asyncFunctionResults[asyncFormulaPart.tokenKey]==null||asyncFunctionResults[asyncFormulaPart.tokenKey]==undefined){asyncFunctionResults[asyncFormulaPart.tokenKey]=[];} asyncPartDeferreds.push(asyncFormulaPart.run(self.sourceContext,self.asyncFunctionResults,self.rowIndex));});NWF$.when.apply(NWF$,asyncPartDeferreds).done(function(){deferred.resolve();}).fail(function(asyncError){self.asyncFormulaError.asyncErrors.push(asyncError);deferred.reject();});return deferred.promise();}};NWF.FormFiller.AsyncFormulaPart=function(tokenKey,functionToCall){var self=this;self.tokenKey=tokenKey;self.functionToCall=functionToCall;self.deferredObj=NWF$.Deferred();self.run=function(sourceContext,asyncFunctionResults,rowIndex){try{NWF$.when(self.functionToCall(sourceContext)).done(function(result){if(typeof(result)!="function"){asyncFunctionResults[tokenKey][rowIndex]=result;} self.deferredObj.resolve();}).fail(function(errVal,errMessage){asyncFunctionResults[tokenKey][rowIndex]=errVal;self.deferredObj.reject(new NWF.FormFiller.AsyncError(errVal,errMessage,self.tokenKey));});}catch(err){self.deferredObj.reject(new NWF.FormFiller.AsyncError("async error",err.message,self.tokenKey));} return self.deferredObj.promise();};};NWF.FormFiller.Events=function(){var executeEvents=function(fillerCustomEvents,args){for(var i=0;i1){focusOnLoadControl=NWF$(focusOnLoadControls[processingFormFillerIndex]);} NWF.FormFiller.Functions.Ready();if(typeof(isTrial)!="undefined"&&isTrial){var trialDiv=NWF$("
");var trialImg=NWF$("");trialImg.attr({src:NWF.Environment.NintexFormsPath()+'Images/Trial.png',width:'59px',height:'60px'});trialDiv.addClass("trialDivFiller");trialImg.addClass("trialImg");NWF$(".nf-filler-container").append(trialDiv.append(trialImg));} if(typeof(isWorkflowForm)=="undefined"||!isWorkflowForm){NWF$('.ms-dialog #s4-workspace').addClass('overflowY');}});