|'+stepValues[value]+"
");else if(isRtlEnabled)for(i=stepValues.length;i>0;i--)$(sliderDivId).append('
|'+stepValues[i-1]+"
"),nextPosition+=widthDiff;else for(var value in stepValues)$(sliderDivId).append('
|'+stepValues[value]+"
"),nextPosition+=widthDiff}},ZFLive.showThemePreview=function(){showTransparentPageLoading();var ajaxOpts={URI:"/"+this.portalName+"/form/"+this.formLinkName+"/themes/preview?previewFrom=liveform",METHOD:ZFHttp.GET,ACCEPT:"text/html",CALLBACK:function(jsonData,ajaxOpts,jqXhr){200==jqXhr.status?$("#form-preview-container").append(jqXhr.responseText):showErrorPopUp(i18n.erroroccurred,i18n.internalserver),$("#darkLoadingDiv").hide()}};ZFUtil.sendAjax(ajaxOpts,this,ZFLive.isPublicFormAccess)},ZFResizeEventObserver.prototype.observe=function(){const self=this;this.resizeObserver=new ResizeObserver(function(entries){self.resizeEventCallback(self,entries)}),this.resizeObserver.observe(this.elem)},ZFResizeEventObserver.prototype.disconnectObserver=function(){this.resizeObserver.disconnect()},ZFLive.listAddressAutoComplete=function(e,input,component,isGoogle){if(!ZFLive.isFreePlan&&"true"==isGoogle||"false"==isGoogle){var addressContMapDiv=$("#addrAutoCompl"),addressContMapUL=$(addressContMapDiv).find("ul[elname=addressContMapUL]");if(40!==e.keyCode&&38!==e.keyCode&&17!==e.keyCode&&18!==e.keyCode&&9!==e.keyCode){var inputVal=$(input).val(),parentLi=isNewHtmlDOM()?$(input).closest("div[elname=livefield-elem]"):$(input).closest("li[elname=livefield-elem]"),parentElemId=$(parentLi).attr("id"),parentElemCompname=$(parentLi).attr("linkname"),inpCompLink=$(input).attr("complink"),addressContMapULGoogle=$(addressContMapDiv).find("div[elname=powGoogleMap]"),allowed_country=$(parentLi).attr("allowed_countries"),initial_val=$(parentLi).find("select#"+parentElemCompname+"_Country").find(":selected").attr("isocode");if(inputVal.length<3)return $(addressContMapUL).empty(),void $(addressContMapDiv).hide();if(13===e.keyCode||37===e.keyCode||39===e.keyCode||16===e.keyCode||91===e.keyCode||20===e.keyCode)return;9===e.keyCode&&($(addressContMapDiv).hide(),addAccessibilityAttrForAddAutoFillInput(input,!1));var isValidLatitude=typeof ZFLive.fetchedLatitude!==ResponseKey.UNDEFINED&&""!==ZFLive.fetchedLatitude&&ZFUtil.validateLatitudeFormat(ZFLive.fetchedLatitude),isValidLongitude=typeof ZFLive.fetchedLongitude!==ResponseKey.UNDEFINED&&""!==ZFLive.fetchedLongitude&&ZFUtil.validateLongitudeFormat(ZFLive.fetchedLongitude);isValidLatitude&&isValidLongitude&&(ZFLive.pri_lat=ZFLive.fetchedLatitude,ZFLive.pri_lon=ZFLive.fetchedLongitude);var countryNamesArray=[];if(typeof initial_val!=ResponseKey.UNDEFINED&&""!=initial_val)countryNamesArray.push(initial_val);else if(typeof allowed_country!=ResponseKey.UNDEFINED&&""!=allowed_country){var arrayOfCountries=allowed_country.split(",");if(arrayOfCountries.length<=5)for(var i=0;i
0){var countrycode={country_codes:countryNamesArray};reqURL+="&filter="+encodeURIComponent(JSON.stringify(countrycode))}var ajaxOpts={URI:reqURL,METHOD:"GET",CALLBACK:function(jsonData,ajaxOpts,jqXhr){if(200!==jqXhr.status)return $(addressContMapDiv).hide(),void addAccessibilityAttrForAddAutoFillInput(input,!1);var responseJson=JSON.parse(jqXhr.responseText);$(addressContMapUL).empty(),$(addressContMapDiv).is(":visible")||($(addressContMapDiv).show(),addAccessibilityAttrForAddAutoFillInput(input,!0)),responseJson.result!=undefined&&($.each(responseJson.result,function(index,item){var listItem="";"ZipCode"!==component?(item.address_line1!=undefined&&(listItem=listItem+item.address_line1+", "),item.city!=undefined&&(listItem=listItem+item.city+", "),item.city==undefined&&item.district!=undefined&&(listItem=listItem+item.district+", "),item.postal_code!=undefined&&(listItem=listItem+item.postal_code+", "),item.state!=undefined&&(listItem=listItem+item.state+", "),item.country!=undefined&&(listItem+=item.country)):(item.postal_code!=undefined&&(listItem=listItem+item.postal_code+", "),item.city!=undefined&&(listItem=listItem+item.city+", "),item.city==undefined&&item.district!=undefined&&(listItem=listItem+item.district+", "),item.state!=undefined&&(listItem=listItem+item.state+", "),item.country!=undefined&&(listItem+=item.country)),$(addressContMapUL).append(""+listItem+""),$(addressContMapUL).attr("id","addrAutoFill");var addressContMapLi=$(addressContMapUL).find("li:last").data("item",item);isAccessibilitySupported()&&($(addressContMapUL).attr("role","listbox"),$(addressContMapLi).attr("role","option")),$(addressContMapLi).attr("onclick",'ZFLive.chooseAddressValue(this, "'+inpCompLink+'", "'+parentElemId+'", "'+isGoogle+'")').attr("id","addrAutoComplVal"+index)}),$(addressContMapULGoogle).hide(),setAddrAutoComplListPos(addressContMapDiv,input),isAccessibilitySupported()&&($(input).removeAttr("aria-controls"),$(input).removeAttr("aria-activedescendant"),$(input).attr("aria-controls",$(addressContMapUL).attr("id"))),$(document).on("click.addrAutofill",function(event){0==$("div[elname=addressContMap]").find(event.target).length&&($(addressContMapDiv).hide(),addAccessibilityAttrForAddAutoFillInput(input,!1)),$(document).off("click.addrAutofill")}))}};ZFUtil.sendAjax(ajaxOpts,this,!0)}}$(addressContMapDiv).is(":visible")&&$(addressContMapUL).find("li").length>=1&&(40===e.keyCode?focusNextLIElem(addressContMapDiv,input):38===e.keyCode&&focusPrevLIElem(addressContMapDiv,input))}},ZFLive.chooseAddressValue=function(liElem,inpCompLink,parentElemId,isGoogle){var parentLiElem=$("#"+parentElemId),fieldLinkName=$(parentLiElem).attr("linkname"),addressContMapDiv=$("#addrAutoCompl");$(addressContMapDiv).hide();var currElem=$(parentLiElem).find("input[complink="+inpCompLink+"]");isAccessibilitySupported()&&$(currElem).attr("aria-expanded","false");var isZipCodeSearch=inpCompLink.includes("ZipCode");"true"==isGoogle?fetchPlaceDetails(inpCompLink,$(liElem).attr("placeID"),isZipCodeSearch,parentLiElem):handleKeyMappingForAddressThroughMaps($(liElem).data("item"),fieldLinkName,isZipCodeSearch,parentLiElem);$(currElem).focus()},ZFLive.handleEnterEvent=function(e,input,isGoogleMap){var parentLi=isNewHtmlDOM()?$(input).closest("div[elname=livefield-elem]"):$(input).closest("li[elname=livefield-elem]"),parentElemId=$(parentLi).attr("id"),inpCompLink=$(input).attr("complink"),addressContMapDiv=$("#addrAutoCompl");$(addressContMapDiv).find("ul[elname=addressContMapUL]");if(13===e.keyCode){if($(addressContMapDiv).is(":visible"))return liSelectfn(addressContMapDiv,inpCompLink,parentElemId,isGoogleMap),e.preventDefault(),!1}else 38===e.keyCode?e.preventDefault():9===e.keyCode&&($(addressContMapDiv).hide(),addAccessibilityAttrForAddAutoFillInput(input,!1))},ZFLive.removeAttribute=function(e,input){var parentLi=isNewHtmlDOM()?$(input).closest("div[elname=livefield-elem]"):$(input).closest("li[elname=livefield-elem]");$(parentLi).removeAttr("placeid")},ZFLive.setCountAndShowDraftSelectionPopup=function(savedEntriesCount){this.savedEntries={},this.savedEntries.initial_count=savedEntriesCount,showDraftSelectionPopup()},ZFLive.fetchSavedRecordsPermaAndShowSummaryPopup=function(showPopup,navDirection){if(this.needToFetchSavedEntries()){$("#screenFreezeDiv").show();var ajaxOpts={URI:"/"+this.portalName+"/form/"+this.formLinkName+"/savedrecords?start="+this.savedEntries.startIdx+"&type=perma",METHOD:ZFHttp.GET,CONTENTTYPE:"application/json",ACCEPT:"application/json",CALLBACK:function(jsonData,ajaxOpts,jqXhr){if(200==jqXhr.status){$("#draftEntriesSelectionPopup").hide();var savedRecordsPerma=JSON.parse(jqXhr.responseText);savedRecordsPerma&&(ZFLive.savedEntries.total_count=savedRecordsPerma.total_records,ZFLive.savedEntries.recordsPerma=savedRecordsPerma.records,ZFLive.resetCurrentRecordIdx(navDirection),ZFLive.showSavedEntriesSummaryPopup(showPopup,navDirection))}else 400==jqXhr.status||403==jqXhr.status?403==jqXhr.status?showErrorPopUp(i18n.erroroccurred,i18n.accessdenied):showErrorPopUp(i18n.erroroccurred,i18n.savedentriesfetcherror):0==jqXhr.status?showErrorPopUp(i18n.erroroccurred,i18n.network_error):showErrorPopUp(i18n.erroroccurred,i18n.internalserver),$("div#settingsErr-div").addClass("zdraftErrPop");$("#screenFreezeDiv").hide()}};ZFUtil.sendAjax(ajaxOpts,this,ZFLive.isPublicFormAccess)}},ZFLive.showSavedEntriesSummaryPopup=function(showPopup,navDirection){var savedEntriesReviewDiv=$("div#savedEntriesReviewDiv");this.savedEntries.recordsPerma&&this.savedEntries.recordsPerma.length?this.constructAndShowCurrentSavedRecordSummary():this.savedEntries.total_count>0?(this.reinitStartIndex(),this.savedEntries.startIdx>=1&&this.fetchSavedRecordsPermaAndShowSummaryPopup(showPopup,navDirection)):this.showSavedRecordErrorDiv(i18n.nosavedentriesfound),showPopup&&$(savedEntriesReviewDiv).fadeIn(500,function(){bindEventsOnSavedEntriesSummaryPopup(),ZFLive.SavedEntriesAccessibilityUtil.setAccessibilityToSavedEntriesSummaryPopup(!0)})},ZFLive.reinitStartIndex=function(){for(;this.savedEntries.startIdx>1&&this.savedEntries.startIdx>this.savedEntries.total_count;)this.savedEntries.startIdx-=this.savedEntries.pageSize},ZFLive.constructAndShowCurrentSavedRecordSummary=function(){var savedRecordPerma=this.savedEntries.recordsPerma[this.savedEntries.currentIdx];savedRecordPerma&&this.fetchAndConstructCurrentSavedRecordSummaryTable(savedRecordPerma)},ZFLive.fetchAndConstructCurrentSavedRecordSummaryTable=function(savedRecordPerma){clearRecordSummaryTable(),showSavedRecFetchLoadingDiv(),$("#screenFreezeDiv").show();var ajaxOpts={URI:"/"+this.portalName+"/form_id/"+this.formID+"/savedrecord/"+savedRecordPerma,METHOD:ZFHttp.GET,ACCEPT:"text/html",CALLBACK:function(jsonData,ajaxOpts,jqXhr){if(200==jqXhr.status){var summaryTableDiv=$("");$(summaryTableDiv).append(jqXhr.responseText),$("#savedRecordSummaryDiv").append(summaryTableDiv),ZFLive.showCurrentSavedRecordSummay(savedRecordPerma)}else{var errorMsg="";errorMsg=400==jqXhr.status||403==jqXhr.status?403==jqXhr.status?i18n.savedrecordnotfound:i18n.savedentriesfetcherror:0==jqXhr.status?i18n.network_error:i18n.internalserver,ZFLive.showSavedRecordErrorDiv(errorMsg),$("div#settingsErr-div").addClass("zdraftErrPop")}$("#screenFreezeDiv").hide(),hideSavedRecFetchLoadingDiv()}};ZFUtil.sendAjax(ajaxOpts,this,ZFLive.isPublicFormAccess)},ZFLive.showCurrentSavedRecordSummay=function(currentSavedRecPerma){var currentSummaryDiv=$("#savedRecordSummaryDiv").find("div[elemtype=recTable][id="+currentSavedRecPerma+"]");setAdvDisplayNamesTextContent(currentSummaryDiv),hideNoSavedRecordsDiv(),$(currentSummaryDiv).show(),this.initPaginationOnSavedEntriesReviewPopup($("div#savedEntriesReviewDiv")),this.setEditSavedRecButton(currentSavedRecPerma)},ZFLive.initPaginationOnSavedEntriesReviewPopup=function(savedEntriesReviewDiv){var previousRecordBtn=$(savedEntriesReviewDiv).find("div#showPrevSavedEntry"),nextRecordBtn=$(savedEntriesReviewDiv).find("div#showNextSavedEntry"),pageNum=this.savedEntries.total_count>0?this.savedEntries.startIdx+this.savedEntries.currentIdx:0;this.savedEntries.total_count>1&&pageNum0?(enableRecordNavigationBtn(previousRecordBtn),ZFLive.SavedEntriesAccessibilityUtil.setAccessibilityAttrToDraftRecordPageNavigation(previousRecordBtn,pageNum-1,this.savedEntries.total_count),$(previousRecordBtn).off("click").on("click",function(){ZFLive.goToPreviousRecord()})):disableRecordNavigationBtn(previousRecordBtn),$("div#savedRecordNavDiv").find("b#savedEntryfrom").text(pageNum),$("div#savedRecordNavDiv").find("em#savedEntryTo").text(this.savedEntries.total_count)},ZFLive.setEditSavedRecButton=function(recordPerma){var url="/"+this.portalName+"/form/"+this.formLinkName+"/record/"+recordPerma+"/save";$("div#savedEntriesReviewDivCont").find("div#savedRecordNavDiv a[elname=editSavedRec]").off("click").on("click",function(){$("#screenFreezeDiv").show(),event.preventDefault(),window.location.href=url})},ZFLive.goToNextRecord=function(){this.savedEntries.currentIdx++,this.savedEntries.currentIdx<=this.savedEntries.recordsPerma.length-1?this.constructAndShowCurrentSavedRecordSummary():(this.savedEntries.startIdx+=this.savedEntries.pageSize,this.fetchSavedRecordsPermaAndShowSummaryPopup(!1,SavedEntriesConstants.NEXT))},ZFLive.goToPreviousRecord=function(){this.savedEntries.currentIdx--,this.savedEntries.currentIdx>=0?this.constructAndShowCurrentSavedRecordSummary():this.savedEntries.startIdx>1&&(this.savedEntries.startIdx-=this.savedEntries.pageSize,this.fetchSavedRecordsPermaAndShowSummaryPopup(!1,SavedEntriesConstants.PREVIOUS))},ZFLive.resetCurrentRecordIdx=function(navDirection){navDirection===SavedEntriesConstants.PREVIOUS?this.savedEntries.currentIdx=this.savedEntries.recordsPerma.length-1:navDirection===SavedEntriesConstants.NEXT&&(this.savedEntries.currentIdx=0)},ZFLive.resetSavedEntriesMeta=function(){this.savedEntries=undefined},ZFLive.needToFetchSavedEntries=function(){return!this.isPublicFormAccess&&this.mode==Mode.LIVE&&"undefined"!=typeof this.showDraftEntriesPopup&&"true"==this.showDraftEntriesPopup},ZFLive.showSavedRecordErrorDiv=function(errorMsg){clearRecordSummaryTable(),$("#savedRecordSummaryDiv").find("div[elname=noSavedEntriesInfoDiv] span").text(errorMsg),$("#savedRecordSummaryDiv").find("div[elname=noSavedEntriesInfoDiv]").show(),this.initPaginationOnSavedEntriesReviewPopup($("div#savedEntriesReviewDiv"))},ZFLive.SavedEntriesAccessibilityUtil={draftEntriesSelectionPopup:$("#draftEntriesSelectionPopup"),draftEntriesSelectionPopupCont:$(this.draftEntriesSelectionPopup).find("div#draftEntriesSelectionPopupCont"),savedEntriesReviewDiv:$("div#savedEntriesReviewDiv"),savedEntriesReviewDivCont:$(this.savedEntriesReviewDiv).find("div#savedEntriesReviewDivCont"),savedRecordNavDiv:$(this.savedEntriesReviewDiv).find("div#savedEntryCont div#savedRecordNavDiv"),setAccessibilityToDraftSelectionPopup:function(){document.activeElement.blur();var elements=[$(this.draftEntriesSelectionPopupCont),$(this.draftEntriesSelectionPopupCont).find("div[entrytype=1]"),$(this.draftEntriesSelectionPopupCont).find("div[entrytype=2]")];$(this.draftEntriesSelectionPopupCont).focus(),ZFLive.handleTabKeyNavForCommonPopupCase($(this.draftEntriesSelectionPopup),elements,0,"keydown.draftentriesselectionpopup",!1)},setAccessibilityToSavedEntriesSummaryPopup:function(needToFocus){var elements=[];elements.push($(this.savedEntriesReviewDiv).find("div[elname=draftSummaryClose]")),"-1"!=$(this.savedRecordNavDiv).find("div#showPrevSavedEntry").attr("tabindex")&&elements.push($(this.savedRecordNavDiv).find("div#showPrevSavedEntry")),"-1"!=$(this.savedRecordNavDiv).find("div#showNextSavedEntry").attr("tabindex")&&elements.push($(this.savedRecordNavDiv).find("div#showNextSavedEntry")),elements.push($(this.savedRecordNavDiv).find("a[elname=editSavedRec]")),elements.push($(this.savedEntriesReviewDiv).find("div#savedEntryCont div#savedRecordSummaryDiv")),needToFocus&&$(this.savedEntriesReviewDiv).find("div[elname=draftSummaryClose]").focus(),ZFLive.handleTabKeyNavForCommonPopupCase($(this.savedEntriesReviewDivCont),elements,0,"keydown.savedentriessummarypopup",!1)},setAccessibilityAttrToDraftRecordPageNavigation:function(elem,pageStart,pageEnd){if(isAccessibilitySupported()){var prevBtnTxt="undefined"!=typeof this.draftRecordmoveto&&null!=this.draftRecordmoveto?this.draftRecordmoveto:i18n.draftsummaryrecmoveto,nextBtnTxt="undefined"!=typeof this.draftRecordsOutof&&null!=this.draftRecordsOutof?this.draftRecordsOutof:i18n.outof;$(elem).attr("aria-label",prevBtnTxt+" "+pageStart+" "+nextBtnTxt+" "+pageEnd)}},setAccessibilityAttrToSavedEntriesSummaryPopup:function(elem,updateAttr,removeAttr){$(elem).attr(updateAttr).removeAttr(removeAttr),this.setAccessibilityToSavedEntriesSummaryPopup(!1)},setAccessibilityToFormBody:function(){$(this.draftEntriesSelectionPopupCont).blur(),ZFLive.performFocusSettingOnInitialLoading()}},ZFLive.expandOrCollapseGridField=function(gridExpCollDiv){$(gridExpCollDiv).removeAttr("onclick");var gridFldLi=$(gridExpCollDiv).closest("div[elname=livefield-elem]"),columnContDiv=gridFldLi.find("div[elname=columnContDiv]");0==columnContDiv.length&&(columnContDiv=gridFldLi.find("div[elname=gridNoFieldDiv]"));var isexpanded=gridFldLi.attr("isexpanded");isexpanded==BooleanConstants.FALSE?(gridFldLi.attr("isexpanded",BooleanConstants.TRUE),$(gridExpCollDiv).removeClass("gridClose"),gridFldLi.find("div[elname=gridFieldError]").slideUp(),isAccessibilitySupported()&&$(gridExpCollDiv).attr("aria-expanded",!0),gridFldLi.find("div[elname=expandCollapseDivCont]").removeClass("gridErrDiv"),isAccessibilitySupported()||$(gridExpCollDiv).removeAttr("tabindex")):(gridFldLi.attr("isexpanded",BooleanConstants.FALSE),$(gridExpCollDiv).addClass("gridClose"),isAccessibilitySupported()&&$(gridExpCollDiv).attr("aria-expanded",!1),isAccessibilitySupported()||$(gridExpCollDiv).attr("tabindex","0"),$(gridExpCollDiv).on("keyup.expandGridField",function(event){event.keyCode===ZFKeyConstants.ENTER&&ZFLive.expandOrCollapseGridField(gridExpCollDiv)}));$(columnContDiv).slideToggle("slow",function(){if(isexpanded==BooleanConstants.FALSE){$(gridExpCollDiv).off("keyup.expandGridField");var firstGridFieldToBeFocussed=$(columnContDiv).find("div[elname=livefield-elem]:first"),gridIdAttr=gridFldLi.attr("id"),isFocusForError=!1;if(ZFLive.gridSubFieldsErrorList[gridIdAttr]!=undefined){var firstGridSubFldErrElemId=ZFLive.gridSubFieldsErrorList[gridIdAttr][0];firstGridFieldToBeFocussed=columnContDiv.find("#"+firstGridSubFldErrElemId),isFocusForError=!0}if(firstGridFieldToBeFocussed.length>0)new ZFLiveFieldFocusHander($(firstGridFieldToBeFocussed),isFocusForError).focusThisFieldElement();delete ZFLive.gridSubFieldsErrorList[gridIdAttr]}$(gridExpCollDiv).attr("onclick","ZFLive.expandOrCollapseGridField(this);"),triggerFormResize()})},ZFLive.showExceedChoiceRestrictonError=function(exceedFldsObj){$.each(exceedFldsObj,function(linkName,choiceIds){var parentElem=$("#"+linkName+"-li"),fieldType=$(parentElem).attr("comptype");$.each(choiceIds,function(index,id){if(typeof fieldType!==ResponseKey.UNDEFINED){if(parseInt(fieldType)==ZFFieldTypeConstants.DROPDOWN){var errorElm=$("#error-"+linkName),errorText=errorElm.text();ZFLive.updateAvailCntForSelect2Elem(parentElem,id),$(errorElm).hide().text(errorText).slideDown(),parentElem.addClass("error")}if(parseInt(fieldType)==ZFFieldTypeConstants.MULTIPLE_CHOICE&&(ZFLive.updateAvailCntForSelect2Elem(parentElem,id),parentElem.find("div[option_id="+id+"]").parent("li").addClass("resterror")),parseInt(fieldType)==ZFFieldTypeConstants.RADIO&&ZFLive.updateErrAvailCntForChoiceElm(parentElem,id),parseInt(fieldType)==ZFFieldTypeConstants.CHECKBOX&&ZFLive.updateErrAvailCntForChoiceElm(parentElem,id),parseInt(fieldType)==ZFFieldTypeConstants.IMAGE_CHOICE){var remainingText=parentElem.attr("remaining_text"),divElm=parentElem.find("div[option_id="+id+"]");divElm.addClass("resterror"),divElm.find('span[elname="remAvail"]').text("(0 "+remainingText+")")}}})})},ZFLive.updateAvailCntForSelect2Elem=function(parentElem,choiceId){var selectElm=parentElem.find("select");"true"==selectElm.attr("show_quantity")&&selectElm.find("option[option_id="+choiceId+"]").attr("available_val",0)},ZFLive.updateErrAvailCntForChoiceElm=function(parentElem,choiceId,spanElm){(spanElm=parentElem.find("input[option_id="+choiceId+"]").parent("span")).addClass("resterror");var remainingText=parentElem.find("div[elname=zfFieldDiv]").attr("remaining_text");spanElm.find("i[elname=remAvail]").text("(0 "+remainingText+")")},ZFCrmLive.prototype.getAndLoadCrmEntriesInSelectBox=function(searchIconElem){var zohoCrmSearchWrapperDiv=$(searchIconElem).closest('div[elname="zoho-crm-search-wrapper-div"]'),searchTextElem=$(zohoCrmSearchWrapperDiv).find(':text[elname="search-entry-input"]'),searchKey=$.trim($(searchTextElem).val()),zohoCrmFldLiElem=isNewHtmlDOM()?$(zohoCrmSearchWrapperDiv).closest('div[elname=livefield-elem][comptype="'+ZFFieldTypeConstants.ZOHO_CRM+'"]'):$(zohoCrmSearchWrapperDiv).closest('li[comptype="'+ZFFieldTypeConstants.ZOHO_CRM+'"]'),entryListingDiv=$('div[elname="crm-entry-listing-div"]'),errEntryParaTag=$(entryListingDiv).find('p[elname="err-entry"]');$(entryListingDiv).hide();var entryULElem=$(entryListingDiv).find('ul[elname="entry-ul"]');if($(entryULElem).empty(),searchKey.length>=2){if(this.processSearch){this.processSearch=!1,this.displaySearchingInteractionsForZohoCrmField(zohoCrmSearchWrapperDiv);var zohoCrmFldLinkName=$(zohoCrmFldLiElem).attr("compname"),ajaxOpts={URI:"/"+ZFLive.portalName+"/form_id/"+ZFLive.formID+"/field/"+zohoCrmFldLinkName+"/private/searchcrmentries?"+ParamKey.SEARCH_KEY+"="+encodeURIComponent(searchKey),METHOD:ZFHttp.GET,CALLBACK:function(jsonData,ajaxOpts,jqXhr){if($(errEntryParaTag).hide(),200===jqXhr.status){var entriesSummaryRespJsonArr=JSON.parse(jqXhr.responseText)[ZohoCrmFieldLiveConstants.RESP_KEYS.ENTRIES_SUMMARY];ZFCrmLive.zfCrmLive.loadCrmEntriesInSelectBox(entriesSummaryRespJsonArr,entryListingDiv)}else $(errEntryParaTag).text(i18n.zohocrmnoentries),$(errEntryParaTag).show();ZFCrmLive.zfCrmLive.setDropdownPosition(zohoCrmSearchWrapperDiv,searchTextElem,entryListingDiv),$(entryListingDiv).slideDown(200),ZFCrmLive.zfCrmLive.processSearch=!0,ZFCrmLive.zfCrmLive.hideSearchingInteractionsForZohoCrmField(zohoCrmSearchWrapperDiv)}};ZFUtil.sendAjax(ajaxOpts,this)}}else ZFCrmLive.zfCrmLive.setDropdownPosition(zohoCrmSearchWrapperDiv,searchTextElem,entryListingDiv),$(errEntryParaTag).text(i18n.zohocrmmintwochars),$(errEntryParaTag).show(),$(entryListingDiv).slideDown(200)},ZFCrmLive.prototype.setDropdownPosition=function(zohoCrmSearchWrapperDiv,searchTextElem,entryListingDiv){var searchWrapTop,searchWrapHeight;isNewHtmlDOM()?$(entryListingDiv).css("width",$(searchTextElem).outerWidth(!0)):$(entryListingDiv).css("width",$(searchTextElem).width()+73),searchWrapTop=$(zohoCrmSearchWrapperDiv).offset().top,searchWrapHeight=$(zohoCrmSearchWrapperDiv).height(),$(entryListingDiv).css("top",searchWrapTop+searchWrapHeight),$(entryListingDiv).css("left",$(searchTextElem).offset().left)},ZFCrmLive.prototype.displaySearchingInteractionsForZohoCrmField=function(zohoCrmSearchWrapperDiv){var searchIconElem=isNewHtmlDOM()?$(zohoCrmSearchWrapperDiv).find("icon[elname=search-icon]"):$(zohoCrmSearchWrapperDiv).find('span[elname="search-icon"]');$(searchIconElem).hide();var loadingSpan=$(zohoCrmSearchWrapperDiv).find('span[elname="loading-icon"]');$(loadingSpan).css("display","inline-block")},ZFCrmLive.prototype.hideSearchingInteractionsForZohoCrmField=function(zohoCrmSearchWrapperDiv){var loadingSpan=$(zohoCrmSearchWrapperDiv).find('span[elname="loading-icon"]');$(loadingSpan).hide();var searchIconElem=isNewHtmlDOM()?$(zohoCrmSearchWrapperDiv).find("icon[elname=search-icon]"):$(zohoCrmSearchWrapperDiv).find('span[elname="search-icon"]');$(searchIconElem).css("display","inline-block")},ZFCrmLive.prototype.loadCrmEntriesInSelectBox=function(entriesSummaryRespJsonArr,entryListingDiv){var entryULElem=$(entryListingDiv).find('ul[elname="entry-ul"]');if(0===entriesSummaryRespJsonArr.length){var errEntryParaTag=$(entryListingDiv).find('p[elname="err-entry"]');$(errEntryParaTag).text(i18n.zohocrmnoentries),$(errEntryParaTag).show()}else{for(var entryULElemToBeCloned=$(entryListingDiv).find('ul[elname="entry-ul-clone"]'),entryLiElemToBeCloned=$(entryULElemToBeCloned).find('li[elname="entry-li-clone"]'),entryInd=0;entryIndZFCharLimit.TRIMMED_DISP_NAME_LIMIT&&$(clonedEntryLiElem).attr("title",primaryFldValue),$(entryULElem).append(clonedEntryLiElem)}},ZFCrmLive.prototype.storeEntriesDetailsInJson=function(zohoCrmFldLinkName,entriesRespJson){this.zCrmFldDataJson=entriesRespJson.crmfld_data,this.zohoCrmFieldEntriesDetailsJson[zohoCrmFldLinkName]=entriesRespJson.prefill_data},ZFCrmLive.prototype.selectCrmEntry=function(entryLiElem){var zohoCrmFldLiElem=getZohoCrmFldLiElem(),zohoCrmFldLinkName=zohoCrmFldLiElem.attr("compname"),crmEntryId=$(entryLiElem).attr("entry_id"),getCrmRecordUri="/"+ZFLive.portalName+"/form_id/"+ZFLive.formID+"/field/"+zohoCrmFldLinkName+"/private/v1/getcrmrecord?record_id="+crmEntryId,self=this;showTransparentPageLoading();var ajaxOpts={URI:getCrmRecordUri,METHOD:ZFHttp.GET,CALLBACK:function(jsonData,ajaxOpts,jqXhr){if(200===jqXhr.status){self.showSelCrmEntry(entryLiElem);var zohoCrmSearchWrapperDiv=$(zohoCrmFldLiElem).find('div[elname="zoho-crm-search-wrapper-div"]'),searchTextElem=$(zohoCrmSearchWrapperDiv).find(':text[elname="search-entry-input"]');$(searchTextElem).val(""),$(zohoCrmSearchWrapperDiv).hide();var entryListingDiv=$(entryLiElem).closest('div[elname="crm-entry-listing-div"]'),entryULElem=$(entryListingDiv).find('ul[elname="entry-ul"]');$(entryULElem).empty(),$(entryListingDiv).hide(),isOneFieldForm()&&$(zohoCrmFldLiElem).find("div[elname=error]").text("").slideUp();var crmRecordResponseJson=JSON.parse(jqXhr.responseText);self.storeEntriesDetailsInJson(zohoCrmFldLinkName,crmRecordResponseJson),self.prefillFormAndSfFieldsNew(zohoCrmFldLiElem),hideTransparentPageLoading()}else{var crmErrPopup=$("#crmFldErrPopup");$(crmErrPopup).show(),isStandardForm()&&isEmbeddedForm()?setPopupPositionNearRefElem($("#crmFldErrPopup-cont"),$(zohoCrmFldLiElem),30,!0,!0):setPopUpElemPosition($("#crmFldErrPopup-cont")),$(crmErrPopup).find("div[elname=message]").text(i18n.errgettingcrmrecord),hideTransparentPageLoading()}}};ZFUtil.sendAjax(ajaxOpts,this)},ZFCrmLive.prototype.showSelCrmEntry=function(entryLiElem){var zohoCrmFldLiElem=getZohoCrmFldLiElem();$(zohoCrmFldLiElem).addClass("disabled");var zohoCrmDisplayWrapperDiv=$(zohoCrmFldLiElem).find('div[elname="zoho-crm-display-wrapper-div"]'),displayTextElem=$(zohoCrmDisplayWrapperDiv).find(':text[elname="display-entry-input"]'),selCrmEntryId=$(entryLiElem).attr("entry_id"),selCrmEntryValue=$(entryLiElem).text();$(displayTextElem).attr("entry_id",selCrmEntryId),$(displayTextElem).val(selCrmEntryValue),selCrmEntryValue.length>ZFCharLimit.TRIMMED_DISP_NAME_LIMIT&&$(displayTextElem).attr("title",selCrmEntryValue),$(zohoCrmDisplayWrapperDiv).show()},ZFCrmLive.prototype.checkMandatoryZohoCrmFld=function(zohoCrmFldLiElem){var zohoCrmDisplayWrapperDiv=$(zohoCrmFldLiElem).find('div[elname="zoho-crm-display-wrapper-div"]'),displayTextElem=$(zohoCrmDisplayWrapperDiv).find(':text[elname="display-entry-input"]');return""!==$(displayTextElem).attr("entry_id")},ZFCrmLive.prototype.constructZohoCrmFldDataJson=function(valueJson,zohoCrmFldLiElem,checkForParentLookUpDetails){var zohoCrmFldLinkName=$(zohoCrmFldLiElem).attr("compname"),zohoCrmDisplayWrapperDiv=$(zohoCrmFldLiElem).find('div[elname="zoho-crm-display-wrapper-div"]'),displayTextElem=$(zohoCrmDisplayWrapperDiv).find(':text[elname="display-entry-input"]'),selCrmEntryId=$(displayTextElem).attr("entry_id"),selCrmEntryValue=$(displayTextElem).val(),zohoCrmFldDataJson={};if(""!==selCrmEntryId){zohoCrmFldDataJson[ZohoCrmFieldLiveConstants.REQ_KEYS.ID]=selCrmEntryId,zohoCrmFldDataJson[ZohoCrmFieldLiveConstants.CRM_PROPS.NAME]=selCrmEntryValue;var selCrmParentLookupDetailsJson={},foundCrmParentLookupDetailsJson=!1;if(checkForParentLookUpDetails){var selCrmParentLookupDetailsJsonInString=$(displayTextElem).attr(ZohoCrmFieldLiveConstants.RESP_KEYS.PARENT_LOOKUP_DETAILS);""!==selCrmParentLookupDetailsJsonInString&&(selCrmParentLookupDetailsJson=JSON.parse(selCrmParentLookupDetailsJsonInString),foundCrmParentLookupDetailsJson=!0)}if(!foundCrmParentLookupDetailsJson){var parentLookupDetailsJson=this.zCrmFldDataJson[ZohoCrmFieldLiveConstants.RESP_KEYS.PARENT_LOOKUP_DETAILS];parentLookupDetailsJson!=undefined&&(selCrmParentLookupDetailsJson=parentLookupDetailsJson)}zohoCrmFldDataJson[ZohoCrmFieldLiveConstants.RESP_KEYS.PARENT_LOOKUP_DETAILS]=selCrmParentLookupDetailsJson}valueJson[zohoCrmFldLinkName]=zohoCrmFldDataJson},ZFCrmLive.prototype.removeCrmEntry=function(delIcon){var zohoCrmDisplayWrapperDiv=$(delIcon).closest('div[elname="zoho-crm-display-wrapper-div"]'),zohoCrmFldLiElem=isNewHtmlDOM()?$(zohoCrmDisplayWrapperDiv).closest('div[elname=livefield-elem][comptype="'+ZFFieldTypeConstants.ZOHO_CRM+'"]'):$(zohoCrmDisplayWrapperDiv).closest('li[comptype="'+ZFFieldTypeConstants.ZOHO_CRM+'"]');$(zohoCrmFldLiElem).removeClass("disabled");var zohoCrmSearchWrapperDiv=$(zohoCrmFldLiElem).find('div[elname="zoho-crm-search-wrapper-div"]');$(zohoCrmSearchWrapperDiv).show();var searchTextElem=$(zohoCrmSearchWrapperDiv).find(':text[elname="search-entry-input"]');$(searchTextElem).focus();var displayTextElem=$(zohoCrmDisplayWrapperDiv).find(':text[elname="display-entry-input"]');$(displayTextElem).attr("entry_id",""),$(displayTextElem).val(""),$(displayTextElem).attr(ZohoCrmFieldLiveConstants.RESP_KEYS.PARENT_LOOKUP_DETAILS,""),$(displayTextElem).removeAttr("title"),$(zohoCrmDisplayWrapperDiv).hide()},ZFCrmLive.prototype.triggerKeyupInCrmSearch=function(searchTextElem,event){var zohoCrmSearchWrapperDiv=$(searchTextElem).closest('div[elname="zoho-crm-search-wrapper-div"]'),entryListingDiv=$('div[elname="crm-entry-listing-div"]'),entryULElem=$(entryListingDiv).find('ul[elname="entry-ul"]'),isNavigation=!1;if($(entryListingDiv).is(":visible")&&$(entryULElem).find("li").length>0&&(event.keyCode===ZFKeyConstants.UP?(ZFUtil.focusPrevLIElem(entryULElem),isNavigation=!0):event.keyCode===ZFKeyConstants.DOWN?(ZFUtil.focusNextLIElem(entryULElem),isNavigation=!0):event.keyCode===ZFKeyConstants.ENTER&&(this.selectCrmEntry(ZFUtil.getSelectedLI(entryULElem)),isNavigation=!0)),!isNavigation){var searchIconElem=isNewHtmlDOM()?$(zohoCrmSearchWrapperDiv).find("icon[elname=search-icon]"):$(zohoCrmSearchWrapperDiv).find('span[elname="search-icon"]');""===$.trim($(searchTextElem).val())?$(searchIconElem).hide():$(searchIconElem).css("display","inline-block"),$(entryULElem).empty(),$(entryListingDiv).hide(),event.keyCode===ZFKeyConstants.ENTER&&this.getAndLoadCrmEntriesInSelectBox(searchIconElem)}},ZFCrmLive.prototype.focusZohoCrmField=function(zohoCrmFldLiElem){if($(zohoCrmFldLiElem).find("input:visible:first").prop("disabled"))isStandardForm()?$(zohoCrmFldLiElem).find("div[elname=error]").is(":visible")?$(zohoCrmFldLiElem)[0].scrollIntoView():$(ZFPageAnimation.scrollWindow).scrollTop(0):$(zohoCrmFldLiElem)[0].scrollIntoView();else{var zohoCrmSearchWrapperDiv=$(zohoCrmFldLiElem).find('div[elname="zoho-crm-search-wrapper-div"]');if($(zohoCrmSearchWrapperDiv).is(":visible")){var searchTextElem=$(zohoCrmSearchWrapperDiv).find(':text[elname="search-entry-input"]');$(searchTextElem).focus()}}},ZFCrmLive.prototype.getCrmRecordForPublicFormUsingCrmNewEncrStr=function(){var zohoCrmFldLinkName=getZohoCrmFldLiElem().attr("compname"),formPerma=document.getElementById("formPerma").value,getCrmRecordUri="/"+ZFLive.portalName+"/form_id/"+ZFLive.formID+"/formperma/"+formPerma+"/field/"+zohoCrmFldLinkName+"/public/v1/getcrmrecord?"+ParamKey.ZFCRM_ENTITY+"="+encodeURIComponent(ZFCrmLive.zfCrmLive.crmNewEncStr);this.getCrmRecordForPublicFormCommon(getCrmRecordUri)},ZFCrmLive.prototype.getCrmRecordForPublicForm=function(){var zohoCrmFldLinkName=getZohoCrmFldLiElem().attr("compname"),formPerma=document.getElementById("formPerma").value,getCrmRecordUri="/"+ZFLive.portalName+"/form_id/"+ZFLive.formID+"/formperma/"+formPerma+"/field/"+zohoCrmFldLinkName+"/public/v1/getcrmrecord?"+ParamKey.CRM_ENTITY_ID+"="+encodeURIComponent(ZFCrmLive.zfCrmLive.crmEncryptedRecordId)+"&"+ParamKey.CRM_ZSOID+"="+encodeURIComponent(ZFCrmLive.zfCrmLive.crmEncryptedZsoid);this.getCrmRecordForPublicFormCommon(getCrmRecordUri)},ZFCrmLive.prototype.getCrmRecordForPublicFormCommon=function(getCrmRecordUri){if(getCrmRecordUri!==undefined){var ajaxOpts={URI:getCrmRecordUri,METHOD:ZFHttp.POST,CALLBACK:function(jsonData,ajaxOpts,jqXhr){if(200===jqXhr.status){var crmRecordResponseJson=JSON.parse(jqXhr.responseText);ZFCrmLive.zfCrmLive.fillCrmFieldForPublicForm(crmRecordResponseJson)}}};ZFUtil.sendAjax(ajaxOpts,this)}},ZFCrmLive.prototype.fillCrmFieldForPublicForm=function(entriesRespJson){if(Object.keys(entriesRespJson).length>0){var zohoCrmFldLiElem=getZohoCrmFldLiElem(),zohoCrmFldLinkName=$(zohoCrmFldLiElem).attr("compname");ZFCrmLive.zfCrmLive.storeEntriesDetailsInJson(zohoCrmFldLinkName,entriesRespJson);var zohoCrmDisplayWrapperDiv=$(zohoCrmFldLiElem).find('div[elname="zoho-crm-display-wrapper-div"]'),displayTextElem=$(zohoCrmDisplayWrapperDiv).find(':text[elname="display-entry-input"]'),crmFldDataJson=entriesRespJson.crmfld_data,crmEntryId=crmFldDataJson.id,primaryFldValue=crmFldDataJson.name;$(displayTextElem).attr("entry_id",crmEntryId),$(displayTextElem).val(primaryFldValue),primaryFldValue.length>ZFCharLimit.TRIMMED_DISP_NAME_LIMIT&&$(displayTextElem).attr("title",primaryFldValue),this.prefillFormAndSfFieldsNew(zohoCrmFldLiElem)}},$(document).click(function(event){if(typeof ZFCrmLive.zfCrmLive!==ResponseKey.UNDEFINED){var zohoCrmFldLiElem=isOneFieldForm()?$("#slideContainer").find('div[elname="livefield-elem"][reltype="parent"][comptype="'+ZFFieldTypeConstants.ZOHO_CRM+'"]'):isStandardForm()?$('div[elname=livefield-elem][comptype="'+ZFFieldTypeConstants.ZOHO_CRM+'"]'):$('li[elname="livefield-elem"][comptype="'+ZFFieldTypeConstants.ZOHO_CRM+'"]');if(0!==$(zohoCrmFldLiElem).length){var zohoCrmSearchWrapperDiv=$(zohoCrmFldLiElem).find('div[elname="zoho-crm-search-wrapper-div"]');if(0!==$(zohoCrmSearchWrapperDiv).length){var entryListingDiv=$('div[elname="crm-entry-listing-div"]');if(0!==$(entryListingDiv).length&&$(entryListingDiv).is(":visible")&&0===$(event.target).closest('div[elname="zoho-crm-search-wrapper-div"]').length){var entryULElem=$(entryListingDiv).find('ul[elname="entry-ul"]');$(entryULElem).empty(),$(entryListingDiv).hide()}}}}}),ZFCrmLive.prototype.prefillFormAndSfFieldsNew=function(zohoCrmFldLiElem){var zohoCrmFldLinkName=zohoCrmFldLiElem.attr("compname"),entriesDetailsJson=this.zohoCrmFieldEntriesDetailsJson[zohoCrmFldLinkName];ZFLivePrefillUtil.prefillDataWithPostActions(entriesDetailsJson,!0,!1)},ZFLive.validateSubFormField=function(elem,addRangeErrClass){var linkname=$(elem).attr("linkname");"undefined"!=typeof ZFLive.sfUniqueValidator&&"undefined"!=typeof ZFLive.sfUniqueValidator[linkname]&&delete ZFLive.sfUniqueValidator[linkname];for(var validRowsArray=this.validateSubFormFieldCommonAndGetValidRows(elem),childrenCount=validRowsArray.length,sfUniqueCheckJson={},sfRowIndex=0;sfRowIndex0)for(var fldIdx=0;fldIdx0)for(fldIdx=0;fldIdxZFLive.subformMaxEntryLimit&&(maxEntryVal=ZFLive.subformMaxEntryLimit),minEntryVal>ZFLive.subformMaxEntryLimit&&(minEntryVal=ZFLive.subformMaxEntryLimit),minEntryVal>childrenCount?(1==minEntryVal?$(elem).find("#error-"+elemLinkName).text(i18n.subformentriesminlimit1).slideDown():$(elem).find("#error-"+elemLinkName).text(ZFUtil.replaceParams(i18n.subformentriesminlimit,minEntryVal)).slideDown(),this.changeErrArray(elemLinkName),addFieldToErrTrackFieldList(elem)):maxEntryValinitialErrorCount?("2"==sfViewType&&($(sfLi).find('div[elname="sfcardelem"][cardrowid="'+$(sfRow).attr("rowid")+'"]').find('[elname="sfCardInnerElem"]').addClass("sfCardError"),$(sfLi).find("#error-"+$(sfLi).attr("compname")).text(i18n.subformcarderrgeneral).show()),addFieldToErrTrackFieldList(sfLi)):"2"==sfViewType&&$(sfLi).find('div[elname="sfcardelem"][cardrowid="'+$(sfRow).attr("rowid")+'"]').find('[elname="sfCardInnerElem"]').removeClass("sfCardError")},ZFLive.doesSFChildHasEmptyVal=function(elem){var compname=$(elem).attr("compname"),comptype=parseInt($(elem).attr("comptype"));if(compname&&""!=compname)if(comptype==ZFFieldTypeConstants.FILE_UPLOAD||comptype==ZFFieldTypeConstants.IMAGE_UPLOAD||comptype==ZFFieldTypeConstants.MEDIA_UPLOAD){var totalfiles=$("#"+compname+"-div-files").find("ul[elname=fileElementUL]").find("li[name=singleFileElement]").length;if(isIELessThan10()||isWindowSafari()){var addFUDivnew=$(elem).find("div[elname=fileUploadDiv]").find('div[name="fileElementDiv"]'),file=$(addFUDivnew).find("div[elname=filePathSpan]").html();if(file=file.trim?file.trim():file.replace(/^\s+/,""),1==addFUDivnew.length&&""==file)return!0}else{var storedfiles=0;if(ZFLive.storedFiles[compname]!=undefined&&(storedfiles=Object.keys(ZFLive.storedFiles[compname]).length),totalfiles<=0&&storedfiles<=0)return!0}}else{if(comptype===ZFFieldTypeConstants.SIGNATURE)return!checkMandatorySignature(elem);if(comptype===ZFFieldTypeConstants.NAME||comptype===ZFFieldTypeConstants.ADDRESS){if(!doesAnyCompositeFieldHasValue(elem,comptype))return!0}else if(comptype===ZFFieldTypeConstants.SINGLE_LINE||comptype===ZFFieldTypeConstants.SLIDER||comptype===ZFFieldTypeConstants.NUMBER||comptype===ZFFieldTypeConstants.CURRENCY||comptype===ZFFieldTypeConstants.DECIMAL||comptype===ZFFieldTypeConstants.DATE||comptype===ZFFieldTypeConstants.MONTHYEAR||comptype===ZFFieldTypeConstants.DATETIME||comptype===ZFFieldTypeConstants.EMAIL||comptype===ZFFieldTypeConstants.WEBSITE){if(!checkMandatory(elem,comptype))return!0}else if(comptype===ZFFieldTypeConstants.PHONE){var checkEmpty=!0;if($(elem).find("input").each(function(index,inpElem){""==$.trim($(inpElem).val())||(checkEmpty=!1)}),checkEmpty)return!0}else if(comptype==ZFFieldTypeConstants.TIME){if(!doesAnyCompInTimeHasVal(elem))return!0}else if(comptype==ZFFieldTypeConstants.MULTI_LINE){if(!checkMandatoryTextArea(elem))return!0}else if(comptype==ZFFieldTypeConstants.DROPDOWN){if(!checkMandatoryDropDown(elem,compname))return!0}else if(comptype==ZFFieldTypeConstants.RATING){if(!checkMandatoryRating(elem))return!0}else if(comptype==ZFFieldTypeConstants.RADIO){if(!checkMandatoryRadio(elem))return!0}else if(comptype==ZFFieldTypeConstants.CHECKBOX||comptype==ZFFieldTypeConstants.DECISION_BOX){if(!checkMandatoryCheckBox(elem))return!0}else if(comptype==ZFFieldTypeConstants.MULTIPLE_CHOICE&&!checkMandatoryMultiSelect(elem))return!0}return!1},ZFSubFormLive.prototype.constructSubFormDataJson=function(valueJson,elem){var subformULIterator=isNewHtmlDOM()?$(elem).find("div[elname='subFormFieldsUl'][isvalidentry='true']"):$(elem).find("ul[elname='subFormFieldsUl'][isvalidentry='true']");$(subformULIterator).each(function(rowIndex,subFormRow){ZFSubFormLive.zfSubFormLive.subFormValueJson={};var crmRowId=$(subFormRow).attr("CRM_SF_ROW_ID");crmRowId!=undefined&&""!=crmRowId&&(ZFSubFormLive.zfSubFormLive.subFormValueJson.CRM_SF_ROW_ID=crmRowId);var subformChildIter=isNewHtmlDOM()?$(subFormRow).find('div[elname="livefield-elem"]'):$(subFormRow).children('li[elname="livefield-elem"]');$(subformChildIter).each(function(childIndex,childElem){var id=$(childElem).attr("id"),comptype=parseInt($(childElem).attr("comptype"));$(childElem).attr("compname");id&&"true"==$(childElem).attr("needdata")&&ZFSubFormLive.zfSubFormLive.constructSubFormDataJsonCommon(comptype,childElem)});var sfRowId=$(subFormRow).attr("sf_id");void 0!==sfRowId&&""!=sfRowId&&(ZFSubFormLive.zfSubFormLive.subFormValueJson.sf_id=sfRowId),ZFSubFormLive.zfSubFormLive.subFormValueArray.push(ZFSubFormLive.zfSubFormLive.subFormValueJson)}),valueJson[$(elem).attr("compname")]=ZFSubFormLive.zfSubFormLive.subFormValueArray},ZFSubFormLive.prototype.constructSubFormDataJsonReview=function(valueJson,elem){var subformULIterator,subFormRowValues=[],subFormRowJson={};subformULIterator=isNewHtmlDOM()?$(elem).find("div[elname='subFormFieldsUl'][isempty='false']"):$(elem).find("ul[elname='subFormFieldsUl'][isempty='false']"),$(subformULIterator).each(function(rowIndex,subFormRow){ZFSubFormLive.zfSubFormLive.subFormReviewJson={};var subformChildIter,subFormFieldArray=[];subformChildIter=isNewHtmlDOM()?$(subFormRow).find('div[elname="livefield-elem"][isvisible=true][needdata=true]'):$(subFormRow).children('li[elname="livefield-elem"][isvisible=true][needdata=true]'),$(subformChildIter).each(function(childIndex,childElem){ZFSubFormLive.zfSubFormLive.subFormFieldJson={};var comptype=parseInt($(childElem).attr("comptype")),compname=$.trim($(childElem).attr("compname")),showFldLabel=$(childElem).attr("showlabel");if("true"===showFldLabel||showFldLabel===undefined)ZFSubFormLive.zfSubFormLive.subFormFieldJson.display_name=isNewHtmlDOM()?$.trim($(childElem).find("label:first").children("span").text()):$.trim($(childElem).children("label").children("span").text()),comptype===ZFFieldTypeConstants.PHONE&&(ZFSubFormLive.zfSubFormLive.subFormFieldJson.phoneFormat=$.trim($(childElem).find("div[elname=phoneFormatElem]").attr("phoneformat")));else if(comptype!==ZFFieldTypeConstants.NAME&&comptype!==ZFFieldTypeConstants.ADDRESS)if(comptype===ZFFieldTypeConstants.MULTI_LINE)ZFSubFormLive.zfSubFormLive.subFormFieldJson.display_name=$.trim($(childElem).find("textarea").attr("placeholder"));else if(comptype===ZFFieldTypeConstants.PHONE)ZFSubFormLive.zfSubFormLive.subFormFieldJson.display_name=$.trim($(childElem).find("div[elname=phoneFld]").find("input").attr("placeholder")),ZFSubFormLive.zfSubFormLive.subFormFieldJson.phoneFormat=$.trim($(childElem).find("div[elname=phoneFormatElem]").attr("phoneformat"));else if(comptype===ZFFieldTypeConstants.EMAIL)ZFSubFormLive.zfSubFormLive.subFormFieldJson.display_name=$.trim($(childElem).find("span[elname=livefield-email-elem]").find("input").attr("placeholder"));else if(comptype===ZFFieldTypeConstants.DROPDOWN)if(isNewHtmlDOM()){var selectElem=$(childElem).find("select");""!=(placeholderText=$(selectElem).attr("zfs2_placeholder"))&&(ZFSubFormLive.zfSubFormLive.subFormFieldJson.display_name=$.trim(placeholderText))}else{var placeholderText;selectElem=$(childElem).find("select option[value=-Select-]");(placeholderText=$(selectElem).attr("isplaceholder"))!==undefined&&placeholderText&&(ZFSubFormLive.zfSubFormLive.subFormFieldJson.display_name=$.trim($(selectElem).text()))}else ZFSubFormLive.zfSubFormLive.subFormFieldJson.display_name=$.trim($(childElem).find("input").attr("placeholder"));ZFSubFormLive.zfSubFormLive.subFormFieldJson.compname=compname,ZFSubFormLive.zfSubFormLive.subFormFieldJson.comptype=comptype,ZFSubFormLive.zfSubFormLive.subFormFieldJson.ismandatory=$(childElem).attr("mandatory"),constructFormFieldDataJsonCommon(ZFSubFormLive.zfSubFormLive.subFormFieldJson,childElem,!0),comptype===ZFFieldTypeConstants.FORMULA&&constructNormalField(ZFSubFormLive.zfSubFormLive.subFormFieldJson,childElem),subFormFieldArray.push(ZFSubFormLive.zfSubFormLive.subFormFieldJson)}),ZFSubFormLive.zfSubFormLive.subFormReviewJson.fields=subFormFieldArray,subFormRowValues.push(ZFSubFormLive.zfSubFormLive.subFormReviewJson)}),subFormRowJson.rows=subFormRowValues,valueJson.value=subFormRowJson},ZFSubFormLive.prototype.constructConfirmationDetailsForBackUpData=function(childElem){var actualCompName=ZFSubFormLive.zfSubFormLive.getActualCompName($(childElem).attr("compname"));ZFSubFormLive.zfSubFormLive.subFormValueJson[actualCompName]={},ZFSubFormLive.zfSubFormLive.subFormValueJson[actualCompName].value=$.trim($(childElem).find('input[name="'+$(childElem).attr("compname")+'"]').val()),"true"==$(childElem).attr("need_reconf")&&(ZFSubFormLive.zfSubFormLive.subFormValueJson[actualCompName].reconfirm=$.trim($(childElem).find('input[name="'+$(childElem).attr("compname")+'-reconf"]').val()))},ZFSubFormLive.prototype.constructBackUpDataForPopUp=function(subFormRow,isEntryDuplicate){ZFSubFormLive.zfSubFormLive.subFormValueJson={};var subformULIterator=isNewHtmlDOM()?$(subFormRow).find('div[elname="livefield-elem"]'):$(subFormRow).children('li[elname="livefield-elem"]');$(subformULIterator).each(function(childIndex,childElem){var id=$(childElem).attr("id"),comptype=parseInt($(childElem).attr("comptype")),compname=$(childElem).attr("compname");if(id)if(comptype==ZFFieldTypeConstants.SINGLE_LINE||comptype==ZFFieldTypeConstants.WEBSITE)ZFSubFormLive.zfSubFormLive.constructNormalField(childElem);else if(comptype==ZFFieldTypeConstants.NUMBER||comptype==ZFFieldTypeConstants.DECIMAL||comptype==ZFFieldTypeConstants.CURRENCY)isEntryDuplicate?ZFSubFormLive.zfSubFormLive.constructConfirmationDetailsForBackUpData(childElem):ZFSubFormLive.zfSubFormLive.constructNormalField(childElem);else if(comptype==ZFFieldTypeConstants.MULTI_LINE)ZFSubFormLive.zfSubFormLive.constructTextArea(childElem);else if(comptype==ZFFieldTypeConstants.DATE)ZFSubFormLive.zfSubFormLive.constructDate(childElem);else if(comptype==ZFFieldTypeConstants.MONTHYEAR)ZFSubFormLive.zfSubFormLive.constructMonthYear(childElem);else if(comptype===ZFFieldTypeConstants.DATETIME)ZFSubFormLive.zfSubFormLive.constructDateTime(childElem);else if(comptype==ZFFieldTypeConstants.TIME){var actualCompName=ZFSubFormLive.zfSubFormLive.getActualCompName($(childElem).attr("compname")),hours=$(childElem).find('select[timecomp="hours"]').val(),minutes=$(childElem).find('select[timecomp="minutes"]').val(),meridian=$(childElem).find('select[timecomp="Meridiem"]').val(),timeVal={};timeVal.hours=hours,timeVal.minutes=minutes,typeof meridian!==undefined&&(timeVal.meridian=meridian),ZFSubFormLive.zfSubFormLive.subFormValueJson[actualCompName]=timeVal}else if(comptype==ZFFieldTypeConstants.NAME)ZFSubFormLive.zfSubFormLive.constructName(childElem);else if(comptype==ZFFieldTypeConstants.ADDRESS)ZFSubFormLive.zfSubFormLive.constructAddress(childElem,!0);else if(comptype==ZFFieldTypeConstants.EMAIL)isEntryDuplicate?ZFSubFormLive.zfSubFormLive.constructConfirmationDetailsForBackUpData(childElem):ZFSubFormLive.zfSubFormLive.constructEmailField(childElem);else if(comptype==ZFFieldTypeConstants.PHONE)if(isEntryDuplicate)ZFSubFormLive.zfSubFormLive.constructPhoneFieldDataForEntryDuplicate($(childElem));else{var linkName=$(childElem).attr("compname"),phoneJson=(actualCompName=ZFSubFormLive.zfSubFormLive.getActualCompName(linkName),{});if("INTERNATIONAL"==$(childElem).find('[elname="phoneFormatElem"]').attr("phoneformat")){var phoneInp=$(childElem).find("input"),phoneval=$(phoneInp).val(),countryIsoCode="";if("true"==$(phoneInp).attr("iscodeEnabled")){phoneJson.isCodeEnabled=!0;var selectedCountryData=$(childElem).find("#"+linkName).intlTelInput("getSelectedCountryData"),countryCode=selectedCountryData.dialCode;void 0!==countryCode&&null!=countryCode&&(phoneval="+"+countryCode+phoneval,countryIsoCode=getPhoneIsoCodeFromCountry(selectedCountryData))}else phoneJson.isCodeEnabled=!1;phoneJson.value=phoneval,phoneJson.country_iso_code=countryIsoCode}else phoneJson.countrycode=$(childElem).find('[elname="countrycode"]').val(),phoneJson.first=$(childElem).find('[elname="first"]').val(),phoneJson.second=$(childElem).find('[elname="second"]').val();ZFSubFormLive.zfSubFormLive.subFormValueJson[actualCompName]=phoneJson}else comptype==ZFFieldTypeConstants.DROPDOWN?$(childElem).find("select[name='"+compname+"']").each(function(indexelem,elemnew){var actualCompName=ZFSubFormLive.zfSubFormLive.getActualCompName($(elemnew).attr("name")),selectVal=$(elemnew).val();if(null==selectVal&&(selectVal="-Select-"),ZFSubFormLive.zfSubFormLive.subFormValueJson[actualCompName]=selectVal,"-Select-"!=selectVal)if("zfs-others-zfs"==selectVal)ZFSubFormLive.zfSubFormLive.subFormValueJson[actualCompName]=$(childElem).find("input[name=allow-others-text]").val();else if($(elemnew).find("optgroup").length>0){var groupName=getGroupValueofSelectedChoice(elemnew,compname);ZFSubFormLive.zfSubFormLive.subFormValueJson[actualCompName+"_group_name"]=groupName}}):comptype==ZFFieldTypeConstants.RADIO?ZFSubFormLive.zfSubFormLive.constructRadio(childElem):comptype==ZFFieldTypeConstants.CHECKBOX?ZFSubFormLive.zfSubFormLive.constructCheckBox(childElem):comptype==ZFFieldTypeConstants.MULTIPLE_CHOICE?ZFSubFormLive.zfSubFormLive.constructMultiSelect(childElem):comptype==ZFFieldTypeConstants.DECISION_BOX?ZFSubFormLive.zfSubFormLive.constructDecision(childElem):comptype==ZFFieldTypeConstants.RATING?ZFSubFormLive.zfSubFormLive.constructRating(childElem):comptype==ZFFieldTypeConstants.SLIDER?ZFSubFormLive.zfSubFormLive.constructSlider(childElem):comptype==ZFFieldTypeConstants.DECIMAL||comptype==ZFFieldTypeConstants.CURRENCY?ZFSubFormLive.zfSubFormLive.constructNormalField(childElem):comptype==ZFFieldTypeConstants.SIGNATURE&&(isEntryDuplicate||ZFSubFormLive.zfSubFormLive.constructSignature(childElem,!0))}),ZFSubFormLive.zfSubFormLive.addressMap={},ZFSubFormLive.zfSubFormLive.addressMap=JSON.parse(JSON.stringify(ZFLive.mapPlacesJson))},ZFSubFormLive.prototype.constructPhoneFieldDataForEntryDuplicate=function(childElem){var linkName=$(childElem).attr("compname"),actualCompName=ZFSubFormLive.zfSubFormLive.getActualCompName(linkName),phoneFormatElem=$(childElem).find('[elname="phoneFormatElem"]'),phoneJson={},isCountryCodeEnabled=!1;if("INTERNATIONAL"==phoneFormatElem.attr("phoneformat")){var phoneInp=$(childElem).find('[elname="phoneFld"]').find("input"),phoneval=$(phoneInp).val(),countryIsoCode="",isCodeEnabled=$(phoneInp).attr("iscodeEnabled");if(isCountryCodeEnabled=isCodeEnabled,"true"==isCodeEnabled)phoneJson.isCodeEnabled=!0,void 0!==(countryCode=(selectedCountryData=$(phoneInp).intlTelInput("getSelectedCountryData")).dialCode)&&null!=countryCode&&(phoneval="+"+countryCode+phoneval,countryIsoCode=getPhoneIsoCodeFromCountry(selectedCountryData));else phoneJson.isCodeEnabled=!1;phoneJson.value=phoneval,phoneJson.country_iso_code=countryIsoCode}else{var pgoneFieldCont=$(childElem).find('[elname="phoneFld"]');phoneJson.countrycode=$(pgoneFieldCont).find('[elname="countrycode"]').val(),phoneJson.first=$(pgoneFieldCont).find('[elname="first"]').val(),phoneJson.second=$(pgoneFieldCont).find('[elname="second"]').val()}if(ZFSubFormLive.zfSubFormLive.subFormValueJson[actualCompName]={},ZFSubFormLive.zfSubFormLive.subFormValueJson[actualCompName].value=phoneJson,"true"==$(childElem).attr("need_reconf")){phoneJson={};if("INTERNATIONAL"==phoneFormatElem.attr("phoneformat")){var selectedCountryData,countryCode;phoneInp=$(childElem).find('[elname="confPhoneFld"]').find("input"),phoneval=$(phoneInp).val(),countryIsoCode="";if("true"==isCountryCodeEnabled)phoneJson.isCodeEnabled=!0,void 0!==(countryCode=(selectedCountryData=$(phoneInp).intlTelInput("getSelectedCountryData")).dialCode)&&null!=countryCode&&(phoneval="+"+countryCode+phoneval,countryIsoCode=getPhoneIsoCodeFromCountry(selectedCountryData));else phoneJson.isCodeEnabled=!1;phoneJson.value=phoneval,phoneJson.country_iso_code=countryIsoCode}else{var phoneReconfirmCont=$(childElem).find('[elname="confPhoneFld"]');phoneJson.countrycode=$(phoneReconfirmCont).find('[elname="countrycode"]').val(),phoneJson.first=$(phoneReconfirmCont).find('[elname="first"]').val(),phoneJson.second=$(phoneReconfirmCont).find('[elname="second"]').val()}ZFSubFormLive.zfSubFormLive.subFormValueJson[actualCompName].reconfirm=phoneJson}},ZFSubFormLive.prototype.constructSubFormDataJsonCommon=function(comptype,childElem){var compname=$(childElem).attr("compname");comptype==ZFFieldTypeConstants.SINGLE_LINE||comptype==ZFFieldTypeConstants.NUMBER||comptype==ZFFieldTypeConstants.WEBSITE?ZFSubFormLive.zfSubFormLive.constructNormalField(childElem):comptype==ZFFieldTypeConstants.MULTI_LINE?ZFSubFormLive.zfSubFormLive.constructTextArea(childElem):comptype==ZFFieldTypeConstants.DATE?ZFSubFormLive.zfSubFormLive.constructDate(childElem):comptype==ZFFieldTypeConstants.MONTHYEAR?ZFSubFormLive.zfSubFormLive.constructMonthYear(childElem):comptype===ZFFieldTypeConstants.DATETIME?ZFSubFormLive.zfSubFormLive.constructDateTime(childElem):comptype==ZFFieldTypeConstants.TIME?ZFSubFormLive.zfSubFormLive.constructTime(childElem):comptype==ZFFieldTypeConstants.NAME?ZFSubFormLive.zfSubFormLive.constructName(childElem):comptype==ZFFieldTypeConstants.ADDRESS?ZFSubFormLive.zfSubFormLive.constructAddress(childElem,!1):comptype==ZFFieldTypeConstants.EMAIL?ZFSubFormLive.zfSubFormLive.constructEmailField(childElem):comptype==ZFFieldTypeConstants.PHONE?ZFSubFormLive.zfSubFormLive.constructPhone(childElem):comptype==ZFFieldTypeConstants.DROPDOWN?ZFSubFormLive.zfSubFormLive.constructDropdown(childElem,compname):comptype==ZFFieldTypeConstants.RADIO?ZFSubFormLive.zfSubFormLive.constructRadio(childElem):comptype==ZFFieldTypeConstants.CHECKBOX?ZFSubFormLive.zfSubFormLive.constructCheckBox(childElem):comptype==ZFFieldTypeConstants.MULTIPLE_CHOICE?ZFSubFormLive.zfSubFormLive.constructMultiSelect(childElem):comptype==ZFFieldTypeConstants.DECISION_BOX?ZFSubFormLive.zfSubFormLive.constructDecision(childElem):comptype==ZFFieldTypeConstants.FILE_UPLOAD||comptype==ZFFieldTypeConstants.IMAGE_UPLOAD||comptype==ZFFieldTypeConstants.MEDIA_UPLOAD?ZFLive.isOldUploadType?ZFSubFormLive.zfSubFormLive.constructFileUpload(childElem):ZFSubFormLive.zfSubFormLive.constructFileUpload_New(childElem):comptype==ZFFieldTypeConstants.RATING?ZFSubFormLive.zfSubFormLive.constructRating(childElem):comptype==ZFFieldTypeConstants.SLIDER?ZFSubFormLive.zfSubFormLive.constructSlider(childElem):comptype==ZFFieldTypeConstants.DECIMAL||comptype==ZFFieldTypeConstants.CURRENCY?ZFSubFormLive.zfSubFormLive.constructDecimalField(childElem):comptype==ZFFieldTypeConstants.SIGNATURE&&ZFSubFormLive.zfSubFormLive.constructSignature(childElem,!1)},ZFSubFormLive.prototype.setBackedUpValueToFields=function(subFormParentLi,subFormRow,isEntryDuplicate){var sfViewType=$(subFormParentLi).attr("viewtype"),subformChildIter=isNewHtmlDOM()?$(subFormRow).find('div[elname="livefield-elem"]'):$(subFormRow).children('li[elname="livefield-elem"]');$(subformChildIter).each(function(childIndex,childElem){var id=$(childElem).attr("id"),comptype=parseInt($(childElem).attr("comptype")),compname=$(childElem).attr("compname"),linkname=ZFSubFormLive.zfSubFormLive.getActualCompName(compname);$(childElem).attr("needdata");if(id)if(comptype==ZFFieldTypeConstants.SINGLE_LINE||comptype==ZFFieldTypeConstants.WEBSITE||comptype==ZFFieldTypeConstants.DATE||comptype==ZFFieldTypeConstants.MONTHYEAR||comptype===ZFFieldTypeConstants.DATETIME)$(childElem).find("input").val(ZFSubFormLive.zfSubFormLive.subFormValueJson[linkname]);else if(comptype==ZFFieldTypeConstants.EMAIL||comptype==ZFFieldTypeConstants.NUMBER||comptype==ZFFieldTypeConstants.DECIMAL||comptype==ZFFieldTypeConstants.CURRENCY){var needReconf=$(childElem).attr("need_reconf");isEntryDuplicate?($(childElem).find("input[name='"+compname+"']").val(ZFSubFormLive.zfSubFormLive.subFormValueJson[linkname].value),"true"==needReconf&&"undefined"!=typeof ZFSubFormLive.zfSubFormLive.subFormValueJson[linkname].reconfirm&&$(childElem).find("input[name='"+compname+"-reconf']").val(ZFSubFormLive.zfSubFormLive.subFormValueJson[linkname].reconfirm)):$(childElem).find("input").val(ZFSubFormLive.zfSubFormLive.subFormValueJson[linkname]),"true"==needReconf&&$(childElem).find('[elname="livefield-reconf-elem"]').find("input").blur()}else if(comptype==ZFFieldTypeConstants.MULTI_LINE)$(childElem).find("textarea").val(ZFSubFormLive.zfSubFormLive.subFormValueJson[linkname]);else if(comptype==ZFFieldTypeConstants.TIME)$(childElem).find('select[timecomp="hours"]').val(ZFSubFormLive.zfSubFormLive.subFormValueJson[linkname].hours),$(childElem).find('select[timecomp="minutes"]').val(ZFSubFormLive.zfSubFormLive.subFormValueJson[linkname].minutes),needToTriggerSelect2ChangeInSubForm(sfViewType)&&($(childElem).find('select[timecomp="hours"]').trigger("change.select2"),$(childElem).find('select[timecomp="minutes"]').trigger("change.select2")),$(childElem).find('select[timecomp="Meridiem"]').length>0&&($(childElem).find('select[timecomp="Meridiem"]').val(ZFSubFormLive.zfSubFormLive.subFormValueJson[linkname].meridian),needToTriggerSelect2ChangeInSubForm(sfViewType)&&$(childElem).find('select[timecomp="Meridiem"]').trigger("change.select2"));else if(comptype==ZFFieldTypeConstants.ADDRESS){var nameValJson=ZFSubFormLive.zfSubFormLive.subFormValueJson[linkname],stateFldType=$(childElem).attr("statefldtype");if($.each(nameValJson,function(key,val){if($(childElem).find("[complink='"+key+"']").is("select")){if(""==val&&(val="-Select-"),-1!=key.indexOf(ZFFormField.ADDRESS.COUNTRY.KEY)&&stateFldType==AddrStateFldInputType.DROPDOWN){var addrCountryFld=$(childElem).find("[complink='"+key+"']");val!=$(addrCountryFld).val()||isEntryDuplicate?($(childElem).find("[complink='"+key+"']").val(val),ZFLive.updateStateChoicesListForAddrStateDd($(childElem).find("[complink='"+key+"']"))):$(childElem).find("[complink='"+key+"']").val(val)}else if(-1!=key.indexOf(ZFFormField.ADDRESS.STATE.KEY)){$(childElem).find("[complink='"+key+"']").val(val);var addrStateFld=$(childElem).find("[complink='"+key+"']");if(val!=$(addrStateFld).val()){var newOption=new Option(val,val);$(newOption).attr("selected","true"),$(newOption).attr("lwrvalue",val.toLowerCase()),$(newOption).attr("isprevval","true"),$(addrStateFld).children("option").eq(0).after(newOption)}}else $(childElem).find("[complink='"+key+"']").val(val);needToTriggerSelect2ChangeInSubForm(sfViewType)&&$(childElem).find("[complink='"+key+"']").trigger("change.select2")}else $(childElem).find("[complink='"+key+"']").val(val)}),comptype==ZFFieldTypeConstants.ADDRESS){var mapElem=$(childElem).find("a[elname=mapLink]");if(mapElem.length>0){var mapLinkName=$(childElem).attr("mapLinkName");if(nameValJson.hasOwnProperty(mapLinkName)){var mapDetailsJson=nameValJson[mapLinkName];ZFMapUtil.setResponseInMapLink(childElem,mapDetailsJson)}else mapElem.removeAttr("place_id"),mapElem.removeAttr("lat"),mapElem.removeAttr("lon"),mapElem.removeAttr("label"),$(childElem).find("div[elname=mapResponseDiv]").text("")}}}else if(comptype==ZFFieldTypeConstants.NAME){var selectComponentVal,selectComponentLinkName;nameValJson=ZFSubFormLive.zfSubFormLive.subFormValueJson[linkname];$.each(nameValJson,function(key,val){$(childElem).find("[complink='"+key+"']").is("select")?(selectComponentVal=""==val?"-Select-":val,selectComponentLinkName=key):$(childElem).find("[complink='"+key+"']").val(val)}),typeof selectComponentLinkName!=ResponseKey.UNDEFINED&&($(childElem).find("[complink='"+selectComponentLinkName+"']").val(selectComponentVal),needToTriggerSelect2ChangeInSubForm(sfViewType)&&$(childElem).find("[complink='"+selectComponentLinkName+"']").trigger("change.select2"))}else if(comptype==ZFFieldTypeConstants.PHONE)if(isEntryDuplicate)ZFSubFormLive.zfSubFormLive.setPhoneBackUpValueToFieldOnDup($(childElem),linkname,compname);else{var phoneFormatElem=$(childElem).find('[elname="phoneFormatElem"]'),phoneJson=ZFSubFormLive.zfSubFormLive.subFormValueJson[linkname];needReconf=$(childElem).attr("need_reconf");if("INTERNATIONAL"==phoneFormatElem.attr("phoneformat"))if(phoneJson.isCodeEnabled){var phoneInpElem=$(childElem).find('[elname="phoneFld"]').find("#"+compname);$(phoneInpElem).intlTelInput("setNumber",phoneJson.value);var countryIsoCode=phoneJson.country_iso_code;if(void 0!==countryIsoCode&&""!=countryIsoCode&&$(phoneInpElem).intlTelInput("setCountry",countryIsoCode),"true"==needReconf){var phoneReconfInpElem=$(childElem).find('[elname="confPhoneFld"]').find("input");$(phoneReconfInpElem).intlTelInput("setNumber",phoneJson.value).blur(),void 0!==countryIsoCode&&""!=countryIsoCode&&$(phoneReconfInpElem).intlTelInput("setCountry",countryIsoCode).blur()}}else $(childElem).find('[elname="phoneFld"]').find("#"+compname).val(phoneJson.value),"true"==needReconf&&$(childElem).find('[elname="confPhoneFld"]').find("input").val(phoneJson.value).blur();else{var sfPhoneFld=$(childElem).find('[elname="phoneFld"]');if($(sfPhoneFld).find('[elname="countrycode"]').val(phoneJson.countrycode),$(sfPhoneFld).find('[elname="first"]').val(phoneJson.first),$(sfPhoneFld).find('[elname="second"]').val(phoneJson.second),"true"==needReconf){var sfConfPhoneFld=$(childElem).find('[elname="confPhoneFld"]');$(sfConfPhoneFld).find('[elname="countrycode"]').val(phoneJson.countrycode),$(sfConfPhoneFld).find('[elname="first"]').val(phoneJson.first),$(sfConfPhoneFld).find('[elname="second"]').val(phoneJson.second).blur()}}}else if(comptype==ZFFieldTypeConstants.DROPDOWN){var optGroupName=ZFSubFormLive.zfSubFormLive.subFormValueJson[linkname+"_group_name"],selectVal=ZFSubFormLive.zfSubFormLive.subFormValueJson[linkname],selectElem=$(childElem).find("select[name='"+compname+"']");if(void 0!==optGroupName)ZFUtil.selectChoiceInOptGroup(selectElem,optGroupName,selectVal);else{var selectOthersOption=$(selectElem).find('option[value="zfs-others-zfs"]'),otherOptionDiv=$(childElem).find('div[elname="allow-others-div"]');$(selectOthersOption).length>0&&($(otherOptionDiv).find("input[name=allow-others-text]").val(""),$(otherOptionDiv).hide());var selectedChoiceElem=ZFUtil.getSelectedOptionElem(selectElem,"value",selectVal);void 0!==selectedChoiceElem?$(selectedChoiceElem).prop("selected",!0):$(selectOthersOption).length>0?($(selectElem).val("zfs-others-zfs"),$(childElem).find("input[name=allow-others-text]").val(selectVal),$(childElem).find('div[elname="allow-others-div"]').show()):$(selectElem).val("-Select-")}needToTriggerSelect2ChangeInSubForm(sfViewType)&&$(childElem).find("select[name='"+compname+"']").trigger("change.select2")}else if(comptype==ZFFieldTypeConstants.RADIO){var radioElems=$(childElem).find(':radio[elname="'+compname+'"]');$(radioElems).prop("checked",!1);var othersSpan=$(childElem).find("span[elname=allow-others-span]");if(0!==$(othersSpan).length&&($(othersSpan).find("input[name=allow-others-text]").val(""),$(othersSpan).find(':radio[elname="radio-input"]').prop("checked",!1)),isNewHtmlDOM()||($(radioElems).attr("isSelected",!1),0!==$(othersSpan).length&&$(othersSpan).find(':radio[elname="radio-input"]').attr("isSelected",!1)),""!=(selectVal=ZFSubFormLive.zfSubFormLive.subFormValueJson[linkname])){var selectedRadioElem=ZFUtil.getSelectedChoiceElem(radioElems,"value",selectVal),isOthersValueSelected=!1;void 0!==selectedRadioElem?$(selectedRadioElem).prop("checked",!0):0!==$(othersSpan).length&&($(othersSpan).find("input[name=allow-others-text]").val(selectVal),$(othersSpan).find(':radio[elname="radio-input"]').prop("checked",!0),isOthersValueSelected=!0),isNewHtmlDOM()&&($(othersSpan).removeClass("otherChoiceAnimate"),$(childElem).find('span[elname="choiceSpan"]').removeClass("selectedChoice"),isOthersValueSelected?($(othersSpan).addClass("otherChoiceAnimate"),$(othersSpan).addClass("selectedChoice")):($(othersSpan).removeClass("otherChoiceAnimate"),$(othersSpan).removeClass("selectedChoice"),void 0!==selectedRadioElem&&selectChoice($(selectedRadioElem)))),isNewHtmlDOM()||(isOthersValueSelected?$(othersSpan).find(':radio[elname="radio-input"]').attr("isSelected",!0):$(selectedRadioElem).attr("isSelected",!0))}}else if(comptype==ZFFieldTypeConstants.CHECKBOX){selectVal=ZFSubFormLive.zfSubFormLive.subFormValueJson[linkname];var checkBoxElems=$(childElem).find("input[name='"+compname+"']");othersSpan=$(childElem).find("span[elname=allow-others-span]");0!==$(othersSpan).length&&($(othersSpan).find("input[name=allow-others-text]").val(""),$(othersSpan).find(':checkbox[elname="checkbox-input"]').prop("checked",!1)),$(checkBoxElems).prop("checked",!1);var selectedCbElemArr=[];isOthersValueSelected=!1;if(""!=selectVal)for(var index=0;index0){var maplinkName=$(elem).attr("mapLinkName"),mapResponseDiv=$(elem).find("div[elname=mapResponseDiv]");ZFLive.constructAddressMapDetails(addressJsonObj,maplinkName,mapResponseDiv)}}else ZFLive.checkAndConstructAddressMapDetails(elem,addressJsonObj);var actualCompName=this.getActualCompName($(elem).attr("compname")),placeid=$(elem).attr("placeid");addressJsonObj.place_id=placeid,this.subFormValueJson[actualCompName]=addressJsonObj},ZFSubFormLive.prototype.constructEmailField=function(elem){$(elem).find("input").each(function(indexelem,elemnew){"false"==$(elem).attr("isvisible")&&$(elemnew).val($(elemnew).attr("initalValue"));var actualCompName=ZFSubFormLive.zfSubFormLive.getActualCompName($(elem).attr("compname"));ZFSubFormLive.zfSubFormLive.subFormValueJson[actualCompName]=$.trim($(elemnew).val())})},ZFSubFormLive.prototype.constructPhone=function(elem){var phoneval="",linkName=$(elem).attr("compname");$(elem).find("div[elname=phoneFld]").find("input").each(function(indexelem,elemnew){"false"==$(elem).attr("isvisible")&&$(elemnew).val($(elemnew).attr("initalValue"));var val=$.trim($(elemnew).val());phoneval+=val});var actualCompName=this.getActualCompName($(elem).attr("compname"));if(this.subFormValueJson[actualCompName]=phoneval,"true"==$(elem).find("div[elname=phoneFld]").find("input").attr("iscodeEnabled")){var countryCode="",isoCode="";if(""!=phoneval){var selectedCountryData=$(elem).find("#"+linkName).intlTelInput("getSelectedCountryData");null!=(countryCode=selectedCountryData.dialCode)?(countryCode="+"+countryCode,isoCode=getPhoneIsoCodeFromCountry(selectedCountryData)):countryCode=""}this.subFormValueJson[actualCompName+"_country_code"]=countryCode,this.subFormValueJson[actualCompName+"_country_iso_code"]=isoCode}},ZFSubFormLive.prototype.constructDropdown=function(elem,fldLinkName){$(elem).find("select[name='"+fldLinkName+"']").each(function(indexelem,elemnew){var actualCompName=ZFSubFormLive.zfSubFormLive.getActualCompName($(elemnew).attr("name"));"-Select-"==$(elemnew).val()?ZFSubFormLive.zfSubFormLive.subFormValueJson[actualCompName]="":"zfs-others-zfs"==$(elemnew).val()?ZFSubFormLive.zfSubFormLive.subFormValueJson[actualCompName]=$(elem).find("input[name=allow-others-text]").val():(ZFSubFormLive.zfSubFormLive.subFormValueJson[actualCompName]=$(elemnew).val(),$(elemnew).find("optgroup").length>0&&(ZFSubFormLive.zfSubFormLive.subFormValueJson[actualCompName+"_group_name"]=getGroupValueofSelectedChoice(elemnew)))})},ZFSubFormLive.prototype.constructRadio=function(elem){var value="";$(elem).find("input[type=radio]").each(function(indexelem,elemnew){$(elemnew).is(":checked")&&(value=$(elemnew).attr("allowothers")?$(elem).find("input[name=allow-others-text]").val():$(elemnew).attr("value"))});var actualCompName=this.getActualCompName($(elem).attr("compname"));this.subFormValueJson[actualCompName]=value},ZFSubFormLive.prototype.constructCheckBox=function(elem){var checkboxJsonArr=[],actualCompName=this.getActualCompName($(elem).attr("compname"));$(elem).find("input[type=checkbox]").each(function(indexelem,elemnew){var val;$(elemnew).is(":checked")&&($(elemnew).attr("allowothers")?(val=$.trim($(elem).find("input[name=allow-others-text]").val())).length>0&&checkboxJsonArr.push(val):(val=$(elemnew).attr("value"),checkboxJsonArr.push(val)))}),checkboxJsonArr.length>0?this.subFormValueJson[actualCompName]=checkboxJsonArr:this.subFormValueJson[actualCompName]=""},ZFSubFormLive.prototype.constructMultiSelect=function(elem){var multiJsonArr=[],actualCompName=this.getActualCompName($(elem).attr("compname"));$(elem).find("select").each(function(indexelem,elemnew){var id=$(elemnew).attr("id");if(id!=undefined){for(var txtSelectedObj=document.getElementById(id),i=0;i0?ZFSubFormLive.zfSubFormLive.subFormValueJson[actualCompName]=multiJsonArr:ZFSubFormLive.zfSubFormLive.subFormValueJson[actualCompName]=""}})},ZFSubFormLive.prototype.constructDecision=function(elem){$(elem).find("input").each(function(indexelem,elemnew){var val=$(elemnew).is(":checked");val=val?"true":"false";var namenew=ZFSubFormLive.zfSubFormLive.getActualCompName($(elemnew).attr("name"));ZFSubFormLive.zfSubFormLive.subFormValueJson[namenew]=val})},ZFSubFormLive.prototype.constructFileUpload=function(elem){var filepatharr=[],namenew=($(elem).attr("comptype"),ZFSubFormLive.zfSubFormLive.getActualCompName($(elem).attr("compname")));if(isIELessThan10()||isWindowSafari()){var fileElement=$(elem).find("div[name=fileElementDiv]");if(1==fileElement.length){var previousfile=$(fileElement).find("div[elname=filePathSpan]").html();""==(previousfile=previousfile.trim?previousfile.trim():previousfile.replace(/^\s+/,""))?ZFSubFormLive.zfSubFormLive.subFormValueJson[namenew+"-v1"]="":""!=$(fileElement).attr("filepath")&&(filepatharr.push($(fileElement).attr("filepath")),ZFSubFormLive.zfSubFormLive.subFormValueJson[namenew+"-v1"]=filepatharr)}else $(elem).find("div[name=fileElementDiv]").each(function(indexelem,elemnew){""!=$(elemnew).attr("filepath")&&filepatharr.push($(elemnew).attr("filepath"))}),ZFSubFormLive.zfSubFormLive.subFormValueJson[namenew+"-v1"]=filepatharr}else $(elem).find("input[elname="+$(elem).attr("compname")+"]").each(function(indexelem,elemnew){var value=$(elemnew).attr("filepath");if(""!=value){for(var splittedArr=value.split(","),index=0;index0?0==$(subFormElem).find("[elname=subFormFieldsCloneUl]").find("[needdata=true]").length&&($(subFormElem).find("[elname=subFormAllFieldsDiv]").hide(),$(subFormElem).find("[elname=subformNoFieldDiv]").show()):0==$(subFormElem).find("[elname=subFormFieldsUl]").find("[needdata=true]").length&&($(subFormElem).find("[elname=subFormAllFieldsDiv]").hide(),$(subFormElem).find("[elname=subformNoFieldDiv]").show())}else{var hiddenElem=isStandardForm()?$(fldLinkElem).find("div[elname=fieldHiddenDiv]"):$(fldLinkElem).find("div[elemname=fieldHiddenDiv]"),fldelem=isStandardForm()?$(fldLinkElem).find("div[elname=zfFieldDiv]"):$(fldLinkElem).find("div[elemname=fieldContentDiv]");$(hiddenElem).attr("style",$(fldLinkElem).find("div[elemname=fieldContentDiv]").attr("style")).show(),$(fldelem).hide(),fldLinkElem.hide(),isAnySubFormFieldPresentAfterRuleExec(fldLnkName)?($("#label_"+fldLnkName+"-li").show(),getFieldElemWithFldLinkNameAttr(fldLnkName).show()):($("#label_"+fldLnkName+"-li").hide(),getFieldElemWithFldLinkNameAttr(fldLnkName).hide()),$(subFormElem).find("[elname=subFormFieldsCloneUl]").length>0?0==$(subFormElem).find("[elname=subFormFieldsCloneUl]").find("[needdata=true]").length&&($(subFormElem).find("[elname=subFormAllFieldsDiv]").hide(),$(subFormElem).find("[elname=subformNoFieldDiv]").show()):0==$(subFormElem).find("[elname=subFormFieldsUl]").find("[needdata=true]").length&&($(subFormElem).find("[elname=subFormAllFieldsDiv]").hide(),$(subFormElem).find("[elname=subformNoFieldDiv]").show())}}else isOneFieldForm()?showOrHideZFSlide(fldLinkElem,!1):isStandardForm()&&typeof ZFPageAnimation!=ResponseKey.UNDEFINED?fldLinkElem.fadeOut(ZFPageAnimation.fieldFadeOutSpeed):fldLinkElem.hide()}if(rulAct==ZFRuleConstants.HIDE){previousState=getFieldVisibilityState(fldLinkElem);if(fldLinkElem.attr("needdata",!0),checkAndAddFieldsInFieldVisibilityChangeList(ruleResultObj,fldLnkName,previousState,fldLinkElem),isSubFormActionField){if(fldLinkElem.show(),isSubFormPopup(fldLnkName)){var sfCardElem;subFormElem=getParentSubFormElem(fldLnkName),$(subFormElem).attr("linkname");if(sfCardElem=rowId!=undefined?$(subFormElem).find("div[cardrowid="+rowId+"]").find("div[linkname="+fldLnkName+"]"):$(subFormElem).find("div[elname=sfCardInnerElem]").find("div[linkname="+fldLnkName+"]"),$(sfCardElem).show(),isOneFieldForm()){sfPopupUl=$(fldLinkElem).closest("div[elname=subFormFieldsUl]");updateSubformFieldsSeqNumber(sfPopupUl)}}else{hiddenElem=isStandardForm()?$(fldLinkElem).find("div[elname=fieldHiddenDiv]"):$(fldLinkElem).find("div[elemname=fieldHiddenDiv]"),fldelem=isStandardForm()?$(fldLinkElem).find("div[elname=zfFieldDiv]"):$(fldLinkElem).find("div[elemname=fieldContentDiv]");$(hiddenElem).hide(),$(fldelem).show(),isAnySubFormFieldPresentAfterRuleExec(fldLnkName)&&(getFieldElemWithFldLinkNameAttr(fldLnkName).show(),$("#label_"+fldLnkName+"-li").show())}subFormElem=getParentSubFormElem(fldLnkName);$(subFormElem).find("[elname=subFormAllFieldsDiv]").show(),$(subFormElem).find("[elname=subformNoFieldDiv]").hide()}else isOneFieldForm()?showOrHideZFSlide(fldLinkElem,!0):isStandardForm()&&typeof ZFPageAnimation!=ResponseKey.UNDEFINED?fldLinkElem.fadeIn(ZFPageAnimation.fieldFadeInSpeed):fldLinkElem.show()}}}function evalRuleActions(rulActObj){for(var x in rulActObj){var fldLnkName=rulActObj[x][ZFRuleConstants.ACTION_LINK_NAME],fldLinkElem=getFieldElem(fldLnkName);rulActObj[x][ZFRuleConstants.RULE_ACTION]==ZFRuleConstants.SHOW?fldLinkElem.show().attr("needdata",!0):rulActObj[x][ZFRuleConstants.RULE_ACTION]==ZFRuleConstants.HIDE&&fldLinkElem.hide().attr("needdata",!1)}}function evaluateRule(elem,from,evalAllRulesArr,groupActionVisibleHiddenJsonObj,ruleResultObj){var compType=parseInt($(elem).attr("comptype")),encryptionFldType=parseInt($(elem).attr("encryptionfldtype"));33===compType&&(encryptionFldType==EncryptionFieldType.SINGLE_LINE||encryptionFldType==EncryptionFieldType.NUMBER)||27===compType||1===compType||3===compType||4===compType||5===compType||7===compType||9===compType||10===compType||11===compType||20===compType||26===compType||16===compType||37==compType?from===RULE_FROM_CONST.PRE_EVAL&&"true"==checkAndReturnNeedDataAttr(elem)?zf_rule.evalRules($(elem).find("input:first"),evalAllRulesArr,groupActionVisibleHiddenJsonObj,ruleResultObj):from===RULE_FROM_CONST.EVAL&&zf_rule.evalRules($(elem).find("input:first"),evalAllRulesArr,groupActionVisibleHiddenJsonObj,ruleResultObj):2==compType||33===compType&&encryptionFldType==EncryptionFieldType.MULTI_LINE?from===RULE_FROM_CONST.PRE_EVAL&&"true"==checkAndReturnNeedDataAttr(elem)?zf_rule.evalRules($(elem).find("textarea:first"),evalAllRulesArr,groupActionVisibleHiddenJsonObj,ruleResultObj):from===RULE_FROM_CONST.EVAL&&zf_rule.evalRules($(elem).find("textarea:first"),evalAllRulesArr,groupActionVisibleHiddenJsonObj,ruleResultObj):21===compType||23===compType?from===RULE_FROM_CONST.PRE_EVAL&&"true"==checkAndReturnNeedDataAttr(elem)?zf_rule.evalRules($(elem).find("a:first"),evalAllRulesArr,groupActionVisibleHiddenJsonObj,ruleResultObj):from===RULE_FROM_CONST.EVAL&&zf_rule.evalRules($(elem).find("a:first"),evalAllRulesArr,groupActionVisibleHiddenJsonObj,ruleResultObj):6==compType||12==compType||15==compType?from===RULE_FROM_CONST.PRE_EVAL&&"true"==checkAndReturnNeedDataAttr(elem)?zf_rule.evalRules($(elem).find("select:first"),evalAllRulesArr,groupActionVisibleHiddenJsonObj,ruleResultObj):from===RULE_FROM_CONST.EVAL&&zf_rule.evalRules($(elem).find("select:first"),evalAllRulesArr,groupActionVisibleHiddenJsonObj,ruleResultObj):13==compType||14==compType||18==compType||34==compType?from===RULE_FROM_CONST.PRE_EVAL&&"true"==checkAndReturnNeedDataAttr(elem)?zf_rule.evalRules($(elem).find("input:first"),evalAllRulesArr,groupActionVisibleHiddenJsonObj,ruleResultObj):from===RULE_FROM_CONST.EVAL&&zf_rule.evalRules($(elem).find("input:first"),evalAllRulesArr,groupActionVisibleHiddenJsonObj,ruleResultObj):29==compType?from===RULE_FROM_CONST.PRE_EVAL&&"true"==checkAndReturnNeedDataAttr(elem)?zf_rule.evalRules($(elem).find("div[elname=imageChoiceEle]:first"),evalAllRulesArr,groupActionVisibleHiddenJsonObj,ruleResultObj):from===RULE_FROM_CONST.EVAL&&zf_rule.evalRules($(elem).find("div[elname=imageChoiceEle]:first"),evalAllRulesArr,groupActionVisibleHiddenJsonObj,ruleResultObj):30==compType?from===RULE_FROM_CONST.PRE_EVAL&&"true"==checkAndReturnNeedDataAttr(elem)?zf_rule.evalRules($(elem).find("input").eq(0),evalAllRulesArr,groupActionVisibleHiddenJsonObj,ruleResultObj):from===RULE_FROM_CONST.EVAL&&zf_rule.evalRules($(elem).find("input").eq(0),evalAllRulesArr,groupActionVisibleHiddenJsonObj,ruleResultObj):8===compType?from===RULE_FROM_CONST.PRE_EVAL&&"true"==checkAndReturnNeedDataAttr(elem)?zf_rule.evalRules(elem,evalAllRulesArr,groupActionVisibleHiddenJsonObj,ruleResultObj):from===RULE_FROM_CONST.EVAL&&zf_rule.evalRules(elem,evalAllRulesArr,groupActionVisibleHiddenJsonObj,ruleResultObj):25===compType&&(from===RULE_FROM_CONST.PRE_EVAL&&"true"==checkAndReturnNeedDataAttr(elem)?zf_rule.evalRules(elem,evalAllRulesArr,groupActionVisibleHiddenJsonObj,ruleResultObj):from===RULE_FROM_CONST.EVAL&&zf_rule.evalRules(elem,evalAllRulesArr,groupActionVisibleHiddenJsonObj,ruleResultObj))}function evalAction(actionObj,fldLnkName,rulAct,evalAllRulesArr,groupActionVisibleHiddenJsonObj,rowId,ruleResultObj){var fldLinkElem,isSubFormActionField=isSubFormField(fldLnkName);if(fldLinkElem=isSubFormActionField?rowId!=undefined?getFieldElem(fldLnkName+"_"+rowId):getFieldElemWithFldLinkNameAttr(fldLnkName):getFieldElem(fldLnkName),ZFUtil.isFieldVisible(fldLinkElem)){if(rulAct==ZFRuleConstants.SHOW){var previousState=getFieldVisibilityState(fldLinkElem);if(fldLinkElem.attr("needdata",!0),checkAndAddFieldsInFieldVisibilityChangeList(ruleResultObj,fldLnkName,previousState,fldLinkElem),isSubFormActionField){var subFormElem=getParentSubFormElem(fldLnkName);if(isSubFormPopup(fldLnkName)){$(subFormElem).attr("linkname");if(sfCardElem=rowId!=undefined?$(subFormElem).find("div[cardrowid="+rowId+"]").find("div[linkname="+fldLnkName+"]"):$(subFormElem).find("div[elname=sfCardInnerElem]").find("div[linkname="+fldLnkName+"]"),$(sfCardElem).show(),fldLinkElem.show(),isOneFieldForm()){var sfPopupUl=$(fldLinkElem).closest("div[elname=subFormFieldsUl]");updateSubformFieldsSeqNumber(sfPopupUl)}}else{var hiddenElem=isStandardForm()?$(fldLinkElem).find("div[elname=fieldHiddenDiv]"):$(fldLinkElem).find("div[elemname=fieldHiddenDiv]"),fldelem=isStandardForm()?$(fldLinkElem).find("div[elname=zfFieldDiv]"):$(fldLinkElem).find("div[elemname=fieldContentDiv]");$(hiddenElem).hide(),$(fldelem).show(),fldLinkElem.show(),isAnySubFormFieldPresentAfterRuleExec(fldLnkName)&&(getFieldElemWithFldLinkNameAttr(fldLnkName).show(),$("#label_"+fldLnkName+"-li").show())}$(subFormElem).find("[elname=subFormAllFieldsDiv]").show(),$(subFormElem).find("[elname=subformNoFieldDiv]").hide()}else isOneFieldForm()?showOrHideZFSlide(fldLinkElem,!0):isStandardForm()&&typeof ZFPageAnimation!=ResponseKey.UNDEFINED?fldLinkElem.fadeIn(ZFPageAnimation.fieldFadeInSpeed):fldLinkElem.show();25===parseInt($(fldLinkElem).attr("comptype"))?setWidthForSignatureElem(fldLinkElem):30===parseInt($(fldLinkElem).attr("comptype"))&&isStandardForm()&&(setMatrixWidth($(fldLinkElem)),setMatrixHeight($(fldLinkElem)))}else if(rulAct==ZFRuleConstants.HIDE){previousState=getFieldVisibilityState(fldLinkElem);if(fldLinkElem.attr("needdata",!1),checkAndAddFieldsInFieldVisibilityChangeList(ruleResultObj,fldLnkName,previousState,fldLinkElem),isSubFormActionField){subFormElem=getParentSubFormElem(fldLnkName);if(isSubFormPopup(fldLnkName)){var sfCardElem;subFormElem=getParentSubFormElem(fldLnkName),$(subFormElem).attr("linkname");if(sfCardElem=rowId!=undefined?$(subFormElem).find("div[cardrowid="+rowId+"]").find("div[linkname="+fldLnkName+"]"):$(subFormElem).find("div[elname=sfCardInnerElem]").find("div[linkname="+fldLnkName+"]"),$(sfCardElem).hide(),fldLinkElem.hide(),isOneFieldForm()){sfPopupUl=$(fldLinkElem).closest("div[elname=subFormFieldsUl]");updateSubformFieldsSeqNumber(sfPopupUl)}$(subFormElem).find("[elname=subFormFieldsCloneUl]").length>0?0==$(subFormElem).find("[elname=subFormFieldsCloneUl]").find("[needdata=true]").length&&($(subFormElem).find("[elname=subFormAllFieldsDiv]").hide(),$(subFormElem).find("[elname=subformNoFieldDiv]").show()):0==$(subFormElem).find("[elname=subFormFieldsUl]").find("[needdata=true]").length&&($(subFormElem).find("[elname=subFormAllFieldsDiv]").hide(),$(subFormElem).find("[elname=subformNoFieldDiv]").show())}else{hiddenElem=isStandardForm()?$(fldLinkElem).find("div[elname=fieldHiddenDiv]"):$(fldLinkElem).find("div[elemname=fieldHiddenDiv]"),fldelem=isStandardForm()?$(fldLinkElem).find("div[elname=zfFieldDiv]"):$(fldLinkElem).find("div[elemname=fieldContentDiv]");$(hiddenElem).attr("style",$(fldLinkElem).find("div[elemname=fieldContentDiv]").attr("style")).show(),$(fldelem).hide(),isAnySubFormFieldPresentAfterRuleExec(fldLnkName)?($("#label_"+fldLnkName+"-li").show(),getFieldElemWithFldLinkNameAttr(fldLnkName).show()):($("#label_"+fldLnkName+"-li").hide(),getFieldElemWithFldLinkNameAttr(fldLnkName).hide()),$(subFormElem).find("[elname=subFormFieldsCloneUl]").length>0?0==$(subFormElem).find("[elname=subFormFieldsCloneUl]").find("[needdata=true]").length&&($(subFormElem).find("[elname=subFormAllFieldsDiv]").hide(),$(subFormElem).find("[elname=subformNoFieldDiv]").show()):0==$(subFormElem).find("[elname=subFormFieldsUl]").find("[needdata=true]").length&&($(subFormElem).find("[elname=subFormAllFieldsDiv]").hide(),$(subFormElem).find("[elname=subformNoFieldDiv]").show())}}else isOneFieldForm()?showOrHideZFSlide(fldLinkElem,!1):isStandardForm()&&typeof ZFPageAnimation!=ResponseKey.UNDEFINED?fldLinkElem.fadeOut(ZFPageAnimation.fieldFadeOutSpeed):fldLinkElem.hide()}isAdvancedRule()||("gridField"==$(fldLinkElem).attr("elemtype")?$(fldLinkElem).find("[elname=livefield-elem]").each(function(gridIndex,gridElem){getCompName(gridElem);evaluateRule($(gridElem),RULE_FROM_CONST.EVAL,evalAllRulesArr,groupActionVisibleHiddenJsonObj,ruleResultObj)}):evaluateRule($(fldLinkElem),RULE_FROM_CONST.EVAL,evalAllRulesArr,groupActionVisibleHiddenJsonObj,ruleResultObj))}}function evalSetMandatoryAction(fldLnkName,result,rowId,componentLinkName){var fldLinkElem,isSubFormActionField=isSubFormField(fldLnkName);if(fldLinkElem=isSubFormActionField?rowId!=undefined?getFieldElem(fldLnkName+"_"+rowId):getFieldElemWithFldLinkNameAttr(fldLnkName):getFieldElem(fldLnkName),ZFUtil.isFieldVisible(fldLinkElem)){var fieldType=parseInt($(fldLinkElem).attr("comptype"));if(result){if($(fldLinkElem).attr("mandatory",!0),"false"!=$(fldLinkElem).attr("showlabel"))if(isSubFormActionField)setMandatorySymbolToSubFormELem(fldLinkElem,fldLnkName);else if($(fldLinkElem).find("em.important").length>0)$(fldLinkElem).find("em.important").show();else{var emElem=document.createElement("em");if($(emElem).addClass("important").text(" *"),fieldType==ZFFieldTypeConstants.DECISION_BOX)$(fldLinkElem).find("span[elname=display_name]").length>0&&$(fldLinkElem).find("span[elname=display_name]")[0].appendChild(emElem);else{var labelElem=isNewHtmlDOM()?"label.fieldlabel":"label.labelName";$(fldLinkElem).find(labelElem).length>0&&$(fldLinkElem).find(labelElem)[0].appendChild(emElem)}}if(fieldType==ZFFieldTypeConstants.ADDRESS||fieldType==ZFFieldTypeConstants.NAME?($(fldLinkElem).find("input[complink="+componentLinkName+"]").attr("mandatory",!0),$(fldLinkElem).find("select[complink="+componentLinkName+"]").attr("mandatory",!0)):0==fieldType&&"PaymentAmount"==$(fldLinkElem).attr("compname")&&$(fldLinkElem).find("div[elname=merchantDiv]").attr("mandatory",!0),isSubFormActionField&&!isSubFormPopup(fldLnkName)&&rowId!=undefined)if(typeof ZFLive!=ResponseKey.UNDEFINED)showRulesMandatoryError(ZFLive.errorId($(fldLinkElem).attr("compname")),fieldType,$(fldLinkElem).attr("compname"))}else{var needToHideMandatorySymbol=!0;if(fieldType==ZFFieldTypeConstants.ADDRESS||fieldType==ZFFieldTypeConstants.NAME?($(fldLinkElem).find("input[complink="+componentLinkName+"]").attr("mandatory",!1),$(fldLinkElem).find("select[complink="+componentLinkName+"]").attr("mandatory",!1),$(fldLinkElem).find("input[mandatory=true]").length>0&&(needToHideMandatorySymbol=!1)):0==fieldType&&"PaymentAmount"==$(fldLinkElem).attr("compname")&&$(fldLinkElem).find("div[elname=merchantDiv]").attr("mandatory",!1),needToHideMandatorySymbol)if($(fldLinkElem).attr("mandatory",!1),isSubFormActionField)if(isSubFormPopup(fldLnkName))unSetMandatorySymbolToSubFormELem(fldLinkElem,fldLnkName);else{if(typeof ZFLive!=ResponseKey.UNDEFINED)hideRulesMandatoryError(ZFLive.errorId($(fldLinkElem).attr("compname")));isAnySubFormFieldHasMandatoryAfterRuleExec(fldLnkName)||unSetMandatorySymbolToSubFormELem(fldLinkElem,fldLnkName)}else $(fldLinkElem).find("em.important").hide()}}}function evalGroupAction(fldLnkName,rulAct,groupActionVisibleHiddenJsonObj,isDepRuleShowAllGroup){if(rulAct==ZFRuleConstants.SHOW_GROUP){if(isDepRuleShowAllGroup){if(!(groupActionShowObj=groupActionVisibleHiddenJsonObj[ZFRuleConstants.HIDE_GROUP]).hasOwnProperty(fldLnkName)){var grpNameArray=[];groupActionShowObj[fldLnkName]=grpNameArray}}else if(!(groupActionShowObj=groupActionVisibleHiddenJsonObj[ZFRuleConstants.SHOW_GROUP]).hasOwnProperty(fldLnkName)){grpNameArray=[];groupActionShowObj[fldLnkName]=grpNameArray}}else if(rulAct==ZFRuleConstants.HIDE_GROUP){var groupActionShowObj;if(!(groupActionShowObj=groupActionVisibleHiddenJsonObj[ZFRuleConstants.HIDE_GROUP]).hasOwnProperty(fldLnkName)){grpNameArray=[];groupActionShowObj[fldLnkName]=grpNameArray}}}function performShowHideGroupActionsInSelectFields(groupActionVisibleHiddenJsonObj){evalDependentGroupAction(groupActionVisibleHiddenJsonObj,getFieldsInvolvedInGroupAction(groupActionVisibleHiddenJsonObj)),showOrHideOptionGroupBasedOnRules(groupActionVisibleHiddenJsonObj)}function performShowHideGroupActions(currRule,groupActionVisibleHiddenJsonObj){for(var x in currRule.actionsObj){var currRuleActionObj=currRule.actionsObj[x],rulAct=currRuleActionObj[ZFRuleConstants.RULE_ACTION],fldLnkName=currRuleActionObj[ZFRuleConstants.ACTION_LINK_NAME];if(rulAct==ZFRuleConstants.SHOW_GROUP){var groupActionShowObj=groupActionVisibleHiddenJsonObj[ZFRuleConstants.SHOW_GROUP];if(groupActionShowObj.hasOwnProperty(fldLnkName)){var grpNameArray=groupActionShowObj[fldLnkName];if(currRuleActionObj.hasOwnProperty(ZFRuleConstants.FIELD.OPT_GROUP_NAME))addGrpNameToArray(currRuleActionObj[ZFRuleConstants.FIELD.OPT_GROUP_NAME],grpNameArray);else if(currRuleActionObj.hasOwnProperty(ZFRuleConstants.FIELD.OPT_GROUP_NAMES)){var optionGroupArr=currRuleActionObj[ZFRuleConstants.FIELD.OPT_GROUP_NAMES];if(optionGroupArr.length>0&&optionGroupArr[0]!=ZFRuleConstants.DEPENDENCY_RULE.SHOW_ALL_CHOICES&&optionGroupArr[0]!=ZFRuleConstants.DEPENDENCY_RULE.HIDE_ALL_CHOICES)for(var optNameItr=0;optNameItr0){showOptGroupInDropdown(fldLinkElem,$(fldLinkElem).attr("compname"),grpNameArray);var subFormElem=getParentSubFormElem(fldLinkName);resetSfCardSummaryForOptGroup(fldLinkName,fldElem,subFormElem,rowId)}}),isSubFormPopup(fldLinkName)&&rowId==undefined){var subFormFldElem=$("#subFormPopUp").find("[linkname="+fldLinkName+"]");$(subFormFldElem).is(":visible")&&showOptGroupInDropdown(subFormFldElem,$(subFormFldElem).attr("compname"),grpNameArray)}}else showOptGroupInDropdown(fldElem,fldLinkName,grpNameArray)}else if(grpAction==ZFRuleConstants.HIDE_GROUP)for(var fldLinkName in fieldsObjInvolvedInGroupAction){var fldElem;grpNameArray=fieldsObjInvolvedInGroupAction[fldLinkName];if(fldElem=rowId!=undefined?getFieldElem(fldLinkName+"_"+rowId):getFieldElemWithFldLinkNameAttr(fldLinkName),isSubFormField(fldLinkName)){if($(fldElem).each(function(index,fldLinkElem){if($(fldLinkElem).closest("[elname=subFormFieldsUl]").length>0){hideOptGroupInDropdown(fldLinkElem,$(fldLinkElem).attr("compname"),grpNameArray);var subFormElem=getParentSubFormElem(fldLinkName);resetSfCardSummaryForOptGroup(fldLinkName,fldElem,subFormElem,rowId)}}),isSubFormPopup(fldLinkName)&&rowId==undefined){subFormFldElem=$("#subFormPopUp").find("[linkname="+fldLinkName+"]");$(subFormFldElem).is(":visible")&&hideOptGroupInDropdown(subFormFldElem,$(subFormFldElem).attr("compname"),grpNameArray)}}else hideOptGroupInDropdown(fldElem,fldLinkName,grpNameArray)}}function clearSelectFieldInputIfHidden(fldLinkElem,fldLinkName,selectedInp,selectedGroupName){var visibleChoicesList;visibleChoicesList=getVisibleChoicesFromField(fldLinkElem,fldLinkName),visibleGroupList=getVisibleGroupFromField(fldLinkElem,fldLinkName);var selectElem=$(fldLinkElem).find('select[name="'+fldLinkName+'"]');if("-Select-"==selectedInp||-1!=$.inArray(selectedInp,visibleChoicesList)&&-1!=$.inArray(selectedGroupName,visibleGroupList)){if(-1!=$.inArray(selectedInp,visibleChoicesList)&&-1!=$.inArray(selectedGroupName,visibleGroupList))ZFUtil.selectChoiceInOptGroup(selectElem,selectedGroupName,selectedInp),typeof ZFLive!=ResponseKey.UNDEFINED&&$(selectElem).hasClass("select2-hidden-accessible")&&$(selectElem).trigger("change.select2");else if("prefill_tmpelm"===selectElem.attr("tmp_attr_name")){var zfPrefillOptVal=selectElem.attr("prefill_tmp_val"),attrName=selectElem.attr("prefill_tmp_search_attr");if(typeof zfPrefillOptVal!=ResponseKey.UNDEFINED){var selectedChoiceElem=ZFUtil.getSelectedOptionElem(selectElem,attrName,zfPrefillOptVal);selectedChoiceElem!==undefined&&($(selectedChoiceElem).prop("selected",!0),typeof ZFLive!=ResponseKey.UNDEFINED&&$(selectElem).change())}}}else selectElem.find("option[value=-Select-]").prop("selected",!0),typeof ZFLive!=ResponseKey.UNDEFINED&&$(selectElem).change();typeof ZFLive!=ResponseKey.UNDEFINED&&$(selectElem).hasClass("select2-hidden-accessible")&&$(selectElem).data("select2").isOpen()&&$(selectElem).select2("close").select2("open")}function getOperTypeFromCond(cond){return cond[ZFRuleConstants.OPERATOR]}function getCompName(elem){return"livefield-elem"===$(elem).attr("elname")?$(elem).attr("compname"):isNewHtmlDOM()?$(elem).closest("div[elname=livefield-elem]").attr("compname"):$(elem).parents("li[elname=livefield-elem]").attr("compname")}function getLogicalOper(oper){return"matchany"==oper?"||":"matchall"==oper?"&&":void 0}function getMatrixRowValue(fldLnkName,rowLinkName,columnValue){var matrixArr=[];return getFieldElem(fldLnkName).find("input[name="+rowLinkName+"]:checked").each(function(index,elem){""!=columnValue&&columnValue!=undefined?$(elem).attr("columnValue")==columnValue&&matrixArr.push($(elem).attr("columnValue")):matrixArr.push($(elem).attr("columnValue"))}),matrixArr}function getInputValForTime(fldElem){var timeVal="";return fldElem.find("select").each(function(index,elem){timeVal=0==index?$.trim($(elem).val()):timeVal+":"+$.trim($(elem).val())}),timeVal}function getInputValue(fldLnkName,comptype,componentLinkName){var inputVal,fldElem=getFieldElem(fldLnkName),encryptionfldtype=parseInt($(fldElem).attr("encryptionfldtype"));if(2==comptype||33==comptype&&encryptionfldtype==EncryptionFieldType.MULTI_LINE)return $.trim(fldElem.find("TextArea").val());if(6==comptype)return getInputValForTime(fldElem);if(7==comptype){var nameArr=[];return componentLinkName!=undefined?fldElem.find("input,select").each(function(index,elem){$(elem).attr("complink")==componentLinkName&&""!=$.trim($(elem).val())&&"-Select-"!=$.trim($(elem).val())&&nameArr.push($.trim($(elem).val()))}):fldElem.find("input,select").each(function(index,elem){""!=$.trim($(elem).val())&&"-Select-"!=$.trim($(elem).val())&&nameArr.push($.trim($(elem).val()))}),nameArr}if(8==comptype){var addressArr=[];return componentLinkName!=undefined?fldElem.find("input,select").each(function(index,elem){$(elem).attr("complink")==componentLinkName&&""!=$.trim($(elem).val())&&"-Select-"!=$.trim($(elem).val())&&addressArr.push($.trim($(elem).val()))}):fldElem.find("input,select").each(function(index,elem){""!=$.trim($(elem).val())&&"-Select-"!=$.trim($(elem).val())&&addressArr.push($.trim($(elem).val()))}),addressArr}if(11==comptype){var fldValElem=fldElem.find("div[elname=phoneFld]").find("input");if("false"==fldElem.attr("isvisible")&&fldValElem.each(function(index,elem){$(elem).val($(elem).attr("initalValue"))}),"INTERNATIONAL"==fldElem.find("div[elname=phoneFormatElem]").attr("phoneformat"))return removeMultiSpace($.trim(fldValElem.val()));var phoneVal="";return fldValElem.each(function(index,elem){var elemValue=$.trim($(elem).val());""!==elemValue&&(phoneVal+=elemValue)}),phoneVal}if(12==comptype)return"zfs-others-zfs"==(inputVal=$.trim(fldElem.find("select[name='"+fldLnkName+"']").val()))?$.trim(fldElem.find("input[name=allow-others-text]").val()):"-Select-"!=inputVal?inputVal:void 0;if(13==comptype)return"zfs-others-zfs"==(inputVal=$.trim(fldElem.find("input:radio:checked").val()))?$.trim(fldElem.find("input[name=allow-others-text]").val()):inputVal;if(14==comptype){var checkboxArr=[];return fldElem.find("input:checkbox:checked").each(function(index,elem){var value=$(elem).val();"zfs-others-zfs"==value&&(value=$.trim(fldElem.find("input[name=allow-others-text]").val())),checkboxArr.push(value)}),checkboxArr}if(15==comptype)return fldElem.find("select").val();if(21==comptype)return fldElem.find("div[elname=ratingSubData]").find("a").attr("value");if(18==comptype||34==comptype)return!!fldElem.find("input:checkbox").is(":checked");if(23==comptype)return $.trim(fldElem.find("div[name=slider]").attr("value"));if(26==comptype){var geolocationArr=[];return fldElem.find("input").each(function(index,elem){var inpVal=$.trim($(elem).val());""!=inpVal&&geolocationArr.push(inpVal)}),geolocationArr}if(29==comptype){checkboxArr=[];if(isOneFieldForm()||"imagePicker"==fldElem.find("div[elname=imageChoiceEle]").attr("choicetype"))fldElem.find("div[name=selectDiv]").each(function(index,elem){"selected"==$(elem).attr("selected")&&checkboxArr.push($(elem).attr("value"))});else{var inputs=fldElem.find("input");$(inputs).each(function(index,elem){"true"==$(elem).attr("prevVal")&&checkboxArr.push($(elem).attr("value"))})}return checkboxArr}if(20==comptype||4==comptype||27==comptype){var decimalFormat=fldElem.attr("decimalformat"),val=fldElem.find("input").val(),newVal=val;return"-"==val.charAt(0)&&(newVal=val.substring(1,val.length)),ZFUtil.checkDecimalValueWithoutFormat(newVal,decimalFormat,10)?$.trim(ZFUtil.getReformattedDecimal(val,decimalFormat)):val}if(9==comptype){fldValElem=fldElem.find("input:first");return"false"==fldElem.attr("isvisible")&&fldValElem.val(fldValElem.attr("initalValue")),$.trim(fldValElem.val())}return 25==comptype?document.getElementById("drawingCanvas-"+fldLnkName):$.trim(fldElem.find("input").val())}function evalCondition(condObj,comptype){var inpVal,oper=condObj[ZFRuleConstants.OPERATOR],fldLnkName=condObj[ZFRuleConstants.FieldLinkName];switch(condObj.rowid!=undefined&&(fldLnkName=fldLnkName+"_"+condObj.rowid),inpVal=30==comptype?getMatrixRowValue(fldLnkName,condObj.rowLinkName,condObj.condValue):(7==comptype||8==comptype)&&condObj[ZFRuleConstants.COMPONENT_LINK_NAME]!=undefined?getInputValue(fldLnkName,comptype,condObj[ZFRuleConstants.COMPONENT_LINK_NAME]):getInputValue(fldLnkName,comptype),oper){case"EQUALS":opers=check_Equals(condObj,inpVal,comptype,fldLnkName);break;case"NOT_EQUAL":opers=check_NotEquals(condObj,inpVal,comptype,fldLnkName);break;case"IS_EMPTY":opers=check_IsEmpty(inpVal,comptype,fldLnkName);break;case"IS_NOT_EMPTY":opers=check_IsNotEmpty(inpVal,comptype,fldLnkName);break;case"STARTS_WITH":opers=check_StartsWith(inpVal,condObj.condValue);break;case"ENDS_WITH":opers=check_EndsWith(inpVal,condObj.condValue);break;case"LESS_THAN":opers=check_Lessthan(inpVal,condObj.condValue,comptype);break;case"GREATER_THAN":opers=check_Greaterthan(inpVal,condObj.condValue,comptype);break;case"LESS_EQUAL":opers=check_Lessthanequal(inpVal,condObj.condValue);break;case"GREATER_EQUAL":opers=check_Greaterthanequal(inpVal,condObj.condValue);break;case"CONTAINS":opers=check_Contains(condObj.condValue,inpVal,comptype);break;case"NOT_CONTAINS":opers=check_NotContains(condObj.condValue,inpVal,comptype);break;case"BETWEEN":opers=check_Between(condObj.condValue,inpVal,comptype);break;case"TRUE":opers=!!inpVal;break;case"FALSE":opers=!inpVal;break;case"OTHER_IS_NOT_EMPTY":opers=check_OthersNotEmpty(inpVal,fldLnkName);break;case"IS_ANYOF":if(condObj.optgroup_array!=undefined){var selectedChoiceGrpName=getGroupValueofSelectedChoice(getFieldElem(fldLnkName),fldLnkName);opers=check_IsAnyOneInOptionGroup(condObj.optgroup_array,inpVal,selectedChoiceGrpName)}else opers=check_IsAnyOne(condObj.condValue,inpVal,condObj,fldLnkName,comptype);break;case"IS_NONEOF":if(condObj.optgroup_array!=undefined){selectedChoiceGrpName=getGroupValueofSelectedChoice(getFieldElem(fldLnkName),fldLnkName);opers=check_IsNotAllInOptionGroup(condObj.optgroup_array,inpVal,selectedChoiceGrpName)}else opers=check_IsNotAll(condObj.condValue,inpVal,condObj,fldLnkName,comptype);break;case"CONTAINS_ANYOF":opers=check_ContainsAnyOne(condObj.condValue,inpVal,comptype);break;case"CONTAINS_ALLOF":opers=check_ContainsAll(condObj.condValue,inpVal);break;case"CONTAINS_NONEOF":opers=check_NotContainsAll(condObj.condValue,inpVal,comptype);break;case ZFRuleConstants.OPERATORS.IS_ANY_CHOICE_IN_GROUP:selectedChoiceGrpName=getGroupValueofSelectedChoice(getFieldElem(fldLnkName),fldLnkName);opers=check_IsAnyChoiceInOptionGroup(condObj.group_name,selectedChoiceGrpName);break;case ZFRuleConstants.OPERATORS.IS_ANY_GROUP:selectedChoiceGrpName=getGroupValueofSelectedChoice(getFieldElem(fldLnkName),fldLnkName);opers=check_isAnyGroupInOptionGroup(condObj.group_names,selectedChoiceGrpName)}return opers}function check_EmptyValue(inpVal){return null==inpVal||""==inpVal}function check_StartsWith(inpVal,condVal){return!check_EmptyValue(inpVal)&&condVal==inpVal.substring(0,condVal.length)}function check_EndsWith(inpVal,condVal){return!check_EmptyValue(inpVal)&&condVal==inpVal.substring(inpVal.length-condVal.length,inpVal.length)}function check_Lessthan(inpVal,condVal,comptype){return 6==comptype?checkTime(inpVal,condVal):!check_EmptyValue(inpVal)&&new Number(inpVal)new Number(condVal)}function check_Lessthanequal(inpVal,condVal){return!check_EmptyValue(inpVal)&&new Number(inpVal)<=new Number(condVal)}function check_Greaterthanequal(inpVal,condVal){return!check_EmptyValue(inpVal)&&new Number(inpVal)>=new Number(condVal)}function check_IsNotEmpty(inpVal,comptype,compname){if(comptype===ZFFieldTypeConstants.TIME)return"::"!==inpVal&&":"!==inpVal;if(comptype===ZFFieldTypeConstants.SIGNATURE){var editSignCont=$("#editsignContainer-"+compname);return!(!$(editSignCont).length||"none"==$(editSignCont).css("display"))||typeof ZFLive!=ResponseKey.UNDEFINED&&!isEmptyCanvasElem(inpVal)}return null!=inpVal&&""!=inpVal}function check_IsEmpty(inpVal,comptype,compname){if(7==comptype||8==comptype||26==comptype)return 0==inpVal.length;if(comptype===ZFFieldTypeConstants.TIME)return"::"===inpVal||":"===inpVal;if(comptype===ZFFieldTypeConstants.SIGNATURE){var editSignCont=$("#editsignContainer-"+compname);return(!$(editSignCont).length||"none"==$(editSignCont).css("display"))&&(typeof ZFLive==ResponseKey.UNDEFINED||!!isEmptyCanvasElem(inpVal))}return null==inpVal||""==inpVal}function check_Between(condValue,inpVal,comptype){var fromVal=condValue.substring(0,condValue.indexOf("--zf--")),toVal=condValue.substring(condValue.indexOf("--zf--")+6,condValue.length);if(!check_EmptyValue(inpVal)){var inpValNum=parseFloat(inpVal);if(!checkNumeric(inpValNum)){var fromValNum=parseFloat(fromVal),toValNum=parseFloat(toVal);if(inpValNum>fromValNum&&inpValNum1){var allMonthYearValueArr=condValue.split("--zf--"),newCondValueInStdDate="";for(eachVal=0;eachVal0&&day2>0)return!0}return!1}function dateComparision(date1,date2,dateFormat,dateLocale){if(""!=date1&&""!=date2&&getDayDifference(date1,date2,dateFormat,dateLocale)>0)return!0;return!1}function getDayDifference(date1,date2,dateFormat,dateLocale){var d1=ZFUtil.splitDateVal(date1,dateFormat,dateLocale),formatdate1=new Date(d1[2],d1[1],d1[0]),d2=ZFUtil.splitDateVal(date2,dateFormat,dateLocale),formatdate2=new Date(d2[2],d2[1],d2[0]);return Math.round((formatdate2.getTime()-formatdate1.getTime())/864e5)}function evalBoolExp(expStr){return-1!==expStr.indexOf("&&")?-1===expStr.indexOf("false"):-1!==expStr.indexOf("||")?-1!==expStr.indexOf("true"):"true"===expStr}function evalDateTimeCondn(condnObj,dateFormat,dateLocale,fldElem,currentDateTimeWithhhmm){var condnOper=condnObj[ZFRuleConstants.OPERATOR],userEnteredDateTime=$.trim($(fldElem).find(":text").val()),timeFormat=$(fldElem).attr("timeformat");if((isRulesTimePartOfDateTimeFieldOperator(condnOper)||isRulesTimePartOfDateTimeFieldBetweenOperator(condnOper))&&(condnObj[ZFRuleConstants.CONDN_VALUE]=getCondValueForTime(condnObj[ZFRuleConstants.CONDN_VALUE])),ZFUtil.validateDateTime(userEnteredDateTime,dateFormat,dateLocale,timeFormat)){if(condnOper===Operators.EQUALS)return areDateTimeValuesEqual(condnObj[ZFRuleConstants.CONDN_VALUE],userEnteredDateTime,dateFormat,dateLocale,timeFormat);if(condnOper===Operators.NOT_EQUAL)return areDateTimeValuesNotEqual(condnObj[ZFRuleConstants.CONDN_VALUE],userEnteredDateTime,dateFormat,dateLocale,timeFormat);if(condnOper===Operators.IS_EMPTY){if(""===userEnteredDateTime)return!0}else if(condnOper===Operators.IS_NOT_EMPTY){if(""!==userEnteredDateTime)return!0}else{if(condnOper===Operators.LESS_THAN)return compareDateTimeValues(userEnteredDateTime,condnObj[ZFRuleConstants.CONDN_VALUE],dateFormat,dateLocale,timeFormat);if(condnOper===Operators.LESS_EQUAL)return areDateTimeValuesEqual(condnObj[ZFRuleConstants.CONDN_VALUE],userEnteredDateTime,dateFormat,dateLocale,timeFormat)||compareDateTimeValues(userEnteredDateTime,condnObj[ZFRuleConstants.CONDN_VALUE],dateFormat,dateLocale,timeFormat);if(condnOper===Operators.GREATER_THAN)return compareDateTimeValues(condnObj[ZFRuleConstants.CONDN_VALUE],userEnteredDateTime,dateFormat,dateLocale,timeFormat);if(condnOper===Operators.GREATER_EQUAL)return areDateTimeValuesEqual(condnObj[ZFRuleConstants.CONDN_VALUE],userEnteredDateTime,dateFormat,dateLocale,timeFormat)||compareDateTimeValues(condnObj[ZFRuleConstants.CONDN_VALUE],userEnteredDateTime,dateFormat,dateLocale,timeFormat);if(condnOper===Operators.BETWEEN)return isDateTimeBetween(userEnteredDateTime,condnObj[ZFRuleConstants.CONDN_VALUE],dateFormat,dateLocale,timeFormat);if(condnOper===Operators.NOT_BETWEEN)return!isDateTimeBetween(userEnteredDateTime,condnObj[ZFRuleConstants.CONDN_VALUE],dateFormat,dateLocale,timeFormat);if(condnOper===Operators.IS_EQUALTO_DAY)return checkIsEqualToDay(getDateValueFromDateTimeForRules(userEnteredDateTime),condnObj.condValue,dateFormat,dateLocale);if(condnOper===Operators.IS_NOTEQUALTO_DAY)return!checkIsEqualToDay(getDateValueFromDateTimeForRules(userEnteredDateTime),condnObj.condValue,dateFormat,dateLocale);if(condnOper===Operators.YESTERDAY)return checkDateDiffValForRules(getDateValueFromDateTimeForRules(userEnteredDateTime),getDateValueFromDateTimeForRules(currentDateTimeWithhhmm),dateFormat,dateLocale,1);if(condnOper===Operators.TODAY)return dateComparision_Equal(getDateValueFromDateTimeForRules(userEnteredDateTime),getDateValueFromDateTimeForRules(currentDateTimeWithhhmm),dateFormat,dateLocale,"EQUALS");if(condnOper===Operators.TOMORROW)return checkDateDiffValForRules(getDateValueFromDateTimeForRules(userEnteredDateTime),getDateValueFromDateTimeForRules(currentDateTimeWithhhmm),dateFormat,dateLocale,-1);if(condnOper===Operators.IS_BEFOREDAYS)return checkDateDiffValForRules(getDateValueFromDateTimeForRules(userEnteredDateTime),getDateValueFromDateTimeForRules(currentDateTimeWithhhmm),dateFormat,dateLocale,parseInt(condnObj.condValue));if(condnOper===Operators.IS_AFTERDAYS)return checkDateDiffValForRules(getDateValueFromDateTimeForRules(userEnteredDateTime),getDateValueFromDateTimeForRules(currentDateTimeWithhhmm),dateFormat,dateLocale,parseInt("-"+condnObj.condValue));if(condnOper===Operators.LAST_WEEK)return checkIsPreWeeksInRules(getDateValueFromDateTimeForRules(userEnteredDateTime),getDateValueFromDateTimeForRules(currentDateTimeWithhhmm),dateFormat,dateLocale);if(condnOper===Operators.THIS_WEEK)return checkIsCurrentWeeksInRules(getDateValueFromDateTimeForRules(userEnteredDateTime),getDateValueFromDateTimeForRules(currentDateTimeWithhhmm),dateFormat,dateLocale);if(condnOper===Operators.NEXT_WEEK)return checkIsNextWeekInRules(getDateValueFromDateTimeForRules(userEnteredDateTime),getDateValueFromDateTimeForRules(currentDateTimeWithhhmm),dateFormat,dateLocale);if(condnOper===Operators.LAST_MONTH)return checkMonthOperationInRules(getDateValueFromDateTimeForRules(userEnteredDateTime),getDateValueFromDateTimeForRules(currentDateTimeWithhhmm),dateFormat,dateLocale,1,2);if(condnOper===Operators.THIS_MONTH)return checkMonthOperationInRules(getDateValueFromDateTimeForRules(userEnteredDateTime),getDateValueFromDateTimeForRules(currentDateTimeWithhhmm),dateFormat,dateLocale,0,2);if(condnOper===Operators.NEXT_MONTH)return checkMonthOperationInRules(getDateValueFromDateTimeForRules(userEnteredDateTime),getDateValueFromDateTimeForRules(currentDateTimeWithhhmm),dateFormat,dateLocale,-1,2);if(condnOper===Operators.LAST_YEAR)return checkMonthOperationInRules(getDateValueFromDateTimeForRules(userEnteredDateTime),getDateValueFromDateTimeForRules(currentDateTimeWithhhmm),dateFormat,dateLocale,1,1);if(condnOper===Operators.THIS_YEAR)return checkMonthOperationInRules(getDateValueFromDateTimeForRules(userEnteredDateTime),getDateValueFromDateTimeForRules(currentDateTimeWithhhmm),dateFormat,dateLocale,0,1);if(condnOper===Operators.NEXT_YEAR)return checkMonthOperationInRules(getDateValueFromDateTimeForRules(userEnteredDateTime),getDateValueFromDateTimeForRules(currentDateTimeWithhhmm),dateFormat,dateLocale,-1,1);if(condnOper===Operators.MONTHIS)return checkMonthEqualsInRules(getDateValueFromDateTimeForRules(userEnteredDateTime),dateFormat,dateLocale,parseInt(condnObj.condValue));if(condnOper===Operators.YEARIS)return checkYearEqualsInRules(getDateValueFromDateTimeForRules(userEnteredDateTime),dateFormat,dateLocale,parseInt(condnObj.condValue));if(condnOper===Operators.IS_INTHEPAST)return compareDateTimeValues(userEnteredDateTime,getConvertedCurrentDateTime(currentDateTimeWithhhmm,dateLocale,timeFormat),dateFormat,dateLocale,timeFormat);if(condnOper===Operators.IS_INTHEFUTURE)return compareDateTimeValues(getConvertedCurrentDateTime(currentDateTimeWithhhmm,dateLocale,timeFormat),userEnteredDateTime,dateFormat,dateLocale,timeFormat);if(condnOper===Operators.IS_ANYOF)return check_IsAnyOne(condnObj.condValue,userEnteredDateTime,condnObj,$(fldElem).attr("linkname"),$(fldElem).attr("comptype"));if(condnOper===Operators.IS_NONEOF)return check_IsNotAll(condnObj.condValue,userEnteredDateTime,condnObj,$(fldElem).attr("linkname"),$(fldElem).attr("comptype"));if(condnOper===Operators.IS_ANYOF_DAYS)return check_IsAnyOneDays(getDateValueFromDateTimeForRules(userEnteredDateTime),condnObj[ZFRuleConstants.CONDN_VALUE],dateFormat,dateLocale);if(condnOper===Operators.IS_NONEOF_DAYS)return!check_IsAnyOneDays(getDateValueFromDateTimeForRules(userEnteredDateTime),condnObj[ZFRuleConstants.CONDN_VALUE],dateFormat,dateLocale);if(condnOper===Operators.IS_ANYOF_MONTHS)return check_IsAnyOneMonths(getDateValueFromDateTimeForRules(userEnteredDateTime),condnObj[ZFRuleConstants.CONDN_VALUE],dateFormat,dateLocale);if(condnOper===Operators.IS_NONEOF_MONTHS)return!check_IsAnyOneMonths(getDateValueFromDateTimeForRules(userEnteredDateTime),condnObj[ZFRuleConstants.CONDN_VALUE],dateFormat,dateLocale);if(condnOper===Operators.TODAY_LESSTHAN){var dateResult=dateComparision_Equal(getDateValueFromDateTimeForRules(userEnteredDateTime),getDateValueFromDateTimeForRules(currentDateTimeWithhhmm),dateFormat,dateLocale,"EQUALS"),timeResult=check_Time_IsLesserThan(getTimeValueFromDateTimeOperators(userEnteredDateTime,timeFormat,dateLocale),condnObj[ZFRuleConstants.CONDN_VALUE],timeFormat);return dateResult&&timeResult}if(condnOper===Operators.TODAY_LESSEQUAL){dateResult=dateComparision_Equal(getDateValueFromDateTimeForRules(userEnteredDateTime),getDateValueFromDateTimeForRules(currentDateTimeWithhhmm),dateFormat,dateLocale,"EQUALS"),timeResult=check_Time_IsLesserEqual(getTimeValueFromDateTimeOperators(userEnteredDateTime,timeFormat,dateLocale),condnObj[ZFRuleConstants.CONDN_VALUE],timeFormat);return dateResult&&timeResult}if(condnOper===Operators.TODAY_GREATERTHAN){dateResult=dateComparision_Equal(getDateValueFromDateTimeForRules(userEnteredDateTime),getDateValueFromDateTimeForRules(currentDateTimeWithhhmm),dateFormat,dateLocale,"EQUALS"),timeResult=check_Time_IsGreaterThan(getTimeValueFromDateTimeOperators(userEnteredDateTime,timeFormat,dateLocale),condnObj[ZFRuleConstants.CONDN_VALUE],timeFormat);return dateResult&&timeResult}if(condnOper===Operators.TODAY_GREATEREQUAL){dateResult=dateComparision_Equal(getDateValueFromDateTimeForRules(userEnteredDateTime),getDateValueFromDateTimeForRules(currentDateTimeWithhhmm),dateFormat,dateLocale,"EQUALS"),timeResult=check_Time_IsGreaterEqual(getTimeValueFromDateTimeOperators(userEnteredDateTime,timeFormat,dateLocale),condnObj[ZFRuleConstants.CONDN_VALUE],timeFormat);return dateResult&&timeResult}if(condnOper===Operators.TODAY_BETWEEN){dateResult=dateComparision_Equal(getDateValueFromDateTimeForRules(userEnteredDateTime),getDateValueFromDateTimeForRules(currentDateTimeWithhhmm),dateFormat,dateLocale,"EQUALS"),timeResult=getTimeResultForDateTimeField(condnObj,getTimeValueFromDateTimeOperators(userEnteredDateTime,timeFormat,dateLocale),timeFormat);return dateResult&&timeResult}if(condnOper===Operators.TODAY_NOT_BETWEEN){dateResult=dateComparision_Equal(getDateValueFromDateTimeForRules(userEnteredDateTime),getDateValueFromDateTimeForRules(currentDateTimeWithhhmm),dateFormat,dateLocale,"EQUALS"),timeResult=getTimeResultForDateTimeField(condnObj,getTimeValueFromDateTimeOperators(userEnteredDateTime,timeFormat,dateLocale),timeFormat);return!(dateResult&&timeResult)}if(condnOper===Operators.TODAY_ISTIME){dateResult=dateComparision_Equal(getDateValueFromDateTimeForRules(userEnteredDateTime),getDateValueFromDateTimeForRules(currentDateTimeWithhhmm),dateFormat,dateLocale,"EQUALS"),timeResult=check_Equals(condnObj,getTimeValueFromDateTimeOperators(userEnteredDateTime,timeFormat,dateLocale),ZFFieldTypeConstants.TIME);return dateResult&&timeResult}if(condnOper===Operators.TODAY_ISNOTTIME){dateResult=dateComparision_Equal(getDateValueFromDateTimeForRules(userEnteredDateTime),getDateValueFromDateTimeForRules(currentDateTimeWithhhmm),dateFormat,dateLocale,"EQUALS"),timeResult=!check_Equals(condnObj,getTimeValueFromDateTimeOperators(userEnteredDateTime,timeFormat,dateLocale),ZFFieldTypeConstants.TIME);return dateResult&&timeResult}if(condnOper===Operators.TOMORROW_LESSTHAN){dateResult=checkDateDiffValForRules(getDateValueFromDateTimeForRules(userEnteredDateTime),getDateValueFromDateTimeForRules(currentDateTimeWithhhmm),dateFormat,dateLocale,-1),timeResult=check_Time_IsLesserThan(getTimeValueFromDateTimeOperators(userEnteredDateTime,timeFormat,dateLocale),condnObj[ZFRuleConstants.CONDN_VALUE],timeFormat);return dateResult&&timeResult}if(condnOper===Operators.TOMORROW_LESSEQUAL){dateResult=checkDateDiffValForRules(getDateValueFromDateTimeForRules(userEnteredDateTime),getDateValueFromDateTimeForRules(currentDateTimeWithhhmm),dateFormat,dateLocale,-1),timeResult=check_Time_IsLesserEqual(getTimeValueFromDateTimeOperators(userEnteredDateTime,timeFormat,dateLocale),condnObj[ZFRuleConstants.CONDN_VALUE],timeFormat);return dateResult&&timeResult}if(condnOper===Operators.TOMORROW_GREATERTHAN){dateResult=checkDateDiffValForRules(getDateValueFromDateTimeForRules(userEnteredDateTime),getDateValueFromDateTimeForRules(currentDateTimeWithhhmm),dateFormat,dateLocale,-1),timeResult=check_Time_IsGreaterThan(getTimeValueFromDateTimeOperators(userEnteredDateTime,timeFormat,dateLocale),condnObj[ZFRuleConstants.CONDN_VALUE],timeFormat);return dateResult&&timeResult}if(condnOper===Operators.TOMORROW_GREATEREQUAL){dateResult=checkDateDiffValForRules(getDateValueFromDateTimeForRules(userEnteredDateTime),getDateValueFromDateTimeForRules(currentDateTimeWithhhmm),dateFormat,dateLocale,-1),timeResult=check_Time_IsGreaterEqual(getTimeValueFromDateTimeOperators(userEnteredDateTime,timeFormat,dateLocale),condnObj[ZFRuleConstants.CONDN_VALUE],timeFormat);return dateResult&&timeResult}if(condnOper===Operators.TOMORROW_BETWEEN){dateResult=checkDateDiffValForRules(getDateValueFromDateTimeForRules(userEnteredDateTime),getDateValueFromDateTimeForRules(currentDateTimeWithhhmm),dateFormat,dateLocale,-1),timeResult=getTimeResultForDateTimeField(condnObj,getTimeValueFromDateTimeOperators(userEnteredDateTime,timeFormat,dateLocale),timeFormat);return dateResult&&timeResult}if(condnOper===Operators.TOMORROW_NOT_BETWEEN){dateResult=checkDateDiffValForRules(getDateValueFromDateTimeForRules(userEnteredDateTime),getDateValueFromDateTimeForRules(currentDateTimeWithhhmm),dateFormat,dateLocale,-1),timeResult=getTimeResultForDateTimeField(condnObj,getTimeValueFromDateTimeOperators(userEnteredDateTime,timeFormat,dateLocale),timeFormat);return!(dateResult&&timeResult)}if(condnOper===Operators.TOMORROW_ISTIME){dateResult=checkDateDiffValForRules(getDateValueFromDateTimeForRules(userEnteredDateTime),getDateValueFromDateTimeForRules(currentDateTimeWithhhmm),dateFormat,dateLocale,-1),timeResult=check_Equals(condnObj,getTimeValueFromDateTimeOperators(userEnteredDateTime,timeFormat,dateLocale),ZFFieldTypeConstants.TIME);return dateResult&&timeResult}if(condnOper===Operators.TOMORROW_ISNOTTIME){dateResult=checkDateDiffValForRules(getDateValueFromDateTimeForRules(userEnteredDateTime),getDateValueFromDateTimeForRules(currentDateTimeWithhhmm),dateFormat,dateLocale,-1),timeResult=!check_Equals(condnObj,getTimeValueFromDateTimeOperators(userEnteredDateTime,timeFormat,dateLocale),ZFFieldTypeConstants.TIME);return dateResult&&timeResult}if(condnOper===Operators.YESTERDAY_LESSTHAN){dateResult=checkDateDiffValForRules(getDateValueFromDateTimeForRules(userEnteredDateTime),getDateValueFromDateTimeForRules(currentDateTimeWithhhmm),dateFormat,dateLocale,1),timeResult=check_Time_IsLesserThan(getTimeValueFromDateTimeOperators(userEnteredDateTime,timeFormat,dateLocale),condnObj[ZFRuleConstants.CONDN_VALUE],timeFormat);return dateResult&&timeResult}if(condnOper===Operators.YESTERDAY_LESSEQUAL){dateResult=checkDateDiffValForRules(getDateValueFromDateTimeForRules(userEnteredDateTime),getDateValueFromDateTimeForRules(currentDateTimeWithhhmm),dateFormat,dateLocale,1),timeResult=check_Time_IsLesserEqual(getTimeValueFromDateTimeOperators(userEnteredDateTime,timeFormat,dateLocale),condnObj[ZFRuleConstants.CONDN_VALUE],timeFormat);return dateResult&&timeResult}if(condnOper===Operators.YESTERDAY_GREATERTHAN){dateResult=checkDateDiffValForRules(getDateValueFromDateTimeForRules(userEnteredDateTime),getDateValueFromDateTimeForRules(currentDateTimeWithhhmm),dateFormat,dateLocale,1),timeResult=check_Time_IsGreaterThan(getTimeValueFromDateTimeOperators(userEnteredDateTime,timeFormat,dateLocale),condnObj[ZFRuleConstants.CONDN_VALUE],timeFormat);return dateResult&&timeResult}if(condnOper===Operators.YESTERDAY_GREATEREQUAL){dateResult=checkDateDiffValForRules(getDateValueFromDateTimeForRules(userEnteredDateTime),getDateValueFromDateTimeForRules(currentDateTimeWithhhmm),dateFormat,dateLocale,1),timeResult=check_Time_IsGreaterEqual(getTimeValueFromDateTimeOperators(userEnteredDateTime,timeFormat,dateLocale),condnObj[ZFRuleConstants.CONDN_VALUE],timeFormat);return dateResult&&timeResult}if(condnOper===Operators.YESTERDAY_BETWEEN){dateResult=checkDateDiffValForRules(getDateValueFromDateTimeForRules(userEnteredDateTime),getDateValueFromDateTimeForRules(currentDateTimeWithhhmm),dateFormat,dateLocale,1),timeResult=getTimeResultForDateTimeField(condnObj,getTimeValueFromDateTimeOperators(userEnteredDateTime,timeFormat,dateLocale),timeFormat);return dateResult&&timeResult}if(condnOper===Operators.YESTERDAY_NOT_BETWEEN){dateResult=checkDateDiffValForRules(getDateValueFromDateTimeForRules(userEnteredDateTime),getDateValueFromDateTimeForRules(currentDateTimeWithhhmm),dateFormat,dateLocale,1),timeResult=getTimeResultForDateTimeField(condnObj,getTimeValueFromDateTimeOperators(userEnteredDateTime,timeFormat,dateLocale),timeFormat);return!(dateResult&&timeResult)}if(condnOper===Operators.YESTERDAY_ISTIME){dateResult=checkDateDiffValForRules(getDateValueFromDateTimeForRules(userEnteredDateTime),getDateValueFromDateTimeForRules(currentDateTimeWithhhmm),dateFormat,dateLocale,1),timeResult=check_Equals(condnObj,getTimeValueFromDateTimeOperators(userEnteredDateTime,timeFormat,dateLocale),ZFFieldTypeConstants.TIME);return dateResult&&timeResult}if(condnOper===Operators.YESTERDAY_ISNOTTIME){dateResult=checkDateDiffValForRules(getDateValueFromDateTimeForRules(userEnteredDateTime),getDateValueFromDateTimeForRules(currentDateTimeWithhhmm),dateFormat,dateLocale,1),timeResult=!check_Equals(condnObj,getTimeValueFromDateTimeOperators(userEnteredDateTime,timeFormat,dateLocale),ZFFieldTypeConstants.TIME);return dateResult&&timeResult}if(condnOper===Operators.IS_LESSTHAN_TIME)return check_Time_IsLesserThan(getTimeValueFromDateTimeOperators(userEnteredDateTime,timeFormat,dateLocale),condnObj[ZFRuleConstants.CONDN_VALUE],timeFormat);if(condnOper===Operators.IS_LESSEQUAL_TIME)return check_Time_IsLesserEqual(getTimeValueFromDateTimeOperators(userEnteredDateTime,timeFormat,dateLocale),condnObj[ZFRuleConstants.CONDN_VALUE],timeFormat);if(condnOper===Operators.IS_GREATERTHAN_TIME)return check_Time_IsGreaterThan(getTimeValueFromDateTimeOperators(userEnteredDateTime,timeFormat,dateLocale),condnObj[ZFRuleConstants.CONDN_VALUE],timeFormat);if(condnOper===Operators.IS_GREATEREQUAL_TIME)return check_Time_IsGreaterEqual(getTimeValueFromDateTimeOperators(userEnteredDateTime,timeFormat,dateLocale),condnObj[ZFRuleConstants.CONDN_VALUE],timeFormat);if(condnOper===Operators.IS_BETWEENTIME)return getTimeResultForDateTimeField(condnObj,getTimeValueFromDateTimeOperators(userEnteredDateTime,timeFormat,dateLocale),timeFormat);if(condnOper===Operators.IS_NOT_BETWEENTIME)return!getTimeResultForDateTimeField(condnObj,getTimeValueFromDateTimeOperators(userEnteredDateTime,timeFormat,dateLocale),timeFormat);if(condnOper===Operators.IS_TIME)return check_Equals(condnObj,getTimeValueFromDateTimeOperators(userEnteredDateTime,timeFormat,dateLocale),ZFFieldTypeConstants.TIME);if(condnOper===Operators.IS_NOTTIME)return""!=getTimeValueFromDateTimeOperators(userEnteredDateTime,timeFormat,dateLocale)&&!check_Equals(condnObj,getTimeValueFromDateTimeOperators(userEnteredDateTime,timeFormat,dateLocale),ZFFieldTypeConstants.TIME)}}return!1}function areDateTimeValuesEqual(condnDateTime,userEnteredDateTime,dateFormat,dateLocale,timeFormat){if(""!==condnDateTime&&""!==userEnteredDateTime){var condnDate=getDateFromDateTimeValue(condnDateTime);if(dateComparision_Equal(getDateFromDateTimeValue(userEnteredDateTime),condnDate,dateFormat,dateLocale,Operators.EQUALS)){var userEnteredTime=getTimeFromDateTimeValue(userEnteredDateTime);userEnteredTime=userEnteredTime.replace(" ",":");var condnTime=getTimeFromDateTimeValue(condnDateTime);if(compareTimeWithLocale(userEnteredTime,condnTime=condnTime.replace(" ",":"),dateLocale,timeFormat)===Num_Status.EQUAL)return!0}}return!1}function areDateTimeValuesNotEqual(condnDateTime,userEnteredDateTime,dateFormat,dateLocale,timeFormat){if(""!==condnDateTime&&""!==userEnteredDateTime){var condnDate=getDateFromDateTimeValue(condnDateTime);if(dateComparision_Equal(getDateFromDateTimeValue(userEnteredDateTime),condnDate,dateFormat,dateLocale,Operators.NOT_EQUAL))return!0;var userEnteredTime=getTimeFromDateTimeValue(userEnteredDateTime);userEnteredTime=userEnteredTime.replace(" ",":");var condnTime=getTimeFromDateTimeValue(condnDateTime);if(compareTimeWithLocale(userEnteredTime,condnTime=condnTime.replace(" ",":"),dateLocale,timeFormat)===Num_Status.LESSER||compareTimeWithLocale(userEnteredTime,condnTime,dateLocale,timeFormat)===Num_Status.GREATER)return!0}return!1}function compareDateTimeValues(dateTime1,dateTime2,dateFormat,dateLocale,timeFormat){if(""!==dateTime1&&""!==dateTime2){var diffInDays=getDayDifference(getDateFromDateTimeValue(dateTime1),getDateFromDateTimeValue(dateTime2),dateFormat,dateLocale);if(diffInDays>0)return!0;if(0===diffInDays){var time1=getTimeFromDateTimeValue(dateTime1);time1=time1.replace(" ",":");var time2=getTimeFromDateTimeValue(dateTime2);if(compareTimeWithLocale(time1,time2=time2.replace(" ",":"),dateLocale,timeFormat)===Num_Status.LESSER)return!0}}return!1}function isDateTimeBetween(userEnteredDateTime,zfSeparatedCondnDateTime,dateFormat,dateLocale,timeFormat){if(""!==userEnteredDateTime){var condnDateTimesArray=zfSeparatedCondnDateTime.split(Separators.ZF_SEPARATOR);if(compareDateTimeValues(condnDateTimesArray[0],userEnteredDateTime,dateFormat,dateLocale,timeFormat)&&compareDateTimeValues(userEnteredDateTime,condnDateTimesArray[1],dateFormat,dateLocale,timeFormat))return!0}return!1}function getDateFromDateTimeValue(dateTime){return dateTime.substring(0,dateTime.indexOf(" "))}function getTimeFromDateTimeValue(dateTime){return dateTime.substring(dateTime.indexOf(" ")+1,dateTime.length)}function compareTime(timeValue1,timeValue2){var timeValues=[];timeValues[0]=timeValue1,timeValues[1]=timeValue2;var splittedTimeValues=[],meridianValues=[];for(var ind in timeValues){var timeVal=timeValues[ind],firstColonIndex=timeVal.indexOf(":");if(0===firstColonIndex)return Num_Status.INVALID;var secondColonIndex=timeVal.lastIndexOf(":");if(firstColonIndex+1===secondColonIndex)return Num_Status.INVALID;if(secondColonIndex+1===timeVal.length)return Num_Status.INVALID;var hrVal=parseInt(timeVal.substring(0,firstColonIndex));12===hrVal&&(hrVal=0);var timeInMin=60*hrVal+parseInt(timeVal.substring(firstColonIndex+1,secondColonIndex));splittedTimeValues.push(timeInMin);var meridianVal=timeVal.substring(secondColonIndex+1,timeVal.length);meridianValues.push(meridianVal)}return meridianValues[0]!==meridianValues[1]?meridianValues[0]===Meridian.AM?Num_Status.LESSER:Num_Status.GREATER:splittedTimeValues[0]===splittedTimeValues[1]?Num_Status.EQUAL:splittedTimeValues[0]>splittedTimeValues[1]?Num_Status.GREATER:splittedTimeValues[0]splittedTimeValues[1]?Num_Status.GREATER:splittedTimeValues[0]splittedTimeValues[1]?Num_Status.GREATER:splittedTimeValues[0]0&&otherElem.is(":checked"))return 0!=$.trim(fldElem.find("input[name=allow-others-text]").val()).length}return!1}function check_IsAnyOne(condValueArr,inpVal,condObj,fldLnkName,comptype){if(!check_EmptyValue(inpVal))if(12==comptype||13==comptype){if(-1!=$.inArray(inpVal,condValueArr))return!0}else for(var valIndex=0;valIndex0?expString+getAdvLogicalOper(logical_oper)+condResult:condResult}function isAdvRuleSatisfied(expString,logical_oper){return!(!evalBoolExp($.trim(expString))||"||"!=getAdvLogicalOper(logical_oper))||!(!evalBoolExp($.trim(expString))&&"&&"==getAdvLogicalOper(logical_oper))&&void 0}function replaceAdvRulesFieldLinkNameKey(condArr,fieldLinkNameArr){for(var conIndex=0;conIndex0)$(subFormFldHeaderElem).find("em.important").show();else if(parseInt($(fldLinkElem).attr("comptype"))==ZFFieldTypeConstants.DECISION_BOX)if(2==viewType)$(subFormFldHeaderElem).find("span[elname=display_name]").length>0&&$(subFormFldHeaderElem).find("span[elname=display_name]").each(function(index,elem){$(subFormFldHeaderElem).find("span[elname=display_name]")[index].appendChild(getEmTagForSetMandatory())});else{var labelElem=isNewHtmlDOM()?"label.fieldlabel":"label.labelName";$(subFormFldHeaderElem).find(labelElem).length>0&&$(subFormFldHeaderElem).find(labelElem)[0].appendChild(getEmTagForSetMandatory())}else{labelElem=isNewHtmlDOM()?"label.fieldlabel":"label.labelName";$(subFormFldHeaderElem).find(labelElem).length>0&&$(subFormFldHeaderElem).find(labelElem).each(function(index,elem){$(subFormFldHeaderElem).find(labelElem)[index].appendChild(getEmTagForSetMandatory())})}}function unSetMandatorySymbolToSubFormELem(fldLinkElem,fldLnkName){var viewType=isOneFieldForm()?2:getParentSubFormElem(fldLnkName).attr("viewtype"),subFormFldHeaderElem=isNewHtmlDOM()?$("div#label_"+fldLnkName+"-li"):$("li#label_"+fldLnkName+"-li");2==viewType&&(subFormFldHeaderElem=fldLinkElem),$(subFormFldHeaderElem).find("em.important").hide()}function getSFFieldCloneElemWithFldLinkName(fldLnkName){return isOneFieldForm()?$("div[elname=subFormFieldsCloneUl],[elname=subFormFieldsUl]").find("div[linkname="+fldLnkName+"]"):isStandardForm()?$("#formBodyDiv").find("div[elemtype=subFormField]").find("div[linkname="+fldLnkName+"]"):$("#formBodyDiv").find("li[elemtype=subFormField]").find("li[linkname="+fldLnkName+"]")}function getEmTagForSetMandatory(){var emElem=document.createElement("em");return $(emElem).addClass("important").text(" *"),emElem}function getChildSubFormFieldsUl(fieldElem){return isOneFieldForm()?$(fieldElem).find("div[elname=subFormFieldsCloneUl],[elname=subFormFieldsUl]"):isStandardForm()?$(fieldElem).find("div[elname=subFormFieldsCloneUl],div[elname=subFormFieldsUl]"):$(fieldElem).find("ul[elname=subFormFieldsCloneUl],[elname=subFormFieldsUl]")}function isSubFormField(fieldLinkname){return!(getFieldElem(fieldLinkname).length>0)&&getParentSubFormElem(fieldLinkname).length>0}function evalEachCondition(fldLinkElem,condtionObj,recalculateFormula){if(isGridFieldConfiguredInRules(fldLinkElem)&&isGridElemHiddenInRules(fldLinkElem))return!1;var result=!1,compType=parseInt(fldLinkElem.attr("comptype"));if(isFieldAlreadyVisibleByRules(fldLinkElem,condtionObj[ZFRuleConstants.FieldLinkName])){if(isAnotherFieldInvolvedInRuleCondition(condtionObj)){var dynamicRulePreEvalResultObj=preEvaluateAndReturnDynamicRulesConidtion(condtionObj,fldLinkElem,recalculateFormula);if(dynamicRulePreEvalResultObj.isresultavailable)return dynamicRulePreEvalResultObj.result}if(compType===ZFFieldTypeConstants.DATE)result=evalDateCondition(condtionObj,zf_rule.dateFormat,zf_rule.dateLocale,fldLinkElem,zf_rule.currentDateddmmyyyyhhmm);else if(compType===ZFFieldTypeConstants.MONTHYEAR)result=evalMonthYearCondition(condtionObj,zf_rule.dateFormat,zf_rule.dateLocale,fldLinkElem,zf_rule.currentDateddmmyyyyhhmm);else if(compType===ZFFieldTypeConstants.DATETIME)result=evalDateTimeCondn(condtionObj,zf_rule.dateFormat,zf_rule.dateLocale,fldLinkElem,zf_rule.currentDateddmmyyyyhhmm);else if(compType===ZFFieldTypeConstants.TIME)result=evalTimeCondition(condtionObj,fldLinkElem);else{var fldLnkName=condtionObj[ZFRuleConstants.FieldLinkName];typeof ZFLive!=ResponseKey.UNDEFINED&&recalculateFormula&&compType===ZFFieldTypeConstants.FORMULA&&ZFLive.evalExpressionOnFieldRuleExecution(fldLnkName),result=evalCondition(condtionObj,compType)}}return result}function evalAdvancedRulesForEachRule(groupActionVisibleHiddenJsonObj,fieldWiseResulCountObj,ruleObj,rowId,subFormLinkName,fieldWiseResulMainCountObj,subFormFieldWiseResulCountObj,depRuleObj,elem,ruleResultObj){var depchoiceObj=depRuleObj.depchoiceObj,succussDepRulesList=depRuleObj.succussDepRulesList;if(!ruleObj.isDepRule||succussDepRulesList==undefined||-1==$.inArray(ruleObj.ruleid,succussDepRulesList)){var str=evaluateAdvancedRuleConditions(ruleObj,rowId);for(var y in ruleObj.actionsObj)if(ruleObj.actionsObj[y][ZFRuleConstants.RULE_ACTION]==ZFRuleConstants.SHOW_GROUP||ruleObj.actionsObj[y][ZFRuleConstants.RULE_ACTION]==ZFRuleConstants.HIDE_GROUP){var groupCountKey="group_count";ruleObj.subform_linkname!=undefined&&(groupCountKey="rgroup_count");var resultObj=checkAdvRulesGroupCountInResultJSon(fieldWiseResulCountObj,ruleObj.actionsObj[y].actionLinkName,groupCountKey);if(evalBoolExp($.trim(str))){var isDepRuleShowAllGroupAction=isDepRuleShowAllGroups(ruleObj);if(evalGroupAction(ruleObj.actionsObj[y][ZFRuleConstants.ACTION_LINK_NAME],ruleObj.actionsObj[y][ZFRuleConstants.RULE_ACTION],groupActionVisibleHiddenJsonObj,isDepRuleShowAllGroupAction),performShowHideGroupActions(ruleObj,groupActionVisibleHiddenJsonObj),ruleObj.isDepRule){var parentFieldElem=getFieldElementForDepRules(ruleObj.conditionsObj[0][ZFRuleConstants.FieldLinkName],rowId);($(parentFieldElem).attr("comptype")==ZFFieldTypeConstants.DROPDOWN||$(parentFieldElem).attr("comptype")==ZFFieldTypeConstants.MULTIPLE_CHOICE&&isDepRuleShowAllGroupAction)&&(resultObj=setAdvRulesGroupCountInResultJson(fieldWiseResulCountObj,ruleObj.actionsObj[y].actionLinkName,groupCountKey),succussDepRulesList.push(ruleObj.ruleid))}}else if(ruleObj.isDepRule){if(canShowAllGroups(fieldWiseResulCountObj,ruleObj.actionsObj[y].actionLinkName,groupCountKey,groupActionVisibleHiddenJsonObj))groupActionVisibleHiddenJsonObj[ZFRuleConstants.HIDE_GROUP][ruleObj.actionsObj[y].actionLinkName]=[]}else disableActionForAdvRules(ruleObj.actionsObj[y],ruleObj.actionsObj[y][ZFRuleConstants.ACTION_LINK_NAME],groupActionVisibleHiddenJsonObj,undefined,ruleResultObj);if(resultObj.group_count!=undefined&&resultObj.rgroup_count!=undefined){var fieldRuleResultGroubObj=fieldWiseResulMainCountObj[ruleObj.actionsObj[y].actionLinkName];ruleObj.issubform_rule||addSubFormFieldGroupActionIntoAllRow(subFormFieldWiseResulCountObj,ruleObj.actionsObj[y].sub_linkname,str,ruleObj,ruleObj.actionsObj[y],ruleResultObj),ruleObj.issubform_rule?0==fieldRuleResultGroubObj.group_count&&0==resultObj.rgroup_count&&showOrHideOptionGroupBasedOnRulesForAdvRules(groupActionVisibleHiddenJsonObj,ruleObj.actionsObj[y][ZFRuleConstants.ACTION_LINK_NAME],rowId):populateOptGroupInAllSubFormRows(ruleObj.actionsObj[y],subFormFieldWiseResulCountObj,ruleObj.actionsObj[y].sub_linkname,ruleObj.actionsObj[y].actionLinkName,fieldRuleResultGroubObj.group_count)}else resultObj.group_count!=undefined&&0==resultObj.group_count?showOrHideOptionGroupBasedOnRulesForAdvRules(groupActionVisibleHiddenJsonObj,ruleObj.actionsObj[y][ZFRuleConstants.ACTION_LINK_NAME],rowId):resultObj.rgroup_count!=undefined&&0==resultObj.rgroup_count&&showOrHideOptionGroupBasedOnRulesForAdvRules(groupActionVisibleHiddenJsonObj,ruleObj.actionsObj[y][ZFRuleConstants.ACTION_LINK_NAME],rowId)}else if(ruleObj.actionsObj[y][ZFRuleConstants.RULE_ACTION]==ZFRuleConstants.SHOW||ruleObj.actionsObj[y][ZFRuleConstants.RULE_ACTION]==ZFRuleConstants.HIDE){resultObj=fieldWiseResulCountObj[ruleObj.actionsObj[y].actionLinkName];if(ruleObj.issubform_rule?(countKey="rcount",resultKey="rresult"):(countKey="count",resultKey="result"),resultObj[countKey]>0){checkAdvRulesCountInResultJSon(fieldWiseResulCountObj,ruleObj.actionsObj[y].actionLinkName,evalBoolExp($.trim(str)),resultKey,countKey);if(0==resultObj[countKey])(actionResult=evalBoolExp($.trim(resultObj[resultKey])))?(evalAction(ruleObj.actionsObj[y],ruleObj.actionsObj[y][ZFRuleConstants.ACTION_LINK_NAME],ruleObj.actionsObj[y][ZFRuleConstants.RULE_ACTION],[],groupActionVisibleHiddenJsonObj,rowId,ruleResultObj),typeof ZFLive!=ResponseKey.UNDEFINED&&null!=ZFLive.paymentMerchantList&&ZFLive.setValueInPayment(ruleObj.actionsObj[y][ZFRuleConstants.ACTION_LINK_NAME])):("count"==countKey&&resultObj.rcount==undefined||"rcount"==countKey&&!fieldWiseResulMainCountObj[ruleObj.actionsObj[y].actionLinkName].result)&&disableActionForAdvRules(ruleObj.actionsObj[y],ruleObj.actionsObj[y][ZFRuleConstants.ACTION_LINK_NAME],groupActionVisibleHiddenJsonObj,rowId,ruleResultObj)}}else if(ruleObj.actionsObj[y][ZFRuleConstants.RULE_ACTION]==ZFRuleConstants.SETMANDATORY){var linkName;if(ruleObj.issubform_rule?(countKey="rsetmandatory_count",resultKey="rsetmandatory_result"):(countKey="setmandatory_count",resultKey="setmandatory_result"),fieldWiseResulCountObj[ruleObj.actionsObj[y].componentLinkName]!=undefined?(resultObj=fieldWiseResulCountObj[ruleObj.actionsObj[y].componentLinkName],linkName=ruleObj.actionsObj[y].componentLinkName):(resultObj=fieldWiseResulCountObj[ruleObj.actionsObj[y].actionLinkName],linkName=ruleObj.actionsObj[y].actionLinkName),resultObj[countKey]>0)if(0==checkAdvRulesCountInResultJSon(fieldWiseResulCountObj,linkName,evalBoolExp($.trim(str)),resultKey,countKey)[countKey]){var actionResult;if(!(actionResult=evalBoolExp($.trim(resultObj[resultKey])))){if("setmandatory_count"==countKey&&resultObj.rsetmandatory_count!=undefined)continue;if("rsetmandatory_count"==countKey&&fieldWiseResulMainCountObj[linkName].setmandatory_result)continue}ruleObj.actionsObj[y].componentLinkName!=undefined?evalSetMandatoryAction(ruleObj.actionsObj[y][ZFRuleConstants.ACTION_LINK_NAME],actionResult,rowId,ruleObj.actionsObj[y].componentLinkName):evalSetMandatoryAction(ruleObj.actionsObj[y][ZFRuleConstants.ACTION_LINK_NAME],actionResult,rowId)}}else if(ruleObj.actionsObj[y][ZFRuleConstants.RULE_ACTION]==ZFRuleConstants.FILTER_OPTS){var countKey,resultKey;resultObj=fieldWiseResulCountObj[ruleObj.actionsObj[y].actionLinkName];ruleObj.issubform_rule?(countKey="rdep_count",resultKey="rdep_result"):(countKey="dep_count",resultKey="dep_result");var fieldElem=getFieldElementForDepRules(ruleObj.actionsObj[y].actionLinkName,rowId);if(resultObj[countKey]=resultObj[countKey]-1,!resultObj[resultKey]&&(resultObj[resultKey]=evalBoolExp($.trim(str)),resultObj[resultKey]&&ruleObj.isDepRule)){parentFieldElem=getFieldElementForDepRules(ruleObj.conditionsObj[0][ZFRuleConstants.FieldLinkName],rowId);($(parentFieldElem).attr("comptype")==ZFFieldTypeConstants.DROPDOWN||$(parentFieldElem).attr("comptype")==ZFFieldTypeConstants.MULTIPLE_CHOICE&&isDepRuleShowAllChoice(ruleObj.actionsObj[y].filterchoices))&&(succussDepRulesList.push(ruleObj.ruleid),resultObj[countKey]=0)}depchoiceObj.hasOwnProperty(ruleObj.actionsObj[y].actionLinkName)||(depchoiceObj[ruleObj.actionsObj[y].actionLinkName]=[]);var depChoiceList=depchoiceObj[ruleObj.actionsObj[y].actionLinkName];if(evalBoolExp($.trim(str)))for(choiceIndex in ruleObj.actionsObj[y].filterchoices){var optionVal=ruleObj.actionsObj[y].filterchoices[choiceIndex];optionVal!=ZFRuleConstants.DEPENDENCY_RULE.HIDE_ALL_CHOICES&&-1==$.inArray(optionVal,depChoiceList)&&depChoiceList.push(optionVal)}0==resultObj[countKey]&&executeDepRules(ruleObj.actionsObj[y],rowId,resultObj[resultKey],depChoiceList,$(fieldElem).attr("comptype"),elem)}}}function canShowAllGroups(fieldWiseResulCountObj,fldLnkName,groupCountKey,groupActionVisibleHiddenJsonObj){if(0==fieldWiseResulCountObj[fldLnkName][groupCountKey]){var notInGroupAction=!0;for(var actionItr in groupActionVisibleHiddenJsonObj){if(groupActionVisibleHiddenJsonObj[actionItr].hasOwnProperty(fldLnkName)){notInGroupAction=!1;break}}return notInGroupAction}return!1}function isAnySubFormFieldPresentAfterRuleExec(fldLnkName){var isFieldPresent=!1,subformFieldElem=getFieldElemWithFldLinkNameAttr(fldLnkName);return $(subformFieldElem).each(function(index,elem){0==index||"true"!=$(elem).attr("needdata")||(isFieldPresent=!0)}),isFieldPresent}function isSubFormPopup(fieldLinkname){var subFormElem=getParentSubFormElem(fieldLinkname);return 2==$(subFormElem).attr("viewtype")}function showOptGroupInDropdown(fldLinkElem,fldLinkName,grpNameArray){var selectInpElem=$(fldLinkElem).find('select[name="'+fldLinkName+'"]'),selectedInp=selectInpElem.val(),selectedGroupName=getGroupValueofSelectedChoice(fldLinkElem,fldLinkName);for(var iter in selectInpElem.find("optgroup").remove(),grpNameArray){var grpName=grpNameArray[iter],optGrpToClone=ZFUtil.getSelectedChoiceElem($(fldLinkElem).find("div[elname=liveFieldTempChoiceCont]").find("select").find("optgroup"),"value",grpName),optGrpElem=$(optGrpToClone).clone();selectInpElem[0].appendChild(optGrpElem[0])}clearSelectFieldInputIfHidden(fldLinkElem,fldLinkName,selectedInp,selectedGroupName)}function hideOptGroupInDropdown(fldLinkElem,fldLinkName,grpNameArray){var selectInpElem=$(fldLinkElem).find('select[name="'+fldLinkName+'"]'),selectedInp=selectInpElem.val(),selectedGroupName=getGroupValueofSelectedChoice(fldLinkElem,fldLinkName);selectInpElem.find("optgroup").remove();var optGrpElem=$(fldLinkElem).find("div[elname=liveFieldTempChoiceCont]").find("select").find("optgroup").clone();for(var iter in $.each(optGrpElem,function(index,elem){selectInpElem[0].appendChild(elem)}),grpNameArray){var grpName=grpNameArray[iter],optGrpToRemove=ZFUtil.getSelectedChoiceElem(selectInpElem.find("optgroup"),"value",grpName);$(optGrpToRemove).remove()}clearSelectFieldInputIfHidden(fldLinkElem,fldLinkName,selectedInp,selectedGroupName)}function isParentElemSubForm(fldElem){return isNewHtmlDOM()?$(fldElem).closest("div[elemtype=subFormField]").length>0:$(fldElem).closest("li[elemtype=subFormField]").length>0}function getParentSubFormElem(fieldLinkname){var fldLinkElem=getFieldElemWithFldLinkNameAttr(fieldLinkname);return isNewHtmlDOM()?$(fldLinkElem).closest("div[elemtype=subFormField]"):$(fldLinkElem).closest("li[elemtype=subFormField]")}function isSubFormWithElem(fldElem){return(isNewHtmlDOM()?$(fldElem).closest('div[elname="subFormFieldsUl"]'):$(fldElem).closest('ul[elname="subFormFieldsUl"]')).length>0}function isAnySubFormFieldHasMandatoryAfterRuleExec(fldLnkName){var isMandatoryFieldPresent=!1,subformFieldElem=getFieldElemWithFldLinkNameAttr(fldLnkName);return $(subformFieldElem).each(function(index,elem){0==index||"true"!=$(elem).attr("mandatory")||(isMandatoryFieldPresent=!0)}),isMandatoryFieldPresent}function showRulesMandatoryError(errorIdd,comptype,compname){$(errorIdd).show(),comptype==ZFFieldTypeConstants.SIGNATURE?$(errorIdd).text(ZFLiveErrorConstants.signaturemandatoryerror):comptype==ZFFieldTypeConstants.FILE_UPLOAD||comptype==ZFFieldTypeConstants.IMAGE_UPLOAD||comptype==ZFFieldTypeConstants.MEDIA_UPLOAD?$(errorIdd).text(ZFLiveErrorConstants.fileuploadmandatoryerror):comptype===ZFFieldTypeConstants.SLIDER?$(errorIdd).text(i18n.chooseval):comptype==ZFFieldTypeConstants.DATE?$(errorIdd).text(ZFLiveErrorConstants.datemandatoryerror):comptype===ZFFieldTypeConstants.DATETIME?$(errorIdd).text(ZFLiveErrorConstants.datemandatoryerror):comptype===ZFFieldTypeConstants.PHONE?$(errorIdd).text(ZFLiveErrorConstants.mandatoryerrornumber):comptype===ZFFieldTypeConstants.NUMBER||comptype===ZFFieldTypeConstants.DECIMAL||comptype===ZFFieldTypeConstants.CURRENCY?$(errorIdd).text(ZFLiveErrorConstants.mandatoryerrornumber):comptype==ZFFieldTypeConstants.WEBSITE?$(errorIdd).text(ZFLiveErrorConstants.urlerror):comptype==ZFFieldTypeConstants.TIME?$(errorIdd).text(ZFLiveErrorConstants.timemandatoryerror):comptype==ZFFieldTypeConstants.DROPDOWN||comptype==ZFFieldTypeConstants.RADIO?$(errorIdd).text(ZFLiveErrorConstants.choicemandatoryerror):comptype==ZFFieldTypeConstants.RATING?$(errorIdd).text(ZFLiveErrorConstants.ratingmandatoryerror):comptype==ZFFieldTypeConstants.CHECKBOX?$(errorIdd).text(ZFLiveErrorConstants.optionmandatoryerror):comptype==ZFFieldTypeConstants.DECISION_BOX?$(errorIdd).text(ZFLiveErrorConstants.decisionmandatoryerror):comptype==ZFFieldTypeConstants.MULTIPLE_CHOICE||comptype==ZFFieldTypeConstants.IMAGE_CHOICE?$(errorIdd).text(ZFLiveErrorConstants.optionmandatoryerror):comptype==ZFFieldTypeConstants.TERMS_CONDITIONS?$(errorIdd).text(ZFLiveErrorConstants.checktcfield):$(errorIdd).text(ZFLiveErrorConstants.mandatoryerror)}function hideRulesMandatoryError(errorIdd){$(errorIdd).text(""),$(errorIdd).hide()}function evalRulesForSubFormRows(subFormFldElem,ruleObj,subFormLinkName,fieldWiseResulMainCountObj,subFormFieldWiseResulCountObj,elem,ruleResultObj){$(subFormFldElem).each(function(rowIndex,fldElem){var rowId=parseInt($(fldElem).attr("rowid")),fieldWiseResulCountObj=subFormFieldWiseResulCountObj[subFormLinkName][rowId].countObj,rowWiseGroupActionVisibleHiddenJsonObj=subFormFieldWiseResulCountObj[subFormLinkName][rowId].groupObj,depRuleObj=subFormFieldWiseResulCountObj[subFormLinkName][rowId].depRuleObj;evalAdvancedRulesForEachRule(rowWiseGroupActionVisibleHiddenJsonObj,fieldWiseResulCountObj,ruleObj,rowId,subFormLinkName,fieldWiseResulMainCountObj,subFormFieldWiseResulCountObj,depRuleObj,elem,ruleResultObj)})}function checkAndUpdateExecutedFieldLinkList(actionResult,actionObj,subFormRulesObj,rowId){if(subFormRulesObj!=undefined&&rowId==undefined){var subFormExecutedFieldLinkNameList=subFormRulesObj.executedlinknamelist;subFormExecutedFieldLinkNameList!=undefined&&actionResult&&subFormExecutedFieldLinkNameList.push(actionObj[ZFRuleConstants.ACTION_LINK_NAME])}}function isActionExecutionNotAllowed(subFormRulesObj,fieldLinkname){if(subFormRulesObj!=undefined){var subFormExecutedFieldLinkNameList=subFormRulesObj.executedlinknamelist;if(subFormExecutedFieldLinkNameList!=undefined&&-1!=$.inArray(fieldLinkname,subFormExecutedFieldLinkNameList))return!0}return!1}function checkAndUpdateMandatoryFieldLinkList(actionResult,linkName,subFormRulesObj,rowId){if(subFormRulesObj!=undefined&&rowId==undefined&&actionResult){var subFormSetMandatoryLinkNameList=subFormRulesObj.setMandatorylinknamelist;subFormSetMandatoryLinkNameList!=undefined&&subFormSetMandatoryLinkNameList.push(linkName)}}function isSetMandatoryRuleSatisfied(subFormRulesObj,fieldLinkname){if(subFormRulesObj!=undefined){var subFormSetMandatoryLinkNameList=subFormRulesObj.setMandatorylinknamelist;if(subFormSetMandatoryLinkNameList!=undefined&&-1!=$.inArray(fieldLinkname,subFormSetMandatoryLinkNameList))return!0}return!1}function isSubFormRulePresentForThisField(subFormLinkname){return zf_rule.subform_linkname_arr.length>0&&-1!=$.inArray(subFormLinkname,zf_rule.subform_linkname_arr)}function isSubFormPresentInAnyAction(subFormLinkname){return zf_rule.subform_linkname_action_arr!=undefined&&zf_rule.subform_linkname_action_arr.length>0&&-1!=$.inArray(subFormLinkname,zf_rule.subform_linkname_action_arr)}function includeSubFormLinkNameInRowWiseResultArr(subFormFieldWiseResulCountObj,subFormLinkName,rowIndex,groupActionVisibleHiddenJsonObj){if(subFormFieldWiseResulCountObj[subFormLinkName][rowIndex]==undefined){subFormFieldWiseResulCountObj[subFormLinkName][rowIndex]={},subFormFieldWiseResulCountObj[subFormLinkName][rowIndex].countObj=JSON.parse(JSON.stringify(zf_rule.adv_result_arr)),subFormFieldWiseResulCountObj[subFormLinkName][rowIndex].groupObj=JSON.parse(JSON.stringify(groupActionVisibleHiddenJsonObj));var depRuleObj={depchoiceObj:{},succussDepRulesList:[]};subFormFieldWiseResulCountObj[subFormLinkName][rowIndex].depRuleObj=depRuleObj}}function initiateEachSubFormFieldCountObjInRowWise(subFormFieldWiseResulCountObj,subFormLinkName,groupActionVisibleHiddenJsonObj){var subFormFldElem=getChildSubFormFieldsUl(getFieldElem(subFormLinkName));$(subFormFldElem).each(function(rowIndex,fldElem){var rowId=parseInt($(fldElem).attr("rowid"));includeSubFormLinkNameInRowWiseResultArr(subFormFieldWiseResulCountObj,subFormLinkName,rowId,groupActionVisibleHiddenJsonObj)})}function initiateAllSubFormFieldCountObjInRowWise(subFormFieldWiseResulCountObj,groupActionVisibleHiddenJsonObj){for(var linkNameIndex=0;linkNameIndex=treatAsUTCForRules(formatedDate))return!0}return!1}function checkIsCurrentWeeksInRules(inpVal,dbValue,dateFormat,dateLocale){if(""!=inpVal&&""!=dbValue){var dateElements=ZFUtil.splitDateVal(inpVal,dateFormat,dateLocale),formatedDate=new Date(dateElements[2],dateElements[1],dateElements[0]),dateElements1=ZFUtil.splitDateVal(dbValue,dateFormat,dateLocale),formatedStartDate=new Date(dateElements1[2],dateElements1[1],dateElements1[0]),formatedEndDate=new Date(dateElements1[2],dateElements1[1],dateElements1[0]),startOfWeekDate=new Date(formatedStartDate.setDate(formatedStartDate.getDate()-formatedStartDate.getDay())),endOfWeekDate=new Date(formatedEndDate.setDate(formatedEndDate.getDate()+(6-formatedEndDate.getDay())));if(treatAsUTCForRules(startOfWeekDate)<=treatAsUTCForRules(formatedDate)&&treatAsUTCForRules(endOfWeekDate)>=treatAsUTCForRules(formatedDate))return!0}return!1}function checkIsNextWeekInRules(inpVal,dbValue,dateFormat,dateLocale){if(""!=inpVal&&""!=dbValue){var dateElements=ZFUtil.splitDateVal(inpVal,dateFormat,dateLocale),formatedDate=new Date(dateElements[2],dateElements[1],dateElements[0]),dateElements1=ZFUtil.splitDateVal(dbValue,dateFormat,dateLocale),formatedStartDate=new Date(dateElements1[2],dateElements1[1],dateElements1[0]),formatedEndDate=new Date(dateElements1[2],dateElements1[1],dateElements1[0]),startOfWeekDate=new Date(formatedStartDate.setDate(formatedStartDate.getDate()+(6-formatedStartDate.getDay()+1))),endOfWeekDate=new Date(formatedEndDate.setDate(formatedEndDate.getDate()+(6-formatedEndDate.getDay()+7)));if(treatAsUTCForRules(startOfWeekDate)<=treatAsUTCForRules(formatedDate)&&treatAsUTCForRules(endOfWeekDate)>=treatAsUTCForRules(formatedDate))return!0}return!1}function checkIsTomorrow(date1,date2,dateFormat,dateLocale,macthingInput){if(""!=date1&&""!=date2&&-1==getDayDifference(date1,date2,dateFormat,dateLocale))return!0;return!1}function checkMonthOperationInRules(inpVal,dbValue,dateFormat,dateLocale,noTobeAdded,matchingType){if(""!=inpVal&&""!=dbValue){var dateElements=ZFUtil.splitDateVal(inpVal,dateFormat,dateLocale),formatedDate=new Date(dateElements[2],dateElements[1],dateElements[0]),dateElements1=ZFUtil.splitDateVal(dbValue,dateFormat,dateLocale),formatedDate1=new Date(dateElements1[2],dateElements1[1],dateElements1[0]);if(1==matchingType)return formatedDate.getFullYear()+noTobeAdded==formatedDate1.getFullYear();if(2==matchingType)return formatedDate.setMonth(formatedDate.getMonth()+noTobeAdded),formatedDate.getFullYear()==formatedDate1.getFullYear()&&formatedDate.getMonth()==formatedDate1.getMonth()}return!1}function checkMonthEqualsInRules(inpVal,dateFormat,dateLocale,matchingVal){if(""!=inpVal){var dateElements=ZFUtil.splitDateVal(inpVal,dateFormat,dateLocale);return new Date(dateElements[2],dateElements[1],dateElements[0]).getMonth()==matchingVal}return!1}function checkYearEqualsInRules(inpVal,dateFormat,dateLocale,matchingVal){if(""!=inpVal){var dateElements=ZFUtil.splitDateVal(inpVal,dateFormat,dateLocale);return new Date(dateElements[2],dateElements[1],dateElements[0]).getFullYear()==matchingVal}return!1}function checkFQInRules(inpVal,dbValue,dateFormat,dateLocale,noTobeAdded){if(""!=inpVal&&""!=dbValue){var dateElements=ZFUtil.splitDateVal(inpVal,dateFormat,dateLocale),formatedDate=new Date(dateElements[2],dateElements[1],dateElements[0]),dateElements1=ZFUtil.splitDateVal(dbValue,dateFormat,dateLocale),formatedDate1=new Date(dateElements1[2],dateElements1[1],dateElements1[0]);return formatedDate.getFullYear()+noTobeAdded==formatedDate1.getFullYear()&&formatedDate.getMonth()<4}return!1}function checkFYInRules(inpVal,dbValue,dateFormat,dateLocale,matchingType){if(""!=inpVal&&""!=dbValue){var dateElements=ZFUtil.splitDateVal(inpVal,dateFormat,dateLocale),formatedDate=new Date(dateElements[2],dateElements[1],dateElements[0]),dateElements1=ZFUtil.splitDateVal(dbValue,dateFormat,dateLocale),formatedDate1=new Date(dateElements1[2],dateElements1[1],dateElements1[0]);if(1==matchingType){if(formatedDate.getFullYear()==formatedDate1.getFullYear()&&formatedDate.getMonth()<3)return!0;if(formatedDate.getFullYear()+1==formatedDate1.getFullYear()&&formatedDate.getMonth()>2)return!0}else if(2==matchingType){if(formatedDate.getFullYear()==formatedDate1.getFullYear()&&formatedDate.getMonth()>2)return!0;if(formatedDate.getFullYear()==formatedDate1.getFullYear()+1&&formatedDate.getMonth()<3)return!0}else if(3==matchingType){if(formatedDate.getFullYear()==formatedDate1.getFullYear()+1&&formatedDate.getMonth()>2)return!0;if(formatedDate.getFullYear()==formatedDate1.getFullYear()+2&&formatedDate.getMonth()<3)return!0}}return!1}function treatAsUTCForRules(date){return date.getTime()-60*date.getTimezoneOffset()*1e3}function getConvertedCurrentDateTime(dateTime,dateLocale,timeFormat){if(dateTime!=undefined&&""!=dateTime){if(2==timeFormat){var splitIndex=dateTime.indexOf(" ");dateTime=dateTime.substring(0,splitIndex)+" "+ZFUtil.convertToGeneralTime_hhmm(dateTime.substring(splitIndex+1),dateLocale)}return dateTime}}function check_IsAnyOneDays(inpVal,condValueArr,dateFormat,dateLocale){if(!check_EmptyValue(inpVal))for(var valIndex=0;valIndex0?(dateTimeVal=getTimeFromDateTimeValue(dateTimeVal),1==timeFormat&&(dateTimeVal=ZFUtil.convertToGeneralTime(dateTimeVal,dateLocale)),dateTimeVal=$.trim(dateTimeVal).replace(" ",":")):""}function getTimeResultForDateTimeField(condnObj,inpVal,timeFormat){var condVal=condnObj[ZFRuleConstants.CONDN_VALUE],fromTimeVal=condVal.substring(0,condVal.indexOf("--zf--"));return check_Time_IsLesserThan(inpVal,condVal.substring(condVal.indexOf("--zf--")+6,condVal.length),timeFormat)&&check_Time_IsGreaterThan(inpVal,fromTimeVal,timeFormat)}function check_Time_IsLesserEqual(inpVal,condVal,timeFormat){var compareStatus=compareTimeWithFormat(inpVal,condVal,timeFormat);return compareStatus===Num_Status.LESSER||compareStatus===Num_Status.EQUAL}function check_Time_IsGreaterEqual(inpVal,condVal,timeFormat){var compareStatus=compareTimeWithFormat(inpVal,condVal,timeFormat);return compareStatus===Num_Status.GREATER||compareStatus===Num_Status.EQUAL}function isRulesTimePartOfDateTimeFieldBetweenOperator(compOper){return compOper==Operators.YESTERDAY_BETWEEN||compOper==Operators.YESTERDAY_NOT_BETWEEN||compOper==Operators.TODAY_BETWEEN||compOper==Operators.TODAY_NOT_BETWEEN||compOper==Operators.TOMORROW_BETWEEN||compOper==Operators.TOMORROW_NOT_BETWEEN||compOper==Operators.IS_BETWEENTIME||compOper==Operators.IS_NOT_BETWEENTIME}function isRulesTimePartOfDateTimeFieldOperator(compOper){return compOper==Operators.YESTERDAY_LESSTHAN||compOper==Operators.YESTERDAY_LESSEQUAL||compOper==Operators.YESTERDAY_GREATERTHAN||compOper==Operators.YESTERDAY_GREATEREQUAL||compOper==Operators.YESTERDAY_ISTIME||compOper==Operators.YESTERDAY_ISNOTTIME||compOper==Operators.TODAY_LESSTHAN||compOper==Operators.TODAY_LESSEQUAL||compOper==Operators.TODAY_GREATERTHAN||compOper==Operators.TODAY_GREATEREQUAL||compOper==Operators.TODAY_ISTIME||compOper==Operators.TODAY_ISNOTTIME||compOper==Operators.TOMORROW_LESSTHAN||compOper==Operators.TOMORROW_LESSEQUAL||compOper==Operators.TOMORROW_GREATERTHAN||compOper==Operators.TOMORROW_GREATEREQUAL||compOper==Operators.TOMORROW_ISTIME||compOper==Operators.TOMORROW_ISNOTTIME||compOper==Operators.TODAY_ISTIME||compOper==Operators.TODAY_ISNOTTIME||compOper==Operators.IS_LESSTHAN_TIME||compOper==Operators.IS_LESSEQUAL_TIME||compOper==Operators.IS_GREATERTHAN_TIME||compOper==Operators.TOMORROW_GREATEREQUAL||compOper==Operators.IS_GREATEREQUAL_TIME||compOper==Operators.IS_TIME||compOper==Operators.IS_NOTTIME}function executeDepRules(dependencyAction,rowId,depResult,choiceList,fieldType,elem){var fldLnkName=dependencyAction.actionLinkName;if(elem!=undefined&&(isNewHtmlDOM()?$(elem).closest("div[elname=livefield-elem]").attr("linkname"):$(elem).parents("li[elname=livefield-elem]").attr("linkname"))==fldLnkName)return;if(isSubFormField(fldLnkName))if(rowId!=undefined){if(0!=rowId)executeDependentRuleForEachField(childLi=getFieldElementForDepRules(fldLnkName,rowId),fldLnkName,rowId,depResult,choiceList,fieldType,elem);if(isSubFormPopup(fldLnkName)&&!isDepRuleShowAllChoice(choiceList)&&0!=rowId)resetSfCardSummaryValue(getFieldElementForDepRules(fldLnkName,rowId),subFormElem=getParentSubFormElem(fldLnkName),fldLnkName,rowId)}else if(isSubFormPopup(fldLnkName)){var subFormFldElem=$("#subFormPopUp").find("[linkname="+fldLnkName+"]");if($(subFormFldElem).is(":visible")){var rowNo=$("#subFormPopUp").attr("thisrowid");rowNo!=undefined&&0!=rowNo&&executeDependentRuleForEachField(subFormFldElem,fldLnkName,rowNo,depResult,choiceList,fieldType,elem)}var childFieldLiInCard=getFieldElementForDepRules(fldLnkName,undefined),subFormElem=getParentSubFormElem(fldLnkName);$(childFieldLiInCard).each(function(index,childFld){if($(childFld).closest("[elname=subFormFieldsUl]").length>0){var subformRowNo=$(childFld).closest("[elname=subFormFieldsUl]").attr("rowid");executeDependentRuleForEachField(childFld,fldLnkName,subformRowNo,depResult,choiceList,fieldType,elem),isDepRuleShowAllChoice(choiceList)||resetSfCardSummaryValue(childFld,subFormElem,fldLnkName,subformRowNo)}})}else{var childLi=getFieldElementForDepRules(fldLnkName,undefined);$(childLi).each(function(index,childFld){if($(childFld).closest("[elname=subFormFieldsUl]").length>0){var rowNo=$(childFld).closest("[elname=subFormFieldsUl]").attr("rowid");0!=rowNo&&executeDependentRuleForEachField(childFld,fldLnkName,rowNo,depResult,choiceList,fieldType,elem)}})}else executeDependentRuleForEachField(childLi=getFieldElementForDepRules(fldLnkName,undefined),fldLnkName,rowId,depResult,choiceList,fieldType,elem)}function resetSfCardSummaryValue(childFld,subFormElem,fldLnkName,rowNo){var subFormCardElem=$(subFormElem).find("div[elname=sfcardelem][cardrowid="+rowNo+"]");$(subFormCardElem).find('div[elname="sfCardContDiv"][linkname="'+fldLnkName+'"]').find("[elname=recordVal]").text(getValueFromLiForSFCardForRules(childFld))}function isOtherValueSelected(cardContDiv){return"true"==$(cardContDiv).find('[elname="recordVal"]').attr("isOthersValueSelected")}function resetSfCardSummary(sfCardElem,choiceList){var isChoiceListHasOther=-1!=$.inArray("zfs-others-zfs",choiceList);$(sfCardElem).each(function(index,subFormCardElem){var cardValArr=$.trim($(subFormCardElem).find("[elname=recordVal]").text()).split(", "),isOtherSelected=isOtherValueSelected(subFormCardElem),newCardValArr=[];if(choiceList.length>0){for(var cardItr in cardValArr){var cardVal=cardValArr[cardItr];(-1!=$.inArray(cardVal,choiceList)||isChoiceListHasOther&&isOtherSelected)&&newCardValArr.push(cardVal)}newCardValArr.length>0&&(newCardValArr=newCardValArr.join(", "))}$(subFormCardElem).find("[elname=recordVal]").text(newCardValArr)})}function resetSfCardSummaryForOptGroup(fldLinkName,fldElem,subFormElem,rowId){if(isSubFormPopup(fldLinkName)){subFormElem=getParentSubFormElem(fldLinkName);rowId!=undefined?resetSfCardSummaryValue(fldElem,subFormElem,fldLinkName,rowId):$(fldElem).each(function(index,fieldElemDiv){var sfRowId=isNewHtmlDOM()?$(fieldElemDiv).closest('div[elname="subFormFieldsUl"]').attr("rowid"):$(fieldElemDiv).closest('ul[elname="subFormFieldsUl"]').attr("rowid");sfRowId!=undefined&&0!=sfRowId&&resetSfCardSummaryValue(fieldElemDiv,subFormElem,fldLinkName,sfRowId)})}}function getDepChoicesInZFRulesFormat(dependencyRuleObj){var depChoiceArr=dependencyRuleObj.depchoices,depRuleArr=[];for(var depRuleIdx in depChoiceArr){var ruleObj={},depRuleObj=depChoiceArr[depRuleIdx];ruleObj.conditionsObj=depRuleObj.conditions,ruleObj.logical_oper=depRuleObj.logical_oper,ruleObj.issubform_rule=dependencyRuleObj.issubform_rule,ruleObj.subform_linkname=dependencyRuleObj.subform_linkname,ruleObj.subform_linkname!=undefined&&-1==$.inArray(ruleObj.subform_linkname,zf_rule.subform_linkname_arr)&&zf_rule.subform_linkname_arr.push(ruleObj.subform_linkname),replaceAdvRulesFieldLinkNameKey(ruleObj.conditionsObj,[]);var rule_actions=depRuleObj[ZFRuleConstants.ACTIONS];for(var y in ruleObj.actionsObj={},rule_actions){var zfAction=new ZFAction;zfAction.ruleaction=rule_actions[y][ZFRuleConstants.ACTION],zfAction.actionLinkName=rule_actions[y][ZFRuleConstants.FIELD_LINK_NAME],rule_actions[y].sub_linkname!=undefined&&(zfAction.sub_linkname=rule_actions[y].sub_linkname,-1==$.inArray(zfAction.sub_linkname,zf_rule.subform_linkname_action_arr)&&zf_rule.subform_linkname_action_arr.push(zfAction.sub_linkname)),rule_actions[y][ZFRuleConstants.ACTION]==ZFRuleConstants.SHOW_GROUP||rule_actions[y][ZFRuleConstants.ACTION]==ZFRuleConstants.HIDE_GROUP?zfAction.group_names=rule_actions[y][ZFRuleConstants.FIELD.OPT_GROUP_NAMES]:rule_actions[y][ZFRuleConstants.ACTION]==ZFRuleConstants.FILTER_OPTS&&(zfAction.filterchoices=rule_actions[y].filterchoices),ruleObj.actionsObj[y]=zfAction}depRuleArr.push(ruleObj)}return depRuleArr}function getFieldElementForDepRules(fldLnkName,rowId){var childLi;return isSubFormField(fldLnkName)?rowId!=undefined?childLi=getFieldElem(fldLnkName+"_"+rowId):(childLi=getFieldElemWithFldLinkNameAttr(fldLnkName),isOneFieldForm()&&(childLi=$(childLi).filter('div[elname="livefield-elem"]'))):childLi=getFieldElem(fldLnkName),childLi}function getDepRuleSelectedValArr(childFld){var currValArr=[];return $(childFld).find("option:selected").each(function(index,elem){"-Select-"!=$(elem).val()&&currValArr.push($(elem).val())}),currValArr}function isDepRuleShowAllChoice(choiceList){for(choiceIndex in choiceList)if(choiceList[choiceIndex]==ZFRuleConstants.DEPENDENCY_RULE.SHOW_ALL_CHOICES)return!0;return!1}function isAnyPreviousValueSelectedInDepRule(childLi,childFld,currValArr,availableOptionList){return $(childLi).find("div[elname=allow-others-div]").hide(),currValArr.length>0&&selectCurrentValInDepRules(currValArr,availableOptionList,childLi,childFld)}function includeAllChoicesForDepRules(childLi,childFld,fldLnkName,availableOptionList){$(childFld).empty();var optElem=$(childLi).find("select[name="+fldLnkName+"-temp-select]").find("option").clone();$.each(optElem,function(index,elem){availableOptionList.push($(elem).val()),childFld[0].appendChild(elem)})}function executeDependentRuleForEachField(childLi,fldLnkName,rowId,depResult,choiceList,fieldType,elem){rowId!=undefined&&(fldLnkName=fldLnkName+"_"+rowId);var childFld=$(childLi).find("select[name="+fldLnkName+"]"),currValArr=getDepRuleSelectedValArr(childFld),clonedSltElem=$(childLi).find("select[name="+fldLnkName+"-temp-select]"),availableOptionList=[];if(depResult)if(0==choiceList.length){if($(childFld).empty(),fieldType==ZFFieldTypeConstants.DROPDOWN){var selectElem=$(clonedSltElem).find("option[value=-Select-]").clone();$.each(selectElem,function(index,optElem){childFld[0].appendChild(optElem)})}}else if(isDepRuleShowAllChoice(choiceList))includeAllChoicesForDepRules(childLi,childFld,fldLnkName,availableOptionList);else{if($(childFld).empty(),fieldType==ZFFieldTypeConstants.DROPDOWN){selectElem=$(clonedSltElem).find("option[value=-Select-]").clone();$.each(selectElem,function(index,optElem){childFld[0].appendChild(optElem)})}$(clonedSltElem).find("option").each(function(index,optionElem){if(-1!=$.inArray($(optionElem).val(),choiceList)){var clonedChoiceElem=$(optionElem).clone();availableOptionList.push($(clonedChoiceElem).val()),$.each(clonedChoiceElem,function(index,optElem){childFld[0].appendChild(optElem),$(optElem).attr("selected",!1)})}})}else includeAllChoicesForDepRules(childLi,childFld,fldLnkName,availableOptionList);var isAnyValueSelected=isAnyPreviousValueSelectedInDepRule(childLi,childFld,currValArr,availableOptionList);if(fieldType!=ZFFieldTypeConstants.DROPDOWN||isAnyValueSelected||$(childFld).val("-Select-"),typeof ZFLive!=ResponseKey.UNDEFINED&&$(childFld).hasClass("select2-hidden-accessible")){var onChangeEvents;fieldType==ZFFieldTypeConstants.DROPDOWN&&isAnyValueSelected&&(onChangeEvents=$(childFld).attr("onchange"),$(childFld).removeAttr("onchange")),$(childFld).trigger("change.select2"),fieldType==ZFFieldTypeConstants.DROPDOWN&&isAnyValueSelected&&$(childFld).attr("onchange",onChangeEvents);var currentElem=isNewHtmlDOM()?$(elem).closest("div[elname=livefield-elem]"):$(elem).parents("li[elname=livefield-elem]");$(currentElem).attr("comptype")==ZFFieldTypeConstants.DROPDOWN&&"allow-others-text"==$(elem).attr("name")&&ZFLive.showLiveDropdownOthers($(currentElem).find("select[name="+$(currentElem).attr("compname")+"]"))}}function selectCurrentValInDepRules(currValArr,availableOptionList,childLi,childFld){var isAnyValueSelected=!1;return $(childFld).find("option").each(function(index,optionElem){-1!=$.inArray($(optionElem).val(),currValArr)&&-1!=$.inArray($(optionElem).val(),availableOptionList)&&(isAnyValueSelected=!0,$(optionElem).attr("selected",!0),"zfs-others-zfs"==$(optionElem).val()&&$(childLi).find("div[elname=allow-others-div]").show())}),isAnyValueSelected}function check_IsAnyChoiceInOptionGroup(conditionGrpName,selectedGrpName){return!check_EmptyValue(selectedGrpName)&&conditionGrpName==selectedGrpName}function check_isAnyGroupInOptionGroup(conditionGrpNameArr,selectedGrpName){return!check_EmptyValue(selectedGrpName)&&-1!=$.inArray(selectedGrpName,conditionGrpNameArr)}function setAdvRulesGroupCountInResultJson(fieldWiseResulCountObj,fldLnkName,groupCountKey){var resultObj=fieldWiseResulCountObj[fldLnkName];return resultObj[groupCountKey]=0,resultObj}function bindEventsWithOrWithOutDelay(liElem,allEvents,timeOutEvents,nonTimeOutEvents,eventElem){if(isRulesExecutionWithDelayEnabled()){var rulesDelayTime={};evalAdvRulesAfterSetTimeOut(liElem,timeOutEvents,eventElem,rulesDelayTime),void 0!==nonTimeOutEvents&&$.trim(nonTimeOutEvents).length>0&&evalAdvRulesOnBindAfterClearTimeOut(liElem,nonTimeOutEvents,eventElem,rulesDelayTime)}else evalAdvRulesOnBind(liElem,allEvents,eventElem)}function bindEventsWithOrWithOutDelayForCompositFields(liElem){if(isRulesExecutionWithDelayEnabled()){var rulesDelayTime={};evalAdvRulesAfterSetTimeOut(liElem,"keyup","input",rulesDelayTime),evalAdvRulesOnBindAfterClearTimeOut(liElem,"change","select",rulesDelayTime),evalAdvRulesOnBindAfterClearTimeOut(liElem,"click","input",rulesDelayTime)}else evalAdvRulesOnBind(liElem,"change","select"),evalAdvRulesOnBind(liElem,"click keyup","input")}function bindFunctionForEvalAdvRules(elem){if(isAdvancedRule())zf_rule.evalAdvRulesOnFieldStateChange(zf_rule.on_form_load_ruleorder,elem);else{var groupActionVisibleHiddenJsonObj={};groupActionVisibleHiddenJsonObj[ZFRuleConstants.SHOW_GROUP]={},groupActionVisibleHiddenJsonObj[ZFRuleConstants.HIDE_GROUP]={};var ruleResultObj=getRuleResultObject();zf_rule.evalRules(elem,[],groupActionVisibleHiddenJsonObj,ruleResultObj),performShowHideGroupActionsInSelectFields(groupActionVisibleHiddenJsonObj),typeof ZFLive!=ResponseKey.UNDEFINED&&ZFLive.checkAndPrefillFldLabelAfterRule(ruleResultObj,groupActionVisibleHiddenJsonObj)}isOneFieldForm()&&updateSlides(),triggerFormResize()}function isRulesExecutionWithDelayEnabled(){return"undefined"!=typeof zf_rule.isdlynd&&zf_rule.isdlynd}function getDelayInMs(){return"undefined"!=typeof zf_rule.dlyms?parseInt(zf_rule.dlyms):100}function clearTimeDelayAddedForRuleEvaluation(rulesDelayTime){"undefined"!=typeof rulesDelayTime.timeOutId&&(clearTimeout(rulesDelayTime.timeOutId),rulesDelayTime.timeOutId=undefined)}function evalAdvRulesOnBind(liElem,events,eventElem){liElem.on(events,eventElem,function(){bindFunctionForEvalAdvRules(this)})}function evalAdvRulesOnBindAfterClearTimeOut(liElem,events,eventElem,rulesDelayTime){liElem.on(events,eventElem,function(){clearTimeDelayAddedForRuleEvaluation(rulesDelayTime),bindFunctionForEvalAdvRules(this)})}function evalAdvRulesAfterSetTimeOut(liElem,events,eventElem,rulesDelayTime){liElem.on(events,eventElem,function(){clearTimeDelayAddedForRuleEvaluation(rulesDelayTime);var elemToBeTriggered=this;rulesDelayTime.timeOutId=setTimeout(function(){bindFunctionForEvalAdvRules(elemToBeTriggered)},getDelayInMs())})}function isGridFieldConfiguredInRules(gridFieldElem){return $(gridFieldElem).closest("[elemtype=gridField]").length>0}function isGridElemHiddenInRules(gridFieldElem){var gridElem=$(gridFieldElem).closest("[elemtype=gridField]");return"false"==$(gridElem).attr("needdata")}function isDepRuleShowAllGroups(ruleObj){if(ruleObj.isDepRule){var actionJson=ruleObj.actionsObj[0];if(actionJson[ZFRuleConstants.RULE_ACTION]==ZFRuleConstants.SHOW_GROUP&&actionJson[ZFRuleConstants.FIELD.OPT_GROUP_NAMES]!=undefined&&1==actionJson[ZFRuleConstants.FIELD.OPT_GROUP_NAMES].length&&actionJson[ZFRuleConstants.FIELD.OPT_GROUP_NAMES][0]==ZFRuleConstants.DEPENDENCY_RULE.SHOW_ALL_CHOICES)return!0}return!1}function getValueFromLiForSFCardForRules(childElem){var id=$(childElem).attr("id"),comptype=parseInt($(childElem).attr("comptype"));if(id){if(comptype==ZFFieldTypeConstants.DROPDOWN){var choiceVal="",fldLinkName=$(childElem).attr("compname");return $(childElem).find("select[name='"+fldLinkName+"']").each(function(indexelem,elemnew){if("-Select-"!=$(elemnew).val()&&"zfs-others-zfs"!=$(elemnew).val()&&null!=$(elemnew).val())if($(elemnew).find("optgroup").length>0){var groupName=getGroupNameofSelectedChoice(elemnew,fldLinkName);choiceVal=groupName+" - "+$(elemnew).find("option:selected").text()}else choiceVal=$(elemnew).find("option:selected").text();else"zfs-others-zfs"==$(elemnew).val()&&(choiceVal=$(childElem).find("input[name=allow-others-text]").val())}),choiceVal}if(comptype==ZFFieldTypeConstants.MULTIPLE_CHOICE){var multiJsonArr=[];fldLinkName=$(childElem).attr("compname");return $(childElem).find("select[name='"+fldLinkName+"']").each(function(indexelem,elemnew){for(var id=$(elemnew).attr("id"),txtSelectedObj=document.getElementById(id),i=0;i0?getFieldElem(fieldLinkname+"_"+rowId):getFieldElem(fieldLinkname)}function setRowIdInCondObj(formCondObj,rowId){var fieldElem=getParentSubFormElem(formCondObj[ZFRuleConstants.FieldLinkName]);rowId!=undefined&&fieldElem.length>0&&(formCondObj.rowid=rowId)}function isAnotherFieldInvolvedInRuleCondition(condtionObj){return"undefined"!=typeof condtionObj[ZFRuleConstants.VALUE_TYPE]&&condtionObj[ZFRuleConstants.VALUE_TYPE]==ZFRuleConstants.CONDITION_VALUE_TYPE.FIELD_REFERENCE}function setAndGetAnotherFieldValueInConditionObj(condtionObj,condFldElem,recalculateFormula,valueFieldElem){var valueFieldLinkName=getDynaicValueFieldLinkName(condtionObj);if(0==valueFieldElem.length)return!1;if(!isFieldAlreadyVisibleByRules(valueFieldElem,valueFieldLinkName))return!1;var fieldType=parseInt(valueFieldElem.attr("comptype"));typeof ZFLive!=ResponseKey.UNDEFINED&&recalculateFormula&&fieldType===ZFFieldTypeConstants.FORMULA&&ZFLive.evalExpressionOnFieldRuleExecution(valueFieldLinkName);var condValue=reFormatAndGetAnotherFieldValue(condFldElem,valueFieldElem,condtionObj);return void 0!==condValue&&(condtionObj[ZFRuleConstants.CONDN_VALUE]=condValue,!0)}function isFieldAlreadyVisibleByRules(fldLinkElem,fieldLinkname){var isFieldVisible=!1,pageElem=isStandardForm()?$(fldLinkElem).closest("div[elname=formBodyULName]"):$(fldLinkElem).closest("ul[elname=formBodyULName]");if("true"==$(fldLinkElem).attr("needdata")&&"true"==$(pageElem).attr("needpagedata")||isOneFieldForm()&&"true"==$(fldLinkElem).attr("needdata"))isFieldVisible=!0;else{var subFormElem=getParentSubFormElem(fieldLinkname),sfPageElem=isStandardForm()?$(subFormElem).closest("div[elname=formBodyULName]"):$(subFormElem).closest("ul[elname=formBodyULName]");"true"==$(fldLinkElem).attr("needdata")&&"true"==$(sfPageElem).attr("needpagedata")&&(isFieldVisible=!0)}return isFieldVisible}function reFormatAndGetAnotherFieldValue(condFldElem,valueFieldElem,condtionObj){var anotherFieldValue=getDynamicValueAfterValidation(condFldElem,valueFieldElem,condtionObj);if(anotherFieldValue!=undefined){if(parseInt(valueFieldElem.attr("comptype"))==ZFFieldTypeConstants.TIME){if(":"==anotherFieldValue||"::"==anotherFieldValue)return""}else if(ZFUtil.isEmptyValue(anotherFieldValue))return"";var condFldType=parseInt(condFldElem.attr("comptype"));return condFldType==ZFFieldTypeConstants.DATETIME?getDynamicFieldDateTimeValue(anotherFieldValue,condFldElem,valueFieldElem):condFldType==ZFFieldTypeConstants.TIME?getTimeConvertedValueorDynamicField(anotherFieldValue,condFldElem,valueFieldElem):condFldType==ZFFieldTypeConstants.DATE?getDynamicFieldDateValue(anotherFieldValue,condFldElem,valueFieldElem):condFldType==ZFFieldTypeConstants.MONTHYEAR?getDynamicMonthYearFieldValue(anotherFieldValue):condFldType==ZFFieldTypeConstants.DECIMAL||condFldType==ZFFieldTypeConstants.CURRENCY||condFldType==ZFFieldTypeConstants.FORMULA||condFldType==ZFFieldTypeConstants.NUMBER||condFldType==ZFFieldTypeConstants.SLIDER||condFldType==ZFFieldTypeConstants.RATING?getDynamicNumericFieldValue(anotherFieldValue,condFldElem,valueFieldElem):anotherFieldValue}}function getCountryCodeForDynamicRules(fldElem){if("true"==$(fldElem).find("input").attr("iscodeEnabled")){var fldLinkName=$(fldElem).attr("compname"),phoneInputElem=$(fldElem).find("#"+fldLinkName),selectedCountryData=$(phoneInputElem).intlTelInput("getSelectedCountryData");if(null!=selectedCountryData.dialCode)return getPhoneIsoCodeFromCountry(selectedCountryData);if("true"==$(phoneInputElem).attr("frompdf")){var isocodeVal=$.trim($(phoneInputElem).attr("isocodval"));if(isocodeVal.length>0)return isocodeVal}}return null}function getDynamicFieldDateTimeValue(anotherFieldValue,condFldElem,valueFieldElem){var valFldType=parseInt(valueFieldElem.attr("comptype"));return valFldType==ZFFieldTypeConstants.DATETIME?getDateTimeConvertedValueForDynamicField(anotherFieldValue,condFldElem,valueFieldElem):valFldType==ZFFieldTypeConstants.DATE?formatAndGetDateIntoDateTimeValueForDynamicField(anotherFieldValue,condFldElem,valueFieldElem):void 0}function getTimeConvertedValueorDynamicField(anotherFieldValue,condFldElem,valueFieldElem){var conditionTimeFormat=parseInt($(condFldElem).attr("timeformat")),valueTimeFormat=parseInt($(valueFieldElem).attr("timeformat")),dateFormatInp=$("#zf_date_format"),dateLocale=dateFormatInp.attr("dateLocale");dateFormatInp.val();if(validateTimeWithLocale(anotherFieldValue,dateLocale,valueTimeFormat))return conditionTimeFormat==valueTimeFormat?anotherFieldValue:ZFUtil.convertTimeValToTimeFormat(anotherFieldValue,valueTimeFormat,conditionTimeFormat)}function getDateTimeConvertedValueForDynamicField(anotherFieldValue,condFldElem,valueFieldElem){var conditionTimeFormat=parseInt($(condFldElem).attr("timeformat")),valueTimeFormat=parseInt($(valueFieldElem).attr("timeformat")),dateFormatInp=$("#zf_date_format"),dateLocale=dateFormatInp.attr("dateLocale"),dateFormat=dateFormatInp.val();if(ZFUtil.validateDateTime(anotherFieldValue,dateFormat,dateLocale,valueTimeFormat))return conditionTimeFormat==valueTimeFormat?anotherFieldValue:ZFUtil.convertDateTimeValToTimeFormat(anotherFieldValue,dateFormat,dateLocale,valueTimeFormat,conditionTimeFormat)}function formatAndGetDateIntoDateTimeValueForDynamicField(anotherFieldValue,condFldElem,valueFieldElem){var condFieldValue=getInputValue($(condFldElem).attr("compname"),parseInt($(condFldElem).attr("comptype"))),dateFormatInp=$("#zf_date_format"),dateLocale=dateFormatInp.attr("dateLocale"),dateFormat=dateFormatInp.val(),condFieldTimeFormat=parseInt($(condFldElem).attr("timeformat"));if(!ZFUtil.isEmptyValue(condFieldValue)&&ZFUtil.validateDateTime(condFieldValue,dateFormat,dateLocale,condFieldTimeFormat)){if(ZFUtil.validateDate(anotherFieldValue,dateFormat,dateLocale)){var condFieldTimeValue=condFieldValue.split(" ");return condFieldTimeFormat==TimeFormat.HOURS_12.CODE?$.trim(anotherFieldValue)+" "+condFieldTimeValue[1]+" "+condFieldTimeValue[2]:$.trim(anotherFieldValue)+" "+condFieldTimeValue[1]}}else if(ZFUtil.isEmptyValue(condFieldValue)&&ZFUtil.validateDate(anotherFieldValue,dateFormat,dateLocale))return anotherFieldValue}function getDynamicFieldDateValue(anotherFieldValue,condFldElem,valueFieldElem){var dateFormatInp=$("#zf_date_format"),dateLocale=dateFormatInp.attr("dateLocale"),dateFormat=dateFormatInp.val();if(parseInt(valueFieldElem.attr("comptype"))==ZFFieldTypeConstants.DATETIME){var valueTimeFormat=parseInt($(valueFieldElem).attr("timeformat"));if(ZFUtil.validateDateTime(anotherFieldValue,dateFormat,dateLocale,valueTimeFormat))return anotherFieldValue.split(" ")[0]}else if(ZFUtil.validateDate(anotherFieldValue,dateFormat,dateLocale))return anotherFieldValue}function getDynamicNumericFieldValue(anotherFieldValue,condFldElem,valueFieldElem){if(!checkNumeric(anotherFieldValue))return anotherFieldValue}function getDynamicMonthYearFieldValue(anotherFieldValue){var dateFormatInp=$("#zf_date_format"),dateFormat=dateFormatInp.val(),dateLocale=dateFormatInp.attr("dateLocale");if(ZFUtil.validateMonthYear(anotherFieldValue,dateFormat,dateLocale))return anotherFieldValue}function isCountryChangeEventNeeded(liElem){if($(liElem).find("div[elname=phoneFormatElem]").attr("phoneFormat")===ZFPhoneFormatConstants.INTERNATIONAL){var inputElem=$(liElem).find("div[elname=phoneFld]").find("input");if("true"==$(inputElem).attr("iscodeEnabled"))return!0}return!1}function parseAndReturnDynamicRulesEmptyStringVal(condFldElem,operator,condValue){var isEmptStringInRightVal=isEmptyStringConfiguredInCondForDynamicRules(condValue);if("NOT_EQUAL"==operator){checkAndReturnCondResult(condFldElem);return!isEmptStringInRightVal||checkAndReturnCondResult(condFldElem)}return isEmptStringInRightVal}function isEmptyStringConfiguredInCondForDynamicRules(condVal){return 0==condVal.length}function getDynamicRuleRatingVal(fldElem){var ratingVal=fldElem.find("div[elname=ratingSubData]").find("a").attr("value");return ratingVal==undefined?"":ratingVal}function getDynamicRulesFieldValue(valueFieldElem,compLinkName){var valueFieldType=parseInt(valueFieldElem.attr("comptype"));if(valueFieldType==ZFFieldTypeConstants.TIME)return getDynamicRulesInputValForTime(valueFieldElem);if(valueFieldType==ZFFieldTypeConstants.RATING)return getDynamicRuleRatingVal(valueFieldElem);if(valueFieldType==ZFFieldTypeConstants.NAME||valueFieldType==ZFFieldTypeConstants.ADDRESS){if(void 0!==compLinkName){var compArr=getInputValue($(valueFieldElem).attr("compname"),valueFieldType,compLinkName);return void 0!==compArr&&compArr.length>0?compArr[0]:""}return getInputValue($(valueFieldElem).attr("compname"),valueFieldType)}if(valueFieldType==ZFFieldTypeConstants.DROPDOWN){var dropDownVal=getInputValue($(valueFieldElem).attr("compname"),valueFieldType);return void 0===dropDownVal?"":dropDownVal}return getInputValue($(valueFieldElem).attr("compname"),valueFieldType)}function checkAndReturnCondResult(condFldElem,inputValue){var dateFormatInp=$("#zf_date_format"),dateLocale=dateFormatInp.attr("dateLocale"),dateFormat=dateFormatInp.val(),condFieldType=parseInt(condFldElem.attr("comptype"));if(condFieldType==ZFFieldTypeConstants.DATE){if(!ZFUtil.validateDate(inputValue,dateFormat,dateLocale))return!1}else if(condFieldType==ZFFieldTypeConstants.DATETIME){var condTimeFormat=parseInt($(condFldElem).attr("timeformat"));if(!ZFUtil.validateDateTime(inputValue,dateFormat,dateLocale,condTimeFormat))return!1}else if(condFieldType==ZFFieldTypeConstants.TIME){condTimeFormat=parseInt($(condFldElem).attr("timeformat"));if(!validateTimeWithLocale(inputValue,dateLocale,condTimeFormat))return!1}else if(condFieldType==ZFFieldTypeConstants.MONTHYEAR&&!ZFUtil.validateMonthYear(inputValue,dateFormat,dateLocale))return!1;return!0}function isEmptyValueConfiguredInLeftField(condFldElem,inputValue){var condFieldType=parseInt(condFldElem.attr("comptype"));return 0==$.trim(inputValue).length||condFieldType==ZFFieldTypeConstants.TIME&&(":"==inputValue||"::"==inputValue)}function getDynamicRulesInputValForTime(fldElem){var timeVal="";return fldElem.find("select").each(function(index,elem){var timeCompName=$(elem).attr("timecomp");"hours"==timeCompName?timeVal=$.trim($(elem).val()):"minutes"==timeCompName?timeVal=timeVal+":"+$.trim($(elem).val()):"Meridiem"==timeCompName&&(timeVal=timeVal+" "+$.trim($(elem).val()))}),$.trim(timeVal)}function checkDynamicRulesContainsEmptyString(condtionObj,fldLinkElem){var isEmptStringInRightVal=isEmptyStringConfiguredInCondForDynamicRules(condtionObj.condValue),inputValue=getDynamicRulesFieldValue(fldLinkElem,condtionObj[ZFRuleConstants.COMPONENT_LINK_NAME]),isEmptyValLField=isEmptyValueConfiguredInLeftField(fldLinkElem,inputValue);if("NOT_EQUAL"===condtionObj.operator)if(parseInt(fldLinkElem.attr("comptype"))==ZFFieldTypeConstants.FORMULA){if(isEmptStringInRightVal)return!0}else{if(isEmptyValLField)return!isEmptStringInRightVal;if(!checkAndReturnCondResult(fldLinkElem,inputValue))return!1;if(!isEmptyValLField&&isEmptStringInRightVal)return!0}else if(parseInt(fldLinkElem.attr("comptype"))==ZFFieldTypeConstants.FORMULA){if(isEmptStringInRightVal)return!1}else if(isEmptStringInRightVal||isEmptyValLField)return!1;return undefined}function getDynamicValueAfterValidation(condFldElem,valueFieldElem,condtionObj){var condFldType=parseInt(condFldElem.attr("comptype")),valFldType=parseInt(valueFieldElem.attr("comptype"));if(condFldType!=ZFFieldTypeConstants.SINGLE_LINE||valFldType!=ZFFieldTypeConstants.DECIMAL&&valFldType!=ZFFieldTypeConstants.CURRENCY)return valFldType==ZFFieldTypeConstants.NAME||valFldType==ZFFieldTypeConstants.ADDRESS?getDynamicRulesFieldValue(valueFieldElem,condtionObj.valclname):getDynamicRulesFieldValue(valueFieldElem);var decimalFormat=valueFieldElem.attr("decimalformat"),rightFldVal=$(valueFieldElem).find("input").val(),reFormattedVal=$.trim(ZFUtil.getReformattedDecimal(rightFldVal,decimalFormat));return ZFUtil.getFormattedDecimal(reFormattedVal,decimalFormat)}function isOptionGroupFieldConfiguredInDynamicRules(fldElem){var optionElem=$(fldElem).find("option:selected"),optGrpElem=$(optionElem).closest("optgroup");return $(optGrpElem).length>0}function getSelectedGroupNameInDynamicRules(fldElem){var optionElem=$(fldElem).find("option:selected"),optGrpElem=$(optionElem).closest("optgroup");return $.trim($(optGrpElem).attr("value"))}function getDynamicRulesFieldLinkName(valueFieldLinkName,valFldType){return valFldType!=ZFFieldTypeConstants.NAME&&valFldType!=ZFFieldTypeConstants.ADDRESS||-1==valueFieldLinkName.indexOf("_")||(valueFieldLinkName=valueFieldLinkName.substring(0,valueFieldLinkName.indexOf("_"))),valueFieldLinkName}function preEvaluateAndReturnDynamicRulesConidtion(condtionObj,fldLinkElem,recalculateFormula){var valueFieldElem=getFieldElemByLinkName(condtionObj[ZFRuleConstants.CONDN_VALUE],condtionObj.rowid);if(!setAndGetAnotherFieldValueInConditionObj(condtionObj,fldLinkElem,recalculateFormula,valueFieldElem))return returnDynamicRulePreEvalResultObj(!0,!1);var isDynamicRuleContaindsEmptyVal=checkDynamicRulesContainsEmptyString(condtionObj,fldLinkElem);if(void 0!==isDynamicRuleContaindsEmptyVal)return returnDynamicRulePreEvalResultObj(!0,isDynamicRuleContaindsEmptyVal);if(parseInt(fldLinkElem.attr("comptype"))==ZFFieldTypeConstants.PHONE){var condCountryCode=getCountryCodeForDynamicRules(fldLinkElem),valCountryCode=getCountryCodeForDynamicRules(valueFieldElem);if(condCountryCode!=undefined&&valCountryCode!=undefined)if("NOT_EQUAL"===condtionObj.operator){if(condCountryCode!=valCountryCode)return returnDynamicRulePreEvalResultObj(!0,!0)}else if("EQUALS"===condtionObj.operator&&condCountryCode!=valCountryCode)return returnDynamicRulePreEvalResultObj(!0,!1)}else{if(parseInt(fldLinkElem.attr("comptype"))==ZFFieldTypeConstants.DECISION_BOX||parseInt(fldLinkElem.attr("comptype"))==ZFFieldTypeConstants.TERMS_CONDITIONS){var leftFieldState=getInputValue($(fldLinkElem).attr("compname"),fldLinkElem.attr("comptype")),rightFieldState=condtionObj[ZFRuleConstants.CONDN_VALUE];return returnDynamicRulePreEvalResultObj(!0,condtionObj.operator==Operators.EQUALS?leftFieldState==rightFieldState:leftFieldState!=rightFieldState)}parseInt(fldLinkElem.attr("comptype"))==ZFFieldTypeConstants.DROPDOWN&&typeof ZFLive!=ResponseKey.UNDEFINED&&isOptionGroupFieldConfiguredInDynamicRules(fldLinkElem)&&isOptionGroupFieldConfiguredInDynamicRules(valueFieldElem)&&(condtionObj[ZFRuleConstants.FIELD.OPT_GROUP_NAME]=getSelectedGroupNameInDynamicRules(valueFieldElem))}return returnDynamicRulePreEvalResultObj(!1,!1)}function returnDynamicRulePreEvalResultObj(isResultAvailable,condResult){var dynamicRulePreEvalObj={};return dynamicRulePreEvalObj.isresultavailable=isResultAvailable,void 0!==condResult&&(dynamicRulePreEvalObj.result=condResult),dynamicRulePreEvalObj}function getDynaicValueFieldLinkName(condtionObj){return condtionObj[ZFRuleConstants.CONDN_VALUE]}function checkAndReturnNeedDataAttr(elem){var gridFldElem=$(elem).closest("[elemtype=gridField]");return gridFldElem.length>0&&"false"==$(gridFldElem).attr("needdata")?"false":$(elem).attr("needdata")}function getSubFormParentJsonIFItInsideSubForm(currentElem){if(void 0!==currentElem){var parentSubFormUL=isNewHtmlDOM()?$(currentElem).closest("div[elname=subFormFieldsCloneUl],[elname=subFormFieldsUl]"):$(currentElem).closest("ul[elname=subFormFieldsCloneUl],[elname=subFormFieldsUl]");if(parentSubFormUL.length>0){var subFormParentElem=parentSubFormUL.closest("div#subFormPopUp");0==subFormParentElem.length&&(subFormParentElem=$(parentSubFormUL).closest("[elname=livefield-elem]"));var subFormJson={};return subFormJson.subFormLinkName=$(subFormParentElem).attr("linkname"),subFormJson.rowId=$(parentSubFormUL).attr("rowid"),subFormJson}}return{}}function addActiveSubFormLinkNameAndRowIdInRules(activeSubFormLinkName,activeRowId){zf_rule.activeSubFormLinkName=activeSubFormLinkName,zf_rule.activeRowId=activeRowId}function resetActiveSubFormLinkNameAndRowIdInRules(){zf_rule.activeSubFormLinkName=undefined,zf_rule.activeRowId=undefined}function isCurrentFormulaExistInsideActiveSubForm(currentSubFormLinkName){var activeSubFormLinkName=getActiveSubFormLinkName(),activeRowId=getActiveSubFormRowId();return void 0!==activeSubFormLinkName&&void 0!==activeRowId&&void 0!==currentSubFormLinkName&&activeSubFormLinkName==currentSubFormLinkName}function getActiveSubFormRowId(){return zf_rule.activeRowId}function getActiveSubFormLinkName(){return zf_rule.activeSubFormLinkName}function getRuleResultObject(){var ruleResultObj={fieldVisibilityChangeList:[]};return ruleResultObj}function checkAndAddFieldsInFieldVisibilityChangeList(ruleResultObj,fieldLinkname,previousState,fldLinkElem){if(previousState!=getFieldVisibilityState(fldLinkElem)&&void 0!==ruleResultObj){var fieldVisibilityChangeList=ruleResultObj.fieldVisibilityChangeList;void 0!==fieldVisibilityChangeList&&-1==$.inArray(fieldVisibilityChangeList,fieldLinkname)&&fieldVisibilityChangeList.push(fieldLinkname)}}function getFieldVisibilityState(fldLinkElem){return fldLinkElem.attr("needdata")}function ZFPageRule(){this.fieldElemsInConditionsList=[],this.pageConditions={},this.fromPageList=[],this.path=[],this.pageRules={}}ZFRule.prototype.getRules=function(url,fromPage){var selfObj=this,ajaxOpts={URI:url,METHOD:ZFHttp.GET,ACCEPT:"application/json",CALLBACK:function(jsonData,ajaxOpts){selfObj.getRulesCallBack(jsonData,fromPage),void 0!==ZFLive&&ZFLive.isIncWebhookEnabled&&ZFLive.zfIncWebhookLive.checkAndGetIncomingWebhookDataOnFormLoad()}},isUnauthCall=!1;void 0!==ZFLive&&ZFLive.isPublicFormAccess&&(isUnauthCall=!0),ZFUtil.sendAjax(ajaxOpts,this,isUnauthCall)},ZFRule.prototype.getRulesCallBack=function(jsonData,fromPage){if(jsonData){zf_rule.rulemeta=jsonData,zfPageRule.pageRules=jsonData[ZFRuleConstants.FORM][PageRule.KEYS.PAGE_RULES],zfPageRule.is_advanced_page_rule=jsonData[ZFRuleConstants.FORM].is_advanced_page_rule,zf_rule.currentDateddmmyyyyhhmm=jsonData[ZFRuleConstants.FORM].currentDateddmmyyyyhhmm,zf_rule.formBodyDiv=$("#formBodyDiv");var dateFormatInp=$("#zf_date_format");zf_rule.dateLocale=dateFormatInp.attr("dateLocale"),zf_rule.dateFormat=dateFormatInp.val();var advRules=jsonData[ZFRuleConstants.FORM].adv_field_rules;advRules!=undefined&&(zf_rule.on_form_load_ruleorder=advRules.on_form_load_ruleorder,zf_rule.adv_result_arr=advRules.adv_result_arr,zf_rule.isdlynd=advRules.isdlynd,zf_rule.dlyms=advRules.dlyms),zf_rule.init(),bindevents(),preEvalRules(),"{}"!==JSON.stringify(zfPageRule.pageRules)&&$("#navigBar").parent().addClass("pBarcursor_remove"),initPageRules(),void 0!==ZFLive&&null!=ZFLive.formulaJson&&ZFLive.evalExpressionOnFormLoad(),isOneFieldForm()&&showhidePrevNextSubmitButtons();var pages=isStandardForm()?$("#formBodyDiv").find("div[elname=formBodyULName]"):$("#formBodyDiv").find("ul[elname=formBodyULName]");1==$(pages).length&&document.getElementById("recaptcha_checkbox")?triggerFormResize(100):triggerFormResize()}fromPage!=undefined&&"pdfPrint"==fromPage&&("{}"!==JSON.stringify(zfPageRule.pageRules)&&evalPageRulesForPdf(),customizingFormForPdf()),isOneFieldForm()&&ZFLive.isAutonextEnabled&&ZFLive.bindEventsForAutonext()},ZFRule.prototype.getFormRules=function(url,csrf,fromPage){var ajaxOpts={URI:url,METHOD:ZFHttp.GET,CSRF:csrf,ACCEPT:"application/zoho.forms-v3+json",CALLBACK:function(jsonData,ajaxOpts){if(jsonData){zf_rule.rulemeta=jsonData,zf_rule.formBodyDiv=$("#formBodyDiv");var dateFormatInp=$("#zf_date_format");zf_rule.dateLocale=dateFormatInp.attr("dateLocale"),zf_rule.dateFormat=dateFormatInp.val(),zf_rule.init(),bindevents(),preEvalRules(),null!=ZFLive.formulaJson&&ZFLive.evalExpressionOnFormLoad()}fromPage!=undefined&&"pdfPrint"==fromPage&&customizingFormForPdf()}},isUnauthCall=!1;void 0!==ZFLive&&ZFLive.isPublicFormAccess&&(isUnauthCall=!0),ZFUtil.sendAjax(ajaxOpts,this,isUnauthCall)},ZFRule.prototype.init=function(){var zfArr=[],rulesArr=this.rulemeta[ZFRuleConstants.FORM][ZFRuleConstants.FIELD_RULES];for(var i in zf_rule.is_advanced_field_rule=this.rulemeta[ZFRuleConstants.FORM].is_advanced_field_rule,zf_rule.subform_linkname_arr=[],zf_rule.subform_linkname_action_arr=[],rulesArr){var zffieldRule=new ZFFieldRule,rule_conditions=rulesArr[i][ZFRuleConstants.CONDITIONS],rule_actions=rulesArr[i][ZFRuleConstants.ACTIONS],rule_oper=rulesArr[i][ZFRuleConstants.LOGICAL_OPER];if(zffieldRule.ruleid=rulesArr[i].rule_id,zffieldRule.issubform_rule=rulesArr[i].issubform_rule,zffieldRule.subform_linkname=rulesArr[i].subform_linkname,rulesArr[i].subform_linkname!=undefined&&-1==$.inArray(rulesArr[i].subform_linkname,zf_rule.subform_linkname_arr)&&zf_rule.subform_linkname_arr.push(rulesArr[i].subform_linkname),zffieldRule.oper=getLogicalOper(rule_oper),zf_rule.is_advanced_field_rule)rulesArr[i].depchoices!=undefined&&(zffieldRule.depchoices=getDepChoicesInZFRulesFormat(rulesArr[i])),zffieldRule.conditionsObj=rulesArr[i].conditions,replaceAdvRulesFieldLinkNameKey(zffieldRule.conditionsObj,zffieldRule.fieldElems);else for(var x in rule_conditions){var zfRuleCond=new ZFCondition;zfRuleCond.fieldLinkName=rule_conditions[x][ZFRuleConstants.FIELD_LINK_NAME],zffieldRule.fieldElems.push(zfRuleCond.fieldLinkName),zfRuleCond.operator=rule_conditions[x][ZFRuleConstants.COMP_OPER],rule_conditions[x][ZFRuleConstants.VALUE_ARRAY]!=undefined?zfRuleCond.condValue=rule_conditions[x][ZFRuleConstants.VALUE_ARRAY]:rule_conditions[x][ZFRuleConstants.OPTGROUP_ARRAY]!=undefined?zfRuleCond.optgroup_array=rule_conditions[x][ZFRuleConstants.OPTGROUP_ARRAY]:zfRuleCond.condValue=rule_conditions[x][ZFRuleConstants.VALUE],zfRuleCond.rowLinkName=rule_conditions[x][ZFRuleConstants.ROW_LINK_NAME],zffieldRule.conditionsObj[rule_conditions[x].condition_id]=zfRuleCond,rule_conditions[x].hasOwnProperty(ZFRuleConstants.FIELD.OPT_GROUP_NAME)&&(zfRuleCond.group_name=rule_conditions[x][ZFRuleConstants.FIELD.OPT_GROUP_NAME]),rule_conditions[x].hasOwnProperty(ZFRuleConstants.COMPONENT_LINK_NAME)&&(zfRuleCond[ZFRuleConstants.COMPONENT_LINK_NAME]=rule_conditions[x][ZFRuleConstants.COMPONENT_LINK_NAME])}for(var y in rule_actions){var zfAction=new ZFAction;zfAction.ruleaction=rule_actions[y][ZFRuleConstants.ACTION],zfAction.actionLinkName=rule_actions[y][ZFRuleConstants.FIELD_LINK_NAME],zfAction.componentLinkName=rule_actions[y][ZFRuleConstants.COMPONENT_LINK_NAME],rule_actions[y][ZFRuleConstants.ACTION]!=ZFRuleConstants.SHOW_GROUP&&rule_actions[y][ZFRuleConstants.ACTION]!=ZFRuleConstants.HIDE_GROUP||(zfAction.group_name=rule_actions[y][ZFRuleConstants.FIELD.OPT_GROUP_NAME]),rule_actions[y].sub_linkname!=undefined&&(zfAction.sub_linkname=rule_actions[y].sub_linkname,-1==$.inArray(zfAction.sub_linkname,zf_rule.subform_linkname_action_arr)&&zf_rule.subform_linkname_action_arr.push(zfAction.sub_linkname)),zffieldRule.actionsObj[rule_actions[y][ZFRuleConstants.ACTION_ID]]=zfAction}zfArr[i]=zffieldRule,zf_rule.ruleObjs[zffieldRule.ruleid]=zffieldRule}zf_rule.zfRules=zfArr},ZFRule.prototype.evalRules=function(elem,evalAllRulesArr,groupActionVisibleHiddenJsonObj,ruleResultObj){var compname=getCompName(elem);for(var i in zf_rule.zfRules)if(-1!=$.inArray(compname,zf_rule.zfRules[i].fieldElems))for(var x in zf_rule.zfRules[i].conditionsObj){var result=evaluateCondtionInRule(zf_rule.zfRules[i].conditionsObj[x],!1);zf_rule.zfRules[i].conditionsObj[x][ZFRuleConstants.RESULT]=result}var str="";for(var i in zf_rule.zfRules)if(-1!=$.inArray(compname,zf_rule.zfRules[i].fieldElems)){var cnt=1,size=0;for(var x in zf_rule.zfRules[i].conditionsObj)size++;for(var x in zf_rule.zfRules[i].conditionsObj)cnt!=size?str=str+zf_rule.zfRules[i].conditionsObj[x][ZFRuleConstants.RESULT]+zf_rule.zfRules[i].oper:str+=zf_rule.zfRules[i].conditionsObj[x][ZFRuleConstants.RESULT],cnt++;if(evalBoolExp($.trim(str))){if(-1==$.inArray(zf_rule.zfRules[i].ruleid,evalAllRulesArr))for(var y in evalAllRulesArr.push(zf_rule.zfRules[i].ruleid),zf_rule.zfRules[i].actionsObj)zf_rule.zfRules[i].actionsObj[y][ZFRuleConstants.RULE_ACTION]==ZFRuleConstants.SHOW||zf_rule.zfRules[i].actionsObj[y][ZFRuleConstants.RULE_ACTION]==ZFRuleConstants.HIDE?(evalAction(zf_rule.zfRules[i].actionsObj[y],zf_rule.zfRules[i].actionsObj[y][ZFRuleConstants.ACTION_LINK_NAME],zf_rule.zfRules[i].actionsObj[y][ZFRuleConstants.RULE_ACTION],evalAllRulesArr,groupActionVisibleHiddenJsonObj,undefined,ruleResultObj),typeof ZFLive!=ResponseKey.UNDEFINED&&null!=ZFLive.paymentMerchantList&&ZFLive.setValueInPayment(zf_rule.zfRules[i].actionsObj[y][ZFRuleConstants.ACTION_LINK_NAME])):zf_rule.zfRules[i].actionsObj[y][ZFRuleConstants.RULE_ACTION]!=ZFRuleConstants.SHOW_GROUP&&zf_rule.zfRules[i].actionsObj[y][ZFRuleConstants.RULE_ACTION]!=ZFRuleConstants.HIDE_GROUP||evalGroupAction(zf_rule.zfRules[i].actionsObj[y][ZFRuleConstants.ACTION_LINK_NAME],zf_rule.zfRules[i].actionsObj[y][ZFRuleConstants.RULE_ACTION],groupActionVisibleHiddenJsonObj,!1)}else disableAction(zf_rule.zfRules[i],evalAllRulesArr,groupActionVisibleHiddenJsonObj,ruleResultObj);str=""}},ZFRule.prototype.evalAdvRulesOnFieldStateChange=function(ruleOrderArr,elem){var subFormJson=getSubFormParentJsonIFItInsideSubForm(elem);this.evalAdvRules(ruleOrderArr,elem,subFormJson.subFormLinkName,subFormJson.rowId),ZFLive.evalExpressionAfterFieldRuleExecution(),ZFLive.resetAdvRuleExecutedFormulaFieldsList(),resetActiveSubFormLinkNameAndRowIdInRules()},ZFRule.prototype.evalAdvRules=function(ruleOrderArr,elem,activeSubFormLinkName,activeSubFormRowId){var groupActionVisibleHiddenJsonObj={};groupActionVisibleHiddenJsonObj[ZFRuleConstants.SHOW_GROUP]={},groupActionVisibleHiddenJsonObj[ZFRuleConstants.HIDE_GROUP]={};var ruleResultObj=getRuleResultObject();typeof ZFLive!=ResponseKey.UNDEFINED&&ZFLive.resetAdvRuleExecutedFormulaFieldsList(),addActiveSubFormLinkNameAndRowIdInRules(activeSubFormLinkName,activeSubFormRowId);var depRuleObj={depchoiceObj:{},succussDepRulesList:[]};if(zf_rule.subform_linkname_arr.length>0){var fieldWiseResulMainCountObj=JSON.parse(JSON.stringify(zf_rule.adv_result_arr)),subFormFieldWiseResulCountObj={};for(var i in initiateAllSubFormFieldCountObjInRowWise(subFormFieldWiseResulCountObj,groupActionVisibleHiddenJsonObj),ruleOrderArr){var ruleObjArr=getAdvRuleObj(ruleId=ruleOrderArr[i]),isDepRule=zf_rule.ruleObjs[ruleId].depchoices!=undefined;for(var ruleIdx in ruleObjArr){var ruleObj=ruleObjArr[ruleIdx];if(isDepRule&&(ruleObj.ruleid=ruleId,ruleObj.isDepRule=isDepRule),ruleObj.subform_linkname!=undefined){var subFormLinkName=ruleObj.subform_linkname;if(subFormFieldWiseResulCountObj[subFormLinkName]==undefined&&(subFormFieldWiseResulCountObj[subFormLinkName]={}),ruleObj.subform_linkname==activeSubFormLinkName){var rowId=parseInt(activeSubFormRowId);includeSubFormLinkNameInRowWiseResultArr(subFormFieldWiseResulCountObj,subFormLinkName,rowId,groupActionVisibleHiddenJsonObj);var fieldWiseResulCountObj=subFormFieldWiseResulCountObj[subFormLinkName][rowId].countObj;evalAdvancedRulesForEachRule(subFormFieldWiseResulCountObj[subFormLinkName][rowId].groupObj,fieldWiseResulCountObj,ruleObj,rowId,subFormLinkName,fieldWiseResulMainCountObj,subFormFieldWiseResulCountObj,subFormFieldWiseResulCountObj[subFormLinkName][rowId].depRuleObj,elem,ruleResultObj)}else{evalRulesForSubFormRows(getChildSubFormFieldsUl(getFieldElem(subFormLinkName)),ruleObj,subFormLinkName,fieldWiseResulMainCountObj,subFormFieldWiseResulCountObj,elem,ruleResultObj)}}else{fieldWiseResulCountObj=JSON.parse(JSON.stringify(zf_rule.adv_result_arr));evalAdvancedRulesForEachRule(groupActionVisibleHiddenJsonObj,fieldWiseResulMainCountObj,ruleObj,undefined,undefined,fieldWiseResulMainCountObj,subFormFieldWiseResulCountObj,depRuleObj,elem,ruleResultObj)}}}}else{fieldWiseResulMainCountObj=JSON.parse(JSON.stringify(zf_rule.adv_result_arr));for(var i in ruleOrderArr){var ruleId;ruleObjArr=getAdvRuleObj(ruleId=ruleOrderArr[i]),isDepRule=zf_rule.ruleObjs[ruleId].depchoices!=undefined;for(var ruleIdx in ruleObjArr){ruleObj=ruleObjArr[ruleIdx];isDepRule&&(ruleObj.ruleid=ruleId,ruleObj.isDepRule=isDepRule),evalAdvancedRulesForEachRule(groupActionVisibleHiddenJsonObj,fieldWiseResulMainCountObj,ruleObj,undefined,undefined,undefined,undefined,depRuleObj,elem,ruleResultObj)}}}typeof ZFLive!=ResponseKey.UNDEFINED&&ZFLive.checkAndPrefillFldLabelAfterRule(ruleResultObj,groupActionVisibleHiddenJsonObj)};var PageRule={KEYS:{PAGE_RULES:"page_rules",ACTION_TYPE:"action_type",CONDITIONED_RULE:"conditioned_rule",DEFAULT_RULE:"default_rule",LOGICAL_OPER:"logical_oper",TO_PAGE:"to_page_link_name"},CONDITIONS:{KEY:"conditions",CONDN_NAME:"condition_name",CONDN_LINK_NAME:"condition",FIELD_LINK_NAME:"field_link_name",ROW_LINK_NAME:"row_link_name",COMPARISON_OPER:"comparison_oper",VALUE:"value",VALUE_ARRAY:"value_array",OPTGROUP_ARRAY:"optgroup_array",ROW_VALUE:"row",OPT_GROUP_NAME:"group_name"},CONSTANTS:{CONDITIONED_RULE:1,DEFAULT_RULE:2}};function isPageInPath(pageNo){return-1!=$.inArray(pageNo,zfPageRule.path)}function initPageRules(){for(var key in zfPageRule.pageRules)zfPageRule.fromPageList.push(key)}function sortList(){zfPageRule.path.sort(function(a,b){return a-b})}function evalRulesAndGetNextPageNo(currentPageNo){return reinitialisePathAndEvalPageRules(currentPageNo),getNextPageNo(currentPageNo)}function reinitialisePathAndEvalPageRules(currentPageNo){var pageNo=1;for(zfPageRule.path=[],addPageNumInList(pageNo);pageNo<=currentPageNo;)evalPageRules(pageNo),pageNo=getNextPageNo(pageNo)}function getNextPageNo(currentPageNo){var nextPageNo;return sortList(),$.each(zfPageRule.path,function(idx,pageNo){if(pageNo>currentPageNo)return nextPageNo=pageNo,!1}),nextPageNo}function evalPageRules(pageNo){var pageLinkName=getPageLinkNameFromPageNum(pageNo);if(-1!=$.inArray(pageLinkName,zfPageRule.fromPageList)){var pageRule=zfPageRule.pageRules[pageLinkName];pageRule[PageRule.KEYS.ACTION_TYPE]==PageRule.CONSTANTS.CONDITIONED_RULE?evalConditionedRule(pageRule):evalDefaultRule(pageRule[PageRule.KEYS.DEFAULT_RULE])}else addPageNumInList(parseInt(pageNo)+1)}function addPageNumInList(pageNo){pageNo=parseInt(pageNo),-1==$.inArray(pageNo,zfPageRule.path)&&zfPageRule.path.push(pageNo)}function evalConditionedRule(pageRule){var flag=!1,conditionedRuleList=pageRule[PageRule.KEYS.CONDITIONED_RULE];$.each(conditionedRuleList,function(idx,conditionedRule){var conditionList=conditionedRule[PageRule.CONDITIONS.KEY],logicalOper=conditionedRule[PageRule.KEYS.LOGICAL_OPER];(isAdvancedPageRule()?evaluateAdvancedPageRuleConditions(conditionList,logicalOper):evalConditions(conditionList,logicalOper))&&(flag=!0,addPageNumInList(getPageNumFromLinkName(conditionedRule[PageRule.KEYS.TO_PAGE])))}),flag||evalDefaultRule(pageRule[PageRule.KEYS.DEFAULT_RULE])}function evalDefaultRule(defaultRule){addPageNumInList(getPageNumFromLinkName(defaultRule[PageRule.KEYS.TO_PAGE]))}function getPageNumFromLinkName(pageLinkName){return isStandardForm()?$("div[elname=formWrapper]").find("div[elname=footer][page_link_name="+pageLinkName+"]").attr("page_no"):$("#formRedirectURL").find("ul[elname=footer][page_link_name="+pageLinkName+"]").attr("page_no")}function getPageLinkNameFromPageNum(pageNo){return isStandardForm()?$("div[elname=formWrapper]").find("div[elname=footer][page_no="+pageNo+"]").attr("page_link_name"):$("#formRedirectURL").find("ul[elname=footer][page_no="+pageNo+"]").attr("page_link_name")}function getConditionObj(condition){var condObj={};return condObj.fieldLinkName=condition[PageRule.CONDITIONS.FIELD_LINK_NAME],condObj.operator=condition[PageRule.CONDITIONS.COMPARISON_OPER],condition.hasOwnProperty(PageRule.CONDITIONS.VALUE_ARRAY)?condObj.condValue=condition[PageRule.CONDITIONS.VALUE_ARRAY]:condition.hasOwnProperty(PageRule.CONDITIONS.OPTGROUP_ARRAY)?condObj.optgroup_array=condition[PageRule.CONDITIONS.OPTGROUP_ARRAY]:condObj.condValue=condition[PageRule.CONDITIONS.VALUE],condition.hasOwnProperty(PageRule.CONDITIONS.ROW_LINK_NAME)?condObj.rowLinkName=condition[PageRule.CONDITIONS.ROW_LINK_NAME]:condition.hasOwnProperty(PageRule.CONDITIONS.OPT_GROUP_NAME)&&(condObj.group_name=condition[PageRule.CONDITIONS.OPT_GROUP_NAME]),condition.hasOwnProperty(ZFRuleConstants.COMPONENT_LINK_NAME)&&(condObj[ZFRuleConstants.COMPONENT_LINK_NAME]=condition[ZFRuleConstants.COMPONENT_LINK_NAME]),"undefined"!=typeof condition.valclname&&(condObj.valclname=condition.valclname),"undefined"!=typeof condition.valtype&&(condObj.valtype=condition.valtype),condObj}function evalConditions(conditionList,logicalOper){var finalResult=null;return $.each(conditionList,function(i,condition){var result=evalAndGetPageCondResult(condition);if(null!=finalResult){if("matchany"==logicalOper){if(finalResult=finalResult||result)return!1}else if(!(finalResult=finalResult&&result))return!1}else finalResult=result}),finalResult}function getCondValueForTime(val){if(val!=undefined&&""!=val)return val.replace(/\s/g,":")}function evalPageRulesForPdf(){for(var pageNo=1,formBodyUl=$("#formBodyUL");pageNo0?ZFLivePrefillUtil.fillandSetDropdownValue(dropDownElem,stringCrmEntryValue):ZFLivePrefillUtil.fillandSetDropdownValue(dropDownElem,"-Select-")},ZFLivePrefillUtil.fillAddressFldsValue=function(fldLiElem,entryValue,isSubform){var isCountryFldFilled=!1,stateFldType=$(fldLiElem).attr("statefldtype"),fieldValJson=entryValue;for(var formCompLabelName in entryValue){var stringCrmEntryValue=fieldValJson[formCompLabelName];if(isCountryFldFilled||-1===formCompLabelName.indexOf(ZFFormField.ADDRESS.COUNTRY.KEY+"_isocode"))if(-1!==formCompLabelName.indexOf(ZFFormField.ADDRESS.COUNTRY.KEY))ZFLivePrefillUtil.fillAddComplinkFormField(fldLiElem,formCompLabelName,stringCrmEntryValue,stateFldType);else if(-1!==formCompLabelName.indexOf(ZFFormField.ADDRESS.STATE.KEY)&&stateFldType==AddrStateFldInputType.DROPDOWN)ZFLivePrefillUtil.fillandSetDropdownValueInAddrStateFld(fldLiElem,formCompLabelName,stringCrmEntryValue);else{var caseType=fldLiElem.attr("casetype");void 0!==caseType&&0!=caseType&&(stringCrmEntryValue=ZFLivePrefillUtil.textTransformCRMPrefill(caseType,stringCrmEntryValue)),$(fldLiElem).find(':text[complink="'+formCompLabelName+'"]').val(stringCrmEntryValue)}else{isCountryFldFilled=!0;var countryCompName=formCompLabelName.substring(0,formCompLabelName.indexOf("_isocode"));ZFLivePrefillUtil.fillAddrCountryFldBasedOnCode(fldLiElem,countryCompName,stringCrmEntryValue,stateFldType)}isSubform||ZFLive.prefillFieldLabelFromLiElem(fldLiElem,!1)}},ZFLivePrefillUtil.fillAddrCountryFldBasedOnCode=function(fldLiElem,formCompLabelName,countryCode,stateFldType){var dropDownElem=$(fldLiElem).find('select[complink="'+formCompLabelName+'"]');if(""!=$.trim(countryCode)){var selectedChoiceElem=ZFUtil.getSelectedOptionElem(dropDownElem,"isocode",countryCode);if(selectedChoiceElem!==undefined)return $(selectedChoiceElem).prop("selected",!0),ZFUtil.isSelect2(dropDownElem)&&$(dropDownElem).trigger("change.select2"),void ZFLivePrefillUtil.fillandSetDropdownValueInAddrCtryField(dropDownElem,$(dropDownElem).val(),stateFldType)}ZFLivePrefillUtil.fillandSetDropdownValueInAddrCtryField(dropDownElem,"-Select-",stateFldType)},ZFLivePrefillUtil.fillAddressFormField=function(fldLiElem,formCompLabelName,stringCrmEntryValue){var stateFldType=$(fldLiElem).attr("statefldtype");if(-1!==formCompLabelName.indexOf(ZFFormField.ADDRESS.COUNTRY.KEY))ZFLivePrefillUtil.fillAddComplinkFormField(fldLiElem,formCompLabelName,stringCrmEntryValue,stateFldType);else if(-1!==formCompLabelName.indexOf(ZFFormField.ADDRESS.STATE.KEY)&&stateFldType==AddrStateFldInputType.DROPDOWN)ZFLivePrefillUtil.fillandSetDropdownValueInAddrStateFld(fldLiElem,formCompLabelName,stringCrmEntryValue);else{var caseType=fldLiElem.attr("casetype");void 0!==caseType&&0!=caseType&&(stringCrmEntryValue=ZFLivePrefillUtil.textTransformCRMPrefill(caseType,stringCrmEntryValue)),$(fldLiElem).find(':text[complink="'+formCompLabelName+'"]').val(stringCrmEntryValue)}},ZFLivePrefillUtil.fillAddComplinkFormField=function(fldLiElem,formCompLabelName,stringCrmEntryValue,stateFldType){var dropDownElem=$(fldLiElem).find('select[complink="'+formCompLabelName+'"]'),caseType=fldLiElem.attr("casetype");stringCrmEntryValue.includes('"')&&(stringCrmEntryValue=stringCrmEntryValue.replace(/"/g,'\\"')),$(dropDownElem).find('option[value="'+stringCrmEntryValue+'"]').length>0||void 0!==caseType&&0!=caseType?(void 0!==caseType&&0!=caseType&&(stringCrmEntryValue=$(fldLiElem).find('select[complink="'+formCompLabelName+'"]').find('option[lwrvalue="'+stringCrmEntryValue.toLowerCase()+'"]').val(),0==$(dropDownElem).find('option[value="'+stringCrmEntryValue+'"]').length&&(stringCrmEntryValue="-Select-")),ZFLivePrefillUtil.fillandSetDropdownValueInAddrCtryField(dropDownElem,stringCrmEntryValue,stateFldType)):ZFLivePrefillUtil.fillandSetDropdownValueInAddrCtryField(dropDownElem,"-Select-",stateFldType)},ZFLivePrefillUtil.fillandSetDropdownValueInAddrCtryField=function(dropdownElem,valueToFill,stateFldType){$(dropdownElem).val(valueToFill),ZFUtil.isSelect2(dropdownElem)?stateFldType==AddrStateFldInputType.DROPDOWN?$(dropdownElem).trigger("change"):$(dropdownElem).trigger("change.select2"):stateFldType==AddrStateFldInputType.DROPDOWN&&$(dropdownElem).trigger("change")},ZFLivePrefillUtil.fillandSetDropdownValueInAddrStateFld=function(fldLiElem,formCompLabelName,valueToFill){var addressFldDd=$(fldLiElem).find('select[complink="'+formCompLabelName+'"]');if(""!=$.trim(valueToFill)){var newOption,caseType=$(fldLiElem).attr("casetype");if($(addressFldDd).find("option[isprevval=true]").remove(),"1"==caseType)newOption=new Option(valueToFill.toLowerCase(),valueToFill.toLowerCase());else if("2"==caseType)newOption=new Option(valueToFill.toUpperCase(),valueToFill.toUpperCase());else if("3"==caseType){var optionValue=changeCapitalizeCase(valueToFill);newOption=new Option(optionValue,optionValue)}else newOption=new Option(valueToFill,valueToFill);$(newOption).attr("selected","true"),$(newOption).attr("lwrvalue",valueToFill.toLowerCase()),$(newOption).attr("isprevval","true"),isNewHtmlDOM()?$(addressFldDd).children("option").eq(0).before(newOption):$(addressFldDd).children("option").eq(0).after(newOption)}else ZFLivePrefillUtil.fillandSetDropdownValue(addressFldDd,"-Select-")},ZFLivePrefillUtil.fillDropdownFormField=function(fldLiElem,formCompLabelName,stringCrmEntryValue,selectFldValType){var dropDownElem=$(fldLiElem).find('select[name="'+formCompLabelName+'"]'),othersDiv=$(fldLiElem).find("div[elname=allow-others-div]"),attrName=ZFLivePrefillUtil.getSelectElemSearchAttrName(selectFldValType),selectedChoiceElem=ZFUtil.getSelectedOptionElem(dropDownElem,attrName,stringCrmEntryValue);0!==$(othersDiv).length&&($(othersDiv).hide(),$(othersDiv).find("input").val("")),selectedChoiceElem!==undefined?(ZFLivePrefillUtil.performChoiceAvailDisabledCase(selectedChoiceElem,null,ZFLivePrefillUtil.removeDisabledClass(dropDownElem)),$(selectedChoiceElem).prop("selected",!0),ZFUtil.isSelect2(dropDownElem)&&$(dropDownElem).trigger("change.select2")):0!==$(othersDiv).length&&attrName==ElementAttributes.VALUE&&""!==stringCrmEntryValue?($(othersDiv).find("input").val(stringCrmEntryValue),$(othersDiv).show(),ZFLivePrefillUtil.fillandSetDropdownValue(dropDownElem,"zfs-others-zfs")):(dropDownElem.attr("tmp_attr_name","prefill_tmpelm"),dropDownElem.attr("prefill_tmp_val",stringCrmEntryValue),dropDownElem.attr("prefill_tmp_search_attr",attrName),ZFLivePrefillUtil.fillandSetDropdownValue(dropDownElem,"-Select-"))},ZFLivePrefillUtil.removeTmpAttrAfterRuleEvaluation=function(){getFormBodyDiv().find("select[tmp_attr_name=prefill_tmpelm]").removeAttr("prefill_tmp_val").removeAttr("prefill_tmp_search_attr").removeAttr("tmp_attr_name")},ZFLivePrefillUtil.fillRadioFormField=function(fldLiElem,formCompLabelName,stringCrmEntryValue,selectFldValType){var radioElems=$(fldLiElem).find(':radio[elname="'+formCompLabelName+'"]');$(radioElems).prop("checked",!1),isNewHtmlDOM()&&$(fldLiElem).find('span[elname="choiceSpan"]').removeClass("selectedChoice");var othersSpan=$(fldLiElem).find('span[elname="allow-others-span"]');if(0!==$(othersSpan).length&&($(othersSpan).find(':text[name="allow-others-text"]').val(""),$(othersSpan).find(':radio[elname="radio-input"]').prop("checked",!1),isNewHtmlDOM()&&$(othersSpan).removeClass("otherChoiceAnimate selectedChoice")),""!==stringCrmEntryValue){var attrName=ZFLivePrefillUtil.getSelectElemSearchAttrName(selectFldValType),selectedRadioElem=ZFUtil.getSelectedChoiceElem(radioElems,attrName,stringCrmEntryValue);typeof selectedRadioElem===ResponseKey.UNDEFINED?0!==$(othersSpan).length&&attrName==ElementAttributes.VALUE&&($(othersSpan).find(':text[name="allow-others-text"]').val(stringCrmEntryValue),$(othersSpan).find(':radio[elname="radio-input"]').prop("checked",!0),isNewHtmlDOM()&&$(othersSpan).addClass("otherChoiceAnimate selectedChoice")):(isNewHtmlDOM()&&selectChoice($(selectedRadioElem)),ZFLivePrefillUtil.performChoiceAvailDisabledCase(selectedRadioElem,$(selectedRadioElem).parent("span[elname=choiceSpan]"),ZFLivePrefillUtil.removeDisabledClass(radioElems)),$(selectedRadioElem).prop("checked",!0))}},ZFLivePrefillUtil.fillMatrixChoiceFormFieldWithString=function(fldLiElem,formCompLabelName,stringCrmEntryValue){var matrixChoiceType=parseInt($(fldLiElem).attr("choicetype"));if(matrixChoiceType===MatrixChoicesType.RADIO.CODE||matrixChoiceType===MatrixChoicesType.CHECKBOX.CODE){var choiceElems=$(fldLiElem).find(":"+ZFUtil.getMatrixChoiceTypeString(matrixChoiceType)+'[name="'+formCompLabelName+'"]');$(choiceElems).prop("checked",!1),""!==stringCrmEntryValue&&ZFLivePrefillUtil.tickMatrixChoice(choiceElems,stringCrmEntryValue)}},ZFLivePrefillUtil.fillImgChoiceFormFieldWithString=function(fldLiElem,formCompLabelName,stringCrmEntryValue,selectFldValType){var imgChoiceDiv=$(fldLiElem).find('div[elname="imageChoiceEle"]'),imgChoiceType=$(imgChoiceDiv).attr("choicetype"),maxChoice=$(fldLiElem).attr("maxchoices");if(isOneFieldForm()&&(imgChoiceType=ImageChoicesType.IMG_PICKER),imgChoiceType===ImageChoicesType.RADIO||imgChoiceType===ImageChoicesType.CHECKBOX){var tickedChoiceElems=$(imgChoiceDiv).find(":"+imgChoiceType+'[elname="'+formCompLabelName+'"][prevVal="'+BooleanConstants.TRUE+'"]');if($(tickedChoiceElems).each(function(choiceElemInd,tickedChoiceElem){ZFLive.selectImage(tickedChoiceElem)}),""!==stringCrmEntryValue){var imgChoiceElems=$(imgChoiceDiv).find(":"+imgChoiceType+'[elname="'+formCompLabelName+'"]');ZFLivePrefillUtil.tickImgChoice(imgChoiceElems,stringCrmEntryValue,selectFldValType,maxChoice)}}else if(imgChoiceType===ImageChoicesType.IMG_PICKER){var tickedChoiceDivs=$(imgChoiceDiv).find('div[name="selectDiv"][selected="selected"]');if($(tickedChoiceDivs).each(function(choiceDivInd,tickedChoiceDiv){ZFLive.selectImage(tickedChoiceDiv)}),""!==stringCrmEntryValue){imgChoiceElems=$(imgChoiceDiv).find('div[name="selectDiv"]');ZFLivePrefillUtil.tickImgChoice(imgChoiceElems,stringCrmEntryValue,selectFldValType,maxChoice)}}},ZFLivePrefillUtil.fillMultiLineFormField=function(fldLiElem,formCompLabelName,stringCrmEntryValue){var caseType=fldLiElem.attr("casetype");void 0!==caseType&&0!=caseType&&(stringCrmEntryValue=ZFLivePrefillUtil.textTransformCRMPrefill(caseType,stringCrmEntryValue)),$(fldLiElem).find('textarea[name="'+formCompLabelName+'"]').val(stringCrmEntryValue)},ZFLivePrefillUtil.fillEmailFormField=function(fldLiElem,formCompLabelName,stringCrmEntryValue,validateInpFld,includeReconfFldForPrefill){ZFLivePrefillUtil.isInpFldValidationRequired(validateInpFld)&&(ZFUtil.isEmptyValue(stringCrmEntryValue)||ZFUtil.isValidMailId(stringCrmEntryValue)||(stringCrmEntryValue=""));var caseType=fldLiElem.attr("casetype");void 0!==caseType&&0!=caseType&&(stringCrmEntryValue=ZFLivePrefillUtil.textTransformCRMPrefill(caseType,stringCrmEntryValue));var emailInputElem=$(fldLiElem).find(':text[name="'+formCompLabelName+'"]');emailInputElem.val(stringCrmEntryValue),emailInputElem.attr("initalValue",emailInputElem.val()),includeReconfFldForPrefill&&$(fldLiElem).find(':text[name="'+formCompLabelName+'-reconf"]').val(stringCrmEntryValue)},ZFLivePrefillUtil.fillPhoneFormField=function(fldLiElem,stringCrmEntryValue,validateInpFld,includeReconfFldForPrefill){var phoneFormat=$(fldLiElem).find('div[elname="phoneFormatElem"]').attr("phoneFormat");ZFLivePrefillUtil.fillPhoneFormFieldWithFormat(fldLiElem,phoneFormat,stringCrmEntryValue,validateInpFld,includeReconfFldForPrefill)},ZFLivePrefillUtil.fillPhoneFormFieldWithFormat=function(fldLiElem,phoneFormat,stringCrmEntryValue,validateInpFld,includeReconfFldForPrefill){ZFLivePrefillUtil.isInpFldValidationRequired(validateInpFld)&&(ZFUtil.isEmptyValue(stringCrmEntryValue)||ZFLivePrefillUtil.validatePhone(stringCrmEntryValue)||(stringCrmEntryValue=""));var phoneFldMainDiv=$(fldLiElem).find("div[elname=phoneFld]"),isCountryCodeEnabled=!1;if(phoneFormat===ZFPhoneFormatConstants.INTERNATIONAL){var inpTextElem=$(phoneFldMainDiv).find('input[elname="countrycode"]');"true"==$(inpTextElem).attr("iscodeenabled")&&(isCountryCodeEnabled=!0)}if(ZFLivePrefillUtil.fillPhoneFormFieldCommon(phoneFldMainDiv,phoneFormat,isCountryCodeEnabled,stringCrmEntryValue,!1),includeReconfFldForPrefill){var phoneFldConfMainDiv=$(fldLiElem).find("div[elname=confPhoneFld]");ZFLivePrefillUtil.fillPhoneFormFieldCommon(phoneFldConfMainDiv,phoneFormat,isCountryCodeEnabled,stringCrmEntryValue,!0)}},ZFLivePrefillUtil.fillPhoneFormFieldCommon=function(phoneFldMainDiv,phoneFormat,isCountryCodeEnabled,stringCrmEntryValue,isReconfInput){var inpTextElem;if(phoneFormat===ZFPhoneFormatConstants.INTERNATIONAL)inpTextElem=isReconfInput?$(phoneFldMainDiv).find('input[elname="countrycodeConf"]'):$(phoneFldMainDiv).find('input[elname="countrycode"]'),isCountryCodeEnabled?$(inpTextElem).intlTelInput("setNumber",stringCrmEntryValue):$(inpTextElem).val(stringCrmEntryValue),isReconfInput||$(inpTextElem).attr("initalValue",$(inpTextElem).val());else if(phoneFormat===ZFPhoneFormatConstants.USAFORMAT){var splittedPhoneNum1="",splittedPhoneNum2="",splittedPhoneNum3="";stringCrmEntryValue.length<=10&&(stringCrmEntryValue.length>6?(splittedPhoneNum1=stringCrmEntryValue.substring(0,3),splittedPhoneNum2=stringCrmEntryValue.substring(3,6),splittedPhoneNum3=stringCrmEntryValue.substring(6,stringCrmEntryValue.length)):stringCrmEntryValue.length>3?(splittedPhoneNum1=stringCrmEntryValue.substring(0,3),splittedPhoneNum2=stringCrmEntryValue.substring(3,stringCrmEntryValue.length)):stringCrmEntryValue.length>0&&(splittedPhoneNum1=stringCrmEntryValue.substring(0,stringCrmEntryValue.length)));var phoneNumInp1=$(phoneFldMainDiv).find('input[elname="countrycode"]'),phoneNumInp2=$(phoneFldMainDiv).find('input[elname="first"]'),phoneNumInp3=$(phoneFldMainDiv).find('input[elname="second"]');phoneNumInp1.val(splittedPhoneNum1),phoneNumInp2.val(splittedPhoneNum2),phoneNumInp3.val(splittedPhoneNum3),isReconfInput||(phoneNumInp1.attr("initalValue",phoneNumInp1.val()),phoneNumInp2.attr("initalValue",phoneNumInp2.val()),phoneNumInp3.attr("initalValue",phoneNumInp3.val()))}},ZFLivePrefillUtil.validatePhone=function(val){if(val.length<5||val.length>20||getNumberOfDigitsInString($.trim(val))>15)return!1;var rexp=ZFPhoneRegex.PHONE_INTE_ALL_REG;return!(""!=$.trim(val)&&!rexp.test(val))},ZFLivePrefillUtil.fillNumberFormField=function(fldLiElem,formCompLabelName,stringCrmEntryValue,validateInpFld,includeReconfFldForPrefill){ZFLivePrefillUtil.isInpFldValidationRequired(validateInpFld)&&(ZFUtil.isEmptyValue(stringCrmEntryValue)||ZFUtil.validateNumber(stringCrmEntryValue)||(stringCrmEntryValue="")),$(fldLiElem).find('input[name="'+formCompLabelName+'"]').val(stringCrmEntryValue),includeReconfFldForPrefill&&$(fldLiElem).find('input[name="'+formCompLabelName+'-reconf"]').val(stringCrmEntryValue)},ZFLivePrefillUtil.fillPaymentFormField=function(fldLiElem,formElemLinkName,stringCrmEntryValue){var merchantDivElem=$(fldLiElem).find('div[elname="merchantDiv"]');if(parseInt($(merchantDivElem).attr("paymentType"))===ZFFormPayments.PAYMENT_TYPE.DONATION){var paymentDetailsDivElem=$(fldLiElem).find('div[elname="paymentDetailsDiv"]');$(paymentDetailsDivElem).find(':text[name="'+formElemLinkName+'"]').val(stringCrmEntryValue)}},ZFLivePrefillUtil.fillSliderFormField=function(fldLiElem,formCompLabelName,stringCrmEntryValue){var sliderMin=$(fldLiElem).find("#sld-"+formCompLabelName).slider("option","min"),sliderMax=$(fldLiElem).find("#sld-"+formCompLabelName).slider("option","max"),sliderStep=$(fldLiElem).find("#sld-"+formCompLabelName).slider("option","step");ZFUtil.isValidNumWithinRange(sliderMin,sliderMax,stringCrmEntryValue)?(parseInt(stringCrmEntryValue)-sliderMin)%sliderStep!=0&&(stringCrmEntryValue=""):stringCrmEntryValue="",ZFLivePrefillUtil.fillSliderFormFieldWithoutValidation(fldLiElem,formCompLabelName,stringCrmEntryValue)},ZFLivePrefillUtil.fillSliderFormFieldWithoutValidation=function(fldLiElem,formCompLabelName,stringCrmEntryValue){var sliderMin,range,minClassLimit,maxClassLimit;isStandardForm()&&(sliderMin=$(fldLiElem).attr("slidermin"),range=$(fldLiElem).attr("slidermax")-sliderMin,minClassLimit=parseFloat(sliderMin)+.1*range,maxClassLimit=parseFloat(sliderMin)+.9*range),$(fldLiElem).find("#amount-"+formCompLabelName).attr("value",stringCrmEntryValue);var sliderDiv=$(fldLiElem).find("#sld-"+formCompLabelName),sliderAmountDiv=$(sliderDiv).find("#slid_"+formCompLabelName+"_Div");if(""===stringCrmEntryValue?$(sliderAmountDiv).hide():$(sliderAmountDiv).show(),isStandardForm()&&(stringCrmEntryValue<=minClassLimit?$(sliderAmountDiv).addClass("sliderMinRange"):stringCrmEntryValue>=maxClassLimit?$(sliderAmountDiv).addClass("sliderMaxRange"):$(sliderAmountDiv).removeClass("sliderMinRange sliderMaxRange")),$(sliderDiv).slider("value",stringCrmEntryValue),$(sliderAmountDiv).find("#slid-"+formCompLabelName).text(stringCrmEntryValue),isAccessibilitySupported()){var circularSlider=$(sliderDiv).find("[elname=circular-slider]");$(circularSlider).attr("aria-valuenow",stringCrmEntryValue)}},ZFLivePrefillUtil.fillRatingFormField=function(fldLiElem,stringCrmEntryValue){var totalRatingCount=parseInt($(fldLiElem).find('em[elname="total_rating_count"]').text());ZFUtil.isValidNumWithinRange(1,totalRatingCount,stringCrmEntryValue)||(stringCrmEntryValue=""),ZFLivePrefillUtil.fillRatingFormFieldWithoutVaidation($(fldLiElem),stringCrmEntryValue)},ZFLivePrefillUtil.fillRatingFormFieldWithoutVaidation=function(fldLiElem,stringCrmEntryValue){if(""===stringCrmEntryValue)refreshRatingNew($(fldLiElem));else{var prevVal="";if($(fldLiElem).find("div[elname=ratingSubData]").find("a").each(function(index,anchorElem){var val=$(anchorElem).attr("value");val!=undefined&&(prevVal=val)}),prevVal!=stringCrmEntryValue){var ratingInt=parseInt(stringCrmEntryValue),ratingAncElem=$(fldLiElem).find('a[rating_value="'+ratingInt+'"]');selectRating(ratingAncElem,ratingAncElem.attr("rating_value"),ratingAncElem.attr("rating_count"))}}},ZFLivePrefillUtil.fillWebsiteFormField=function(fldLiElem,formCompLabelName,stringCrmEntryValue,validateInpFld){ZFLivePrefillUtil.isInpFldValidationRequired(validateInpFld)&&(ZFUtil.isEmptyValue(stringCrmEntryValue)||ZFUtil.validateLiveUrl(stringCrmEntryValue)||(stringCrmEntryValue="")),$(fldLiElem).find(':text[name="'+formCompLabelName+'"]').val(stringCrmEntryValue)},ZFLivePrefillUtil.fillCurrencyFormField=function(fldLiElem,formCompLabelName,stringCrmEntryValue,validateInpFld){var isValidValue=!ZFUtil.isEmptyValue(stringCrmEntryValue)&&ZFUtil.validateCurrency(stringCrmEntryValue);ZFLivePrefillUtil.isInpFldValidationRequired(validateInpFld)&&(isValidValue||(stringCrmEntryValue="")),isValidValue&&(stringCrmEntryValue=ZFUtil.getFormattedDecimal(stringCrmEntryValue,$(fldLiElem).attr("decimalformat"))),$(fldLiElem).find(':text[name="'+formCompLabelName+'"]').val(stringCrmEntryValue)},ZFLivePrefillUtil.fillDecimalFormField=function(fldLiElem,formCompLabelName,stringCrmEntryValue,validateInpFld){var isValidValue=!ZFUtil.isEmptyValue(stringCrmEntryValue)&&ZFUtil.validateDecimalWithNegVal(stringCrmEntryValue);ZFLivePrefillUtil.isInpFldValidationRequired(validateInpFld)&&(isValidValue||(stringCrmEntryValue="")),isValidValue&&(stringCrmEntryValue=ZFUtil.getFormattedDecimal(stringCrmEntryValue,$(fldLiElem).attr("decimalformat"))),$(fldLiElem).find(':text[name="'+formCompLabelName+'"]').val(stringCrmEntryValue)},ZFLivePrefillUtil.fillDateFormField=function(fldLiElem,stringCrmEntryValue){$(fldLiElem).find(':text[elname="date"]').val(stringCrmEntryValue)},ZFLivePrefillUtil.fillDateTimeFormField=function(fldLiElem,stringCrmEntryValue){var timeFormat=parseInt($(fldLiElem).attr("timeformat")),dateFormat=$("#zf_date_format").val(),dateLocale=$("#zf_date_format").attr("dateLocale");timeFormat==TimeFormat.HOURS_24.CODE&&ZFUtil.validateDateTime(stringCrmEntryValue,dateFormat,dateLocale,TimeFormat.HOURS_12.CODE)&&(stringCrmEntryValue=ZFUtil.convertDateTimeValToTimeFormat(stringCrmEntryValue,dateFormat,dateLocale,TimeFormat.HOURS_12.CODE,timeFormat)),$(fldLiElem).find(':text[elname="dateTime"]').val(stringCrmEntryValue)},ZFLivePrefillUtil.fillTimeFormField=function(fldLiElem,stringCrmEntryValue){var timeFormat=parseInt($(fldLiElem).attr("timeformat"));if(!ZFUtil.isEmptyValue(stringCrmEntryValue)&&ZFUtil.validateTimeFormat(stringCrmEntryValue,timeFormat)){var hours=Number(stringCrmEntryValue.match(/^(\d+)/)[1]),minutes=Number(stringCrmEntryValue.match(/:(\d+)/)[1]);if(timeFormat==TimeFormat.HOURS_12.CODE){var meridiem=stringCrmEntryValue.match(/\s(.*)$/)[1];$(fldLiElem).find('select[timecomp="Meridiem"]').val(meridiem).trigger("change.select2")}hours<10&&(hours="0"+hours),minutes<10&&(minutes="0"+minutes),$(fldLiElem).find('select[timecomp="hours"]').val(hours).trigger("change.select2"),$(fldLiElem).find('select[timecomp="minutes"]').val(minutes).trigger("change.select2")}else timeFormat==TimeFormat.HOURS_12.CODE&&$(fldLiElem).find('select[timecomp="Meridiem"]').val("").trigger("change.select2"),$(fldLiElem).find('select[timecomp="hours"]').val("").trigger("change.select2"),$(fldLiElem).find('select[timecomp="minutes"]').val("").trigger("change.select2")},ZFLivePrefillUtil.fillCBFormFieldWithString=function(fldLiElem,formCompLabelName,stringCrmEntryValue,selectFldValType){var cbElems=$(fldLiElem).find(':checkbox[elname="'+formCompLabelName+'"]');$(cbElems).prop("checked",!1),isNewHtmlDOM()&&$(fldLiElem).find('span[elname="choiceSpanCB"]').removeClass("selectedChoice");var othersSpan=$(fldLiElem).find('span[elname="allow-others-span"]');0!==$(othersSpan).length&&($(othersSpan).find(':text[name="allow-others-text"]').val(""),$(othersSpan).find(':checkbox[elname="checkbox-input"]').prop("checked",!1),isNewHtmlDOM()&&$(othersSpan).removeClass("otherChoiceAnimate selectedChoice")),""!==stringCrmEntryValue&&ZFLivePrefillUtil.tickCBChoice(cbElems,stringCrmEntryValue,selectFldValType,othersSpan)},ZFLivePrefillUtil.fillMCFormFieldWithString=function(fldLiElem,formCompLabelName,stringCrmEntryValue,selectFldValType){var selectElem=$(fldLiElem).find('select[name="'+formCompLabelName+'"]');if($(selectElem).val(""),""!==stringCrmEntryValue){var optionElems=$(selectElem).find("option");ZFLivePrefillUtil.tickMCChoice(optionElems,stringCrmEntryValue,selectFldValType)}ZFUtil.isSelect2(selectElem)&&$(selectElem).trigger("change.select2")},ZFLivePrefillUtil.checkAndChangeValueInPayment=function(){if(null!=ZFLive.paymentMerchantList){var paymentDiv=$(ZFLive.formFormFieldsOuterWrapper).find("div[elname=merchantDiv]"),selectedMerchantType=$(paymentDiv).attr("merchantType");if(null!=selectedMerchantType&&""!=selectedMerchantType){var pymntType=$(paymentDiv).attr("paymenttype");if(pymntType==ZFFormPayments.PAYMENT_TYPE.DONATION){var selectedMerchantDiv=$(paymentDiv).find("a[merchanttype="+selectedMerchantType+"]"),dispAmnt=$.trim($(selectedMerchantDiv).attr("dispamnt"));""!=dispAmnt?ZFLive.changeValueInPayment(selectedMerchantType,pymntType,dispAmnt):ZFLive.changeValueInPayment(selectedMerchantType,pymntType)}else ZFLive.changeValueInPayment(selectedMerchantType,pymntType)}}},ZFLivePrefillUtil.getSubFormClonedChildLiForPrefill=function(subFormParentLi){var subFormCloneFieldDiv=$(subFormParentLi).find('[elname="subFormFieldsCloneUl"]'),viewType=$(subFormParentLi).attr("viewtype"),rowIdFromUl=$(subFormParentLi).attr("rowIdx"),rowId=parseInt(rowIdFromUl)+1,myClonedChildUl=cloneSubFormEntry(subFormParentLi,rowId);if(1==viewType){if("true"==$(subFormParentLi).attr("show_seq_no")){var lastSubFormFldUl=isNewHtmlDOM()?$(subFormParentLi).find('div[elname="subFormFieldsUl"]').last():$(subFormParentLi).find('ul[elname="subFormFieldsUl"]').last(),entrySeqNo=0;lastSubFormFldUl.length>0&&(entrySeqNo=parseInt($(lastSubFormFldUl).find('div[elname="showSfSeqNo"]').find('span[elname="val"]').text())),entrySeqNo+=1,$(myClonedChildUl).find('div[elname="showSfSeqNo"]').find('span[elname="val"]').text(entrySeqNo)}}else 2==viewType&&($(myClonedChildUl).addClass("subFormHorizontal"),$(myClonedChildUl).show().parent().show());return $(subFormCloneFieldDiv).parent().append(myClonedChildUl),modifyClonedSubFormEntryPropEvent(myClonedChildUl,rowId,subFormParentLi),myClonedChildUl},ZFLivePrefillUtil.postActionAfterClonedChildLiPrefill=function(subFormParentLi,myClonedChildUl){var rowId=myClonedChildUl.attr("rowId"),viewType=$(subFormParentLi).attr("viewtype"),subFormLinkName=$(subFormParentLi).attr("linkname");(modifyClonedSubFormEntryPropPostAction(myClonedChildUl,rowId,subFormParentLi),2==viewType)&&(constructSFCard($(myClonedChildUl),subFormLinkName,rowId-1,!0,rowId).show(),$(myClonedChildUl).parent().hide())},ZFLivePrefillUtil.postActionAfterSubFormPrefill=function(subFormParentLi,sfRowsArr){if(1==$(subFormParentLi).attr("viewtype")){if(0!=(isNewHtmlDOM()?$(subFormParentLi).find('div[elname="subFormFieldsUl"]'):$(subFormParentLi).find('ul[elname="subFormFieldsUl"]')).length){hideNoSubFormsRowBtnDiv($(subFormParentLi));var sfSummaryDiv=$(subFormParentLi).find('[elname="sfSummaryDiv"]');$(sfSummaryDiv).length>0&&"true"==$(subFormParentLi).attr("show_summary")&&$(sfSummaryDiv).show()}resetSFSummary($(subFormParentLi))}bindChangeToAddrFldAndCheckStatesListExistOnLoadCommon(sfRowsArr,!1)},ZFLivePrefillUtil.evalRulesAfterPrefill=function(fldLiElem){if(ZFLive.mode!=undefined&&"true"==$(fldLiElem).attr("needdata")&&!isAdvancedRule()){var groupActionVisibleHiddenJsonObj={};groupActionVisibleHiddenJsonObj[ZFRuleConstants.SHOW_GROUP]={},groupActionVisibleHiddenJsonObj[ZFRuleConstants.HIDE_GROUP]={};var ruleResultObj=getRuleResultObject();zf_rule.evalRules($(fldLiElem),[],groupActionVisibleHiddenJsonObj,ruleResultObj),performShowHideGroupActionsInSelectFields(groupActionVisibleHiddenJsonObj),ZFLive.checkAndPrefillFldLabelAfterRule(ruleResultObj,groupActionVisibleHiddenJsonObj)}},ZFLivePrefillUtil.evalFormulaAfterPrefill=function(evalFormula){if(null!=ZFLive.formulaFieldsList&&evalFormula.length>0)for(var index=0;index0&&ZFLivePrefillUtil.evalFormulaAfterPrefill(evalFormula)),ZFLivePrefillUtil.removeTmpAttrAfterRuleEvaluation(),ZFLivePrefillUtil.checkAndChangeValueInPayment()},ZFLivePrefillUtil.removeDisabledClass=function(elm){var parentElm=$(elm).closest("div[elname=livefield-elem]");return!$(parentElm).hasClass("fieldDisabled")},ZFLivePrefillUtil.performChoiceAvailDisabledCase=function(selectedElm,parentElm,remDisable){var availableVal=$(selectedElm).attr("available_val");availableVal!=undefined&&0==availableVal&&(remDisable&&$(selectedElm).removeAttr("disabled"),null!=parentElm&&$(parentElm).removeClass("choiceLimitNill"))},ZFIncWebhookLive.SearchType={ON_FIELD_SEARCH:1,ON_FORM_LOAD:2},ZFIncWebhookLive.prototype.init=function(){if(this.liveMode==Mode.EDIT)return;let liElem=getFieldElemWithFldLinkNameAttrLivefieldElem(this.incwebhookSearchFld.link_name);this.liveMode==Mode.SAVED_RECORD&&this.isFldConatinsValue(liElem)&&this.setWebhookSuccessAttr(liElem,!0),liElem.attr("incwebhook_fld","true");var fieldType=parseInt(liElem.attr("comptype"));if(ZFFieldTypeConstants.RADIO==fieldType)this.bingEventForRadioField(liElem,fieldType);else if(ZFFieldTypeConstants.DROPDOWN==fieldType)this.bingEventForDropDowmField(liElem,fieldType);else{var inpElem=this.getInpElem(liElem,fieldType);this.bingEventForInputField(liElem,fieldType,inpElem)}},ZFIncWebhookLive.prototype.bingEventForRadioField=function(liElem,fieldType){const selfObj=this;liElem.find("input[type=radio]").on("click",function(){var fieldContentDiv=liElem.find("div[incwebhk_name=fieldContentDiv]");selfObj.removeSearchDisabledClass(fieldContentDiv,liElem.find("input[name=allow-others-text]")),selfObj.removeWebhookSuccessAttr(liElem),$(this).attr("allowothers")||selfObj.getIncomingWebhookDataOnSearchIconClick(liElem)});var otherOptInputElem=$(liElem).find("input[name=allow-others-text]");otherOptInputElem&&this.bingEventForInputField(liElem,fieldType,otherOptInputElem)},ZFIncWebhookLive.prototype.bingEventForDropDowmField=function(liElem,fieldType){const selfObj=this;liElem.find("select").on("change",function(){var fieldContentDiv=liElem.find("div[incwebhk_name=fieldContentDiv]");selfObj.removeSearchDisabledClass(fieldContentDiv,liElem.find("input[name=allow-others-text]")),selfObj.removeWebhookSuccessAttr(liElem),"zfs-others-zfs"!=$(this).val()&&selfObj.getIncomingWebhookDataOnSearchIconClick(liElem)});var otherOptInputElem=$(liElem).find("input[name=allow-others-text]");otherOptInputElem&&this.bingEventForInputField(liElem,fieldType,otherOptInputElem)},ZFIncWebhookLive.prototype.bingEventForInputField=function(liElem,fieldType,inpElem){var fieldContentDiv=inpElem.closest("div[incwebhk_name=fieldContentDiv]");fieldContentDiv.addClass("searchDivCont"),fieldContentDiv.find("[elname=clearInputBtn]").remove();var reconfInpElem=this.getReConfirmationInpElem(liElem,fieldType);let searchFldDiv=fieldContentDiv;reconfInpElem!=undefined&&(searchFldDiv=fieldType==ZFFieldTypeConstants.PHONE?liElem.find("div[elname=confPhoneFld]"):liElem.find("span[elname=livefield-reconf-elem]"));var incWebhookSearchDiv=searchFldDiv.find("div[elname=incWebhookSearchDiv]");incWebhookSearchDiv.show(),this.bindEventForInput(liElem,fieldContentDiv,inpElem,reconfInpElem),this.bindEventForSearchDiv(liElem,fieldContentDiv,inpElem,incWebhookSearchDiv,reconfInpElem)},ZFIncWebhookLive.prototype.bindEventForInput=function(liElem,fieldContentDiv,inpElem,reconfInpElem){const selfObj=this;let inputElemToShowSearchIcon=reconfInpElem==undefined?inpElem:reconfInpElem;inputElemToShowSearchIcon.on("input",function(){selfObj.showOrHideSearchIcon($(this),fieldContentDiv)}),inputElemToShowSearchIcon.on("keydown",function(e){13==event.keyCode&&(event.preventDefault(),selfObj.removeWebhookSuccessAttr(liElem),selfObj.getIncomingWebhookDataOnSearchIconClick(liElem))})},ZFIncWebhookLive.prototype.bindEventForSearchDiv=function(liElem,fieldContentDiv,inpElem,incWebhookSearchDiv,reconfInpElem){const selfObj=this;var compname=$(liElem).attr("compname");incWebhookSearchDiv.find("svg[elname=search-icon]").on("click",function(){event.preventDefault(),selfObj.removeWebhookSuccessAttr(liElem),selfObj.getIncomingWebhookDataOnSearchIconClick(liElem)}),incWebhookSearchDiv.find("svg[elname=clear-icon]").on("click",function(){event.preventDefault();var fieldType=parseInt(liElem.attr("comptype"));ZFFieldTypeConstants.DROPDOWN==fieldType||ZFFieldTypeConstants.RADIO==fieldType?inpElem.val(""):ZFLivePrefillUtil.fillStringCrmEntryValue(liElem,compname,"",!0,!0),selfObj.removeSearchDisabledClass(fieldContentDiv,inpElem),reconfInpElem!==undefined&&selfObj.removeSearchDisabledClass(fieldContentDiv,reconfInpElem),selfObj.removeWebhookSuccessAttr(liElem),inpElem.focus()})},ZFIncWebhookLive.prototype.showOrHideSearchIconOnFormLoad=function(liElem){const selfObj=this;var fieldType=parseInt(liElem.attr("comptype")),fieldContentDiv=liElem.find("div[incwebhk_name=fieldContentDiv]");if(ZFFieldTypeConstants.DROPDOWN==fieldType){var formFldLinkName=liElem.attr("linkname"),inputElem=liElem.find("select[name='"+formFldLinkName+"']").get(0);"zfs-others-zfs"==$(inputElem).val()&&selfObj.showOrHideSearchIcon(liElem.find("input[name=allow-others-text]"),fieldContentDiv)}else if(ZFFieldTypeConstants.RADIO==fieldType)liElem.find("input:checked").each(function(index,currRadElem){$(currRadElem).attr("allowothers")&&selfObj.showOrHideSearchIcon(liElem.find("input[name=allow-others-text]"),fieldContentDiv)});else{var inpElem=this.getInpElem(liElem,fieldType),reconfInpElem=this.getReConfirmationInpElem(liElem,fieldType);reconfInpElem==undefined?this.showOrHideSearchIcon(inpElem,fieldContentDiv):this.showOrHideSearchIcon(reconfInpElem,fieldContentDiv)}},ZFIncWebhookLive.prototype.showOrHideSearchIcon=function(inpElem,fieldContentDiv){0!=inpElem.val().trim().length?(fieldContentDiv.addClass("searchDivEnable"),this.isAccessibilitySupported&&fieldContentDiv.find("div[elname=incWebhookSearchDiv]").find("svg[elname=search-icon]").attr("tabindex","0")):(fieldContentDiv.removeClass("searchDivEnable"),this.isAccessibilitySupported&&fieldContentDiv.find("div[elname=incWebhookSearchDiv]").find("svg[elname=search-icon]").attr("tabindex",""))},ZFIncWebhookLive.prototype.getInpElem=function(liElem,fieldType){return ZFFieldTypeConstants.DROPDOWN==fieldType||ZFFieldTypeConstants.RADIO==fieldType?liElem.find("select"):ZFFieldTypeConstants.PHONE==fieldType?liElem.find("div[elname=phoneFld]").find("input[name="+this.incwebhookSearchFld.link_name+"]"):liElem.find("input[name="+this.incwebhookSearchFld.link_name+"]")},ZFIncWebhookLive.prototype.getReConfirmationInpElem=function(liElem,fieldType){if("true"==liElem.attr("need_reconf")&&(ZFFieldTypeConstants.NUMBER==fieldType||ZFFieldTypeConstants.EMAIL==fieldType||ZFFieldTypeConstants.PHONE==fieldType))return liElem.find("input[name="+this.incwebhookSearchFld.link_name+"-reconf]")},ZFIncWebhookLive.prototype.getIncomingWebhookDataOnSearchIconClick=function(liElem){this.fetchFldDataAndGetIncomingWebhookData(liElem,ZFIncWebhookLive.SearchType.ON_FIELD_SEARCH)},ZFIncWebhookLive.prototype.checkAndGetIncomingWebhookDataOnFormLoad=function(){if(this.liveMode==Mode.LIVE){let liElem=getFieldElemWithFldLinkNameAttrLivefieldElem(this.incwebhookSearchFld.link_name);this.showOrHideSearchIconOnFormLoad(liElem),this.fetchFldDataAndGetIncomingWebhookData(liElem,ZFIncWebhookLive.SearchType.ON_FORM_LOAD)}},ZFIncWebhookLive.prototype.fetchFldDataAndGetIncomingWebhookData=function(liElem,from){if(this.isFldAllowed(liElem)){if(ZFLive.errorArray=new Array,ZFLive.errCnt=0,ZFLive.validateField(liElem,!0,!0),0==ZFLive.errorArray.length){var valueJSON={};constructFormFieldDataJsonCommon(valueJSON,liElem,!1),""!=valueJSON[$(liElem).attr("compname")]&&(removeErrorFromLiElemWithoutAnimation(liElem),this.getIncomingWebhookData(valueJSON,liElem))}else from==ZFIncWebhookLive.SearchType.ON_FORM_LOAD&&("true"==liElem.attr("isvisible")?(removeErrorFromLiElemWithoutAnimation(liElem),removeReconfErrorFromLiElem(liElem,!1)):this.showIncomingWebhookFetchErrorPopup());ZFLive.errorArray=new Array,ZFLive.errCnt=0}},ZFIncWebhookLive.prototype.isFldAllowed=function(liElem){if(ZFUtil.isDataNeeded(liElem)){if(this.isFldConatinsValue(liElem))return!0}return!1},ZFIncWebhookLive.prototype.showLoadingDiv=function(){isNewHtmlDOM()?($("#plainLoading").show(),setPopUpElemPosition($("#plainLoadingCont"))):showTransparentPageLoading()},ZFIncWebhookLive.prototype.hideLoadingDiv=function(){isNewHtmlDOM()?$("#plainLoading").hide():hideTransparentPageLoading()},ZFIncWebhookLive.prototype.getIncomingWebhookData=function(valueJSON,liElem){this.showLoadingDiv();var selfObj=this,ajaxOpts={URI:this.isPublicForm?"/_zformc/"+this.portalName+"/form_id/"+this.formID+"/formperma/"+this.formPerma+"/incwebhook/public/getwebhookdata":"/_zformc/"+this.portalName+"/form_id/"+this.formID+"/incwebhook/private/getwebhookdata",METHOD:ZFHttp.POST,ACCEPT:"application/json",DATA:JSON.stringify(valueJSON),CALLBACK:function(jsonData,ajaxOpts,jqXhr){if(200==jqXhr.status){var prefillMappingJSON=JSON.parse(jqXhr.responseText);selfObj.fillPrefillData(prefillMappingJSON),selfObj.setWebhookSuccessAttr(liElem,!1)}else if("true"==liElem.attr("isvisible")){var compname=$(liElem).attr("compname"),fieldType=parseInt(liElem.attr("comptype"));if(ZFFieldTypeConstants.RADIO==fieldType){var checkedElem=liElem.find("input:checked");$(checkedElem).attr("allowothers")||ZFLivePrefillUtil.fillStringCrmEntryValue(liElem,compname,"",!0,!0)}else if(ZFFieldTypeConstants.DROPDOWN==fieldType){"zfs-others-zfs"!=liElem.find("select").val()&&ZFLivePrefillUtil.fillStringCrmEntryValue(liElem,compname,"",!0,!0)}var errorIdd=ZFLive.errorId(compname);$(errorIdd).text(i18n.incwebhook_searchfailed),animateErrorMsg(errorIdd),ZFLive.addMandatoryError(liElem)}else selfObj.showIncomingWebhookFetchErrorPopup();selfObj.hideLoadingDiv()}};ZFUtil.sendAjax(ajaxOpts,this,this.isPublicForm)},ZFIncWebhookLive.prototype.removeWebhookSuccessAttr=function(liElem){liElem.attr("incwebhk_success","false")},ZFIncWebhookLive.prototype.setWebhookSuccessAttr=function(liElem,isFrmOnload){var selfObj=this;liElem.attr("incwebhk_success","true");var fieldType=parseInt(liElem.attr("comptype")),fieldContentDiv=liElem.find("div[incwebhk_name=fieldContentDiv]");if(ZFFieldTypeConstants.DROPDOWN==fieldType){var formFldLinkName=liElem.attr("linkname"),inputElem=liElem.find("select[name='"+formFldLinkName+"']").get(0);"zfs-others-zfs"==$(inputElem).val()&&this.addSearchDisabledClass(fieldContentDiv,liElem.find("input[name=allow-others-text]"),isFrmOnload)}else if(ZFFieldTypeConstants.RADIO==fieldType)liElem.find("input:checked").each(function(index,currRadElem){$(currRadElem).attr("allowothers")&&selfObj.addSearchDisabledClass(fieldContentDiv,liElem.find("input[name=allow-others-text]"),isFrmOnload)});else{var inpElem=this.getInpElem(liElem,fieldType);this.addSearchDisabledClass(fieldContentDiv,inpElem,isFrmOnload);var reconfInpElem=this.getReConfirmationInpElem(liElem,fieldType);reconfInpElem!==undefined&&this.addSearchDisabledClass(fieldContentDiv,reconfInpElem,isFrmOnload)}},ZFIncWebhookLive.prototype.showIncomingWebhookFetchErrorPopup=function(){showErrorPage(i18n.incwebhook_error)},ZFIncWebhookLive.prototype.isValidIncomingWebhookFldValue=function(liElem){return"true"!=liElem.attr("incwebhook_fld")||"true"===liElem.attr("incwebhk_success")||!this.isFldConatinsValue(liElem)},ZFIncWebhookLive.prototype.isFldConatinsValue=function(liElem){var valueJSON={};constructFormFieldDataJsonCommon(valueJSON,liElem,!1);var compname=$(liElem).attr("compname");return!!(valueJSON[compname]&&valueJSON[compname].length>0)},ZFIncWebhookLive.prototype.addSearchDisabledClass=function(fieldContentDiv,inputElem,isFrmOnload){if(fieldContentDiv.addClass("searchDivDisable"),inputElem.attr("disabled","true"),this.isAccessibilitySupported){fieldContentDiv.find("div[elname=incWebhookSearchDiv]").find("svg[elname=search-icon]").attr("tabindex","");var clearIcon=fieldContentDiv.find("div[elname=incWebhookSearchDiv]").find("svg[elname=clear-icon]");clearIcon.attr("tabindex","0"),isFrmOnload||clearIcon.focus()}},ZFIncWebhookLive.prototype.removeSearchDisabledClass=function(fieldContentDiv,inputElem){this.isAccessibilitySupported&&fieldContentDiv.find("div[elname=incWebhookSearchDiv]").find("svg[elname=clear-icon]").attr("tabindex",""),fieldContentDiv.removeClass("searchDivDisable"),fieldContentDiv.removeClass("searchDivEnable"),inputElem.removeAttr("disabled")},ZFIncWebhookLive.prototype.fillPrefillData=function(prefillMappingJSON){ZFLivePrefillUtil.prefillDataWithPostActions(prefillMappingJSON,!1)};var ZFMonthYearComponent=new function(){this.currentDate=new Date};function getMonthYearPickerInst(){return $("#monthYearPicker")}function splitMonthYearVal(monthYearVal,dateformat,dateLocale){var datesep,month,monthYearElements=new Array(2);monthYearVal.indexOf("-")>=0?datesep="-":monthYearVal.indexOf("/")>=0?datesep="/":monthYearVal.indexOf(".")>=0&&(datesep=".");var dateformatLowercase=dateformat.toLowerCase();if(typeof dateLocale!=ResponseKey.UNDEFINED&&""!=dateLocale)switch(dateformatLowercase){case"dd-mmm-yyyy":month=CustomDateLocale[dateLocale].monthNamesShort;break;case"dd-mmmm-yyyy":case"mmmm-dd-yyyy":month=CustomDateLocale[dateLocale].monthNames}else switch(dateformatLowercase){case"dd-mmm-yyyy":month=new Array("Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep","Oct","Nov","Dec");break;case"dd-mmmm-yyyy":case"mmmm-dd-yyyy":month=new Array("January","February","March","April","May","June","July","August","September","October","November","December")}switch(dateformatLowercase){case"yyyy/mm/dd":case"yyyy-mm-dd":monthYearElements[0]=monthYearVal.substring(monthYearVal.indexOf(datesep)+1,monthYearVal.length)-1,monthYearElements[1]=monthYearVal.substring(0,monthYearVal.indexOf(datesep));break;case"mm-dd-yyyy":case"mm/dd/yyyy":monthYearElements[0]=monthYearVal.substring(0,monthYearVal.indexOf(datesep))-1,monthYearElements[1]=monthYearVal.substr(monthYearVal.lastIndexOf(datesep)+1,monthYearVal.length);break;case"dd.mm.yyyy":case"dd-mm-yyyy":case"dd/mm/yyyy":monthYearElements[0]=monthYearVal.substring(0,monthYearVal.lastIndexOf(datesep))-1,monthYearElements[1]=monthYearVal.substr(monthYearVal.lastIndexOf(datesep)+1,monthYearVal.length);break;case"dd-mmm-yyyy":case"dd-mmmm-yyyy":monthYearElements[0]=getMonthIndex(month,monthYearVal.substring(0,monthYearVal.lastIndexOf(datesep)).toLowerCase()),monthYearElements[1]=monthYearVal.substr(monthYearVal.lastIndexOf(datesep)+1,monthYearVal.length);break;case"mmmm-dd-yyyy":monthYearElements[0]=getMonthIndex(month,monthYearVal.substring(0,monthYearVal.indexOf(datesep)).toLowerCase()),monthYearElements[1]=monthYearVal.substr(monthYearVal.lastIndexOf(datesep)+1,monthYearVal.length)}return monthYearElements}function disableMonthValuesForMYPicker(monthYearPickerUlLiList,fromMonth,toMonth,disabledMonths){typeof ZFLive!=ResponseKey.UNDEFINED&&$(monthYearPickerUlLiList).each(function(){var monthIndex=$(this).attr("monthIndex");-1!=$.inArray(parseInt(monthIndex),disabledMonths)?$(this).addClass("disabledMonth"):fromMonth<=monthIndex-1&&monthIndex-1<=toMonth||$(this).addClass("disabledMonth")})}function checkMonthYearPicker(inputElem){$(inputElem).removeClass("hasMonthYearPicker"),typeof ZFLive.constraintJson!==ResponseKey.UNDEFINED&&setTimeout(function(){0===$(document.activeElement).closest("div[id=monthYearPicker]").length&&(isOneFieldForm()?ZFLive.validateFieldConstraintOF(inputElem):ZFLive.validateFieldConstraint(inputElem))},0)}function hideMonthYearPicker(){getMonthYearPickerInst().hide()}function focusMonthYearInpElem(imgElem){var inputElem=$(imgElem).closest("div[elname=calendarContDiv]").find("input"),isInputDisabled=$(inputElem).is(":disabled");typeof isInputDisabled!=ResponseKey.UNDEFINED&&isInputDisabled||$(inputElem).focus()}function setYearRangeForMonthYearPicker(monthYearPicker,startYear,endYear){var monthYearPickerYearElem=$(monthYearPicker).find("select[elname=selectYear]");$(monthYearPickerYearElem).find("option[elname=yearOption]").remove();for(var yearCloneElem=$(monthYearPicker).find("option[elname=yearOptionClone]"),yearVal=startYear;yearValmaxYearValue&&(yearValue=maxYearValue))}return yearValue}function getMonthYearValueForNumericalDateFormats(yearVal,dateFormat,monthIndex){var dateSep;return monthIndex<10&&(monthIndex="0"+monthIndex),"dd/mm/yyyy"==dateFormat.toLowerCase()||"mm/dd/yyyy"==dateFormat.toLowerCase()?(dateSep="/",value=monthIndex+dateSep+yearVal):"yyyy-mm-dd"==dateFormat.toLowerCase()?(dateSep="-",value=yearVal+dateSep+monthIndex):"yyyy/mm/dd"==dateFormat.toLowerCase()?(dateSep="/",value=yearVal+dateSep+monthIndex):"dd-mm-yyyy"==dateFormat.toLowerCase()||"mm-dd-yyyy"==dateFormat.toLowerCase()?(dateSep="-",value=monthIndex+dateSep+yearVal):"dd.mm.yyyy"==dateFormat.toLowerCase()&&(dateSep=".",value=monthIndex+dateSep+yearVal),value}function convertSelectedValToMonthYear(monthIndex,yearVal,dateFormat,dateLocale){dateLocale=dateLocale.toString();var value="";if("dd-mmm-yyyy"==dateFormat.toLowerCase()||"dd-mmmm-yyyy"==dateFormat.toLowerCase()||"mmmm-dd-yyyy"==dateFormat.toLowerCase()){var localeMonthArray,dateSep="-";localeMonthArray="dd-mmm-yyyy"==dateFormat.toLowerCase()?CustomDateLocale[dateLocale].monthNamesShort:CustomDateLocale[dateLocale].monthNames,monthVal=localeMonthArray[monthIndex-1],value=monthVal+dateSep+yearVal}else value=getMonthYearValueForNumericalDateFormats(yearVal,dateFormat,monthIndex);return value}function setMonthYearLimit(inputElement,dateFormat,dateLocale,monthYearPicker){var inpYearValue,inpMonthValue;getAndSetBasicMonthYearMinMaxRanges(inputElement,dateFormat,dateLocale);var currYearValue,value=$(inputElement).val();if(""!=value){var monthYearElem=splitMonthYearVal(value,dateFormat,dateLocale);inpYearValue=monthYearElem[1],inpMonthValue=monthYearElem[0],currYearValue=getValidYearFromRangeType(monthYearPicker,inpYearValue)}else currYearValue=getValidYearFromRangeType(monthYearPicker,ZFMonthYearComponent.currentDate.getFullYear());enableDisableMonthsAndAddRemoveClassInMYPicker(monthYearPicker,inpMonthValue,inpYearValue,undefined,currYearValue),$(monthYearPicker).find("select[elname=selectYear]").val(currYearValue).trigger("change.select2")}function monthYearPickerHandler(inputElement,monthYearPicker,dateFormat,dateLocale,isValidationRequired){setMonthYearLimit(inputElement,dateFormat,dateLocale,monthYearPicker),isValidationRequired&&bindSelect2FuncForAccessibility($(monthYearPicker).find("select[elname=selectYear]")),ZFUtil.closeHoverTextPopup(),$(monthYearPicker).show(),$(inputElement).addClass("hasMonthYearPicker")}function addCurrentClass(monthYearPicker,yearValue){var selectedMonthLiElem,currentMonth=ZFMonthYearComponent.currentDate.getMonth();yearValue==ZFMonthYearComponent.currentDate.getFullYear()&&(selectedMonthLiElem=$(monthYearPicker).find("li[monthIndex="+(currentMonth+1)+"]"),$(selectedMonthLiElem).hasClass("disabledMonth")||$(selectedMonthLiElem).addClass("currentMnth"))}function addSelectClass(monthYearPicker,monthValue){var selectedMonthLiElem=$(monthYearPicker).find("li[monthIndex="+(monthValue+1)+"]");$(selectedMonthLiElem).removeClass("currentMnth"),$(selectedMonthLiElem).hasClass("disabledMonth")||$(selectedMonthLiElem).addClass("select")}function positionMonthYearPicker(monthYearElem,monthYearPicker){if($(monthYearElem).is(":visible")){var secondPos=$(monthYearElem).offset(),top=secondPos.top,left=secondPos.left,topAndHeight=top+monthYearElem.offsetHeight;if($(monthYearPicker).css("left",left+"px"),topAndHeight+$(monthYearPicker).outerHeight(!0)>$(window).outerHeight(!0)){var modifiedTopAndHeight=top-$(monthYearPicker).outerHeight(!0);$(monthYearPicker).css("top",modifiedTopAndHeight+"px")}else $(monthYearPicker).css("top",topAndHeight+"px");left+$(monthYearPicker).find("div[elname=monthPickerDiv]").width()>$(window).width()&&$(monthYearPicker).css("left",$(window).width()-$(monthYearPicker).find("div[elname=monthPickerDiv]").width())}else{var imgElem=$(monthYearElem).siblings("svg"),imgElemOffset=$(imgElem).offset();top=imgElemOffset.top,left=imgElemOffset.left;$(monthYearPicker).css("top",top+"px"),$(monthYearPicker).css("left",left-$(monthYearPicker).find("div[elname=monthPickerDiv]").outerWidth(!0)+"px")}}function bindActionOnYearChangeForMonthYearPicker(inputElement,monthYearPicker,dateFormat,dateLocale){var monthYearPickerYearElem=$(monthYearPicker).find("select[elname=selectYear]");$(monthYearPickerYearElem).on("select2:select",function(e){var inpYearValue,inpMonthValue,selectedYear=$(this).val(),value=$(inputElement).val();if(""!=value){var monthYearElem=splitMonthYearVal(value,dateFormat,dateLocale);inpYearValue=monthYearElem[1],inpMonthValue=monthYearElem[0]}enableDisableMonthsAndAddRemoveClassInMYPicker(monthYearPicker,inpMonthValue,inpYearValue,selectedYear,getValidYearFromRangeType(monthYearPicker,selectedYear))})}function setValueToInputElement(inputElement,monthValue,yearValue,dateFormat,dateLocale){if(typeof monthValue!=ResponseKey.UNDEFINED&&""!=monthValue&&typeof yearValue!=ResponseKey.UNDEFINED&&""!=yearValue){var monthYearValue=convertSelectedValToMonthYear(monthValue,yearValue,dateFormat,dateLocale);$(inputElement).val(monthYearValue)}}function removePickerClassAndHidePicker(inputElement){$(inputElement).removeClass("hasMonthYearPicker"),hideMonthYearPicker()}function getAndSetBasicMonthYearMinMaxRanges(inputElement,dateFormat,dateLocale){if(typeof ZFLive!=ResponseKey.UNDEFINED&&typeof ZFLive.dateConstraintJson!=ResponseKey.UNDEFINED&&""!=ZFLive.dateConstraintJson){var fldLi=isNewHtmlDOM()?$(inputElement).closest("div[elname=livefield-elem]"):$(inputElement).closest("li[elname=livefield-elem]");if(typeof fldLi!=ResponseKey.UNDEFINED){var dateJson=ZFLive.dateConstraintJson[fldLi.attr("linkname")];typeof dateJson!=ResponseKey.UNDEFINED&&""!=dateJson&&setMinMaxMonthYearRangesOfMYPicker(dateJson,inputElement,dateFormat,dateLocale)}}}function initializeMonthYearPicker(inputElement,dateFormat,dateLocale,isBuilder,isValidationRequired){var monthYearPicker=getMonthYearPickerInst();$(inputElement).off("focus").on("focus",function(e){if($(this).hasClass("hasMonthYearPicker"))return removePickerClassAndHidePicker(this),!1;positionMonthYearPicker(this,monthYearPicker),monthYearPickerHandler($(this),monthYearPicker,dateFormat,dateLocale,isValidationRequired),bindActionOnYearChangeForMonthYearPicker(this,monthYearPicker,dateFormat,dateLocale),callOnKeyDown(inputElement,monthYearPicker,dateFormat,dateLocale);var monthYearPickerList=$(monthYearPicker).find("ul[elname=monthsUl]");$(monthYearPickerList).off("click"),$(monthYearPickerList).on("click",function(event){var elem;if(elem="DIV"===event.target.tagName?$(event.target).parent():$(event.target),!$(event.target).parent().hasClass("disabledMonth"))return setValueToInputElement(inputElement,$(elem).attr("monthIndex"),$(monthYearPicker).find("select[elname=selectYear]").val(),dateFormat,dateLocale),$(monthYearPickerList).off("click"),$(inputElement).off("keydown"),isBuilder&&hideMonthYearFldList(inputElement),$(inputElement).change(),typeof ZFLive!=ResponseKey.UNDEFINED&&ZFLive.isAccessibilitySupported&&$(inputElement).focus(),removePickerClassAndHidePicker(inputElement),!1}),$(monthYearPickerList).off("keydown"),$(monthYearPickerList).on("keydown",function(event){switch(event.keyCode){case 13:if(!$(event.target).parent().hasClass("disabledMonth"))return setValueToInputElement(inputElement,$(event.target).parent().attr("monthIndex"),$(monthYearPicker).find("select[elname=selectYear]").val(),dateFormat,dateLocale),$(inputElement).trigger("change"),typeof ZFLive!=ResponseKey.UNDEFINED&&ZFLive.isAccessibilitySupported&&$(inputElement).focus(),removePickerClassAndHidePicker(inputElement),!1;break;case 9:handleTabKeyNavigationMonthYearPicker($(inputElement).parent(),1);break;case 32:if(!$(event.target).parent().hasClass("disabledMonth"))return setValueToInputElement(inputElement,$(event.target).parent().attr("monthIndex"),$(monthYearPicker).find("select[elname=selectYear]").val(),dateFormat,dateLocale),$(inputElement).trigger("change"),typeof ZFLive!=ResponseKey.UNDEFINED&&ZFLive.isAccessibilitySupported&&$(inputElement).focus(),$(inputElement).off("keydown"),removePickerClassAndHidePicker(inputElement),!1}}),$(monthYearPicker).find("select[elname=selectYear]").next().find("span.select2-selection").off("keydown").on("keydown",function(event){switch(event.keyCode){case 9:handleTabKeyNavigationMonthYearPicker($(inputElement).parent(),0)}})}),$(inputElement).off("click").on("click",function(e){if($(this).hasClass("hasMonthYearPicker"))return!1;callOnKeyDown(inputElement,monthYearPicker,dateFormat,dateLocale),ZFUtil.closeHoverTextPopup(),$(monthYearPicker).show()})}function callOnKeyDown(inputElement,monthYearPicker,dateFormat,dateLocale){$(inputElement).off("keydown").on("keydown",function(event){if(13===event.keyCode){var monthValue,monthYearPickerList=$(monthYearPicker).find("ul[elname=monthsUl]"),selectedMonthLi=$(monthYearPickerList).find("li.select");0==$(selectedMonthLi).length?(selectedMonthLi=$(monthYearPickerList).find("li.currentMnth"),$(selectedMonthLi).length>0&&(monthValue=$(selectedMonthLi).attr("monthIndex"))):monthValue=$(selectedMonthLi).attr("monthIndex");var yearValue=$(monthYearPicker).find("select[elname=selectYear]").val();return setValueToInputElement(inputElement,monthValue,yearValue,dateFormat,dateLocale),removePickerClassAndHidePicker(inputElement),$(inputElement).off("keydown"),$(inputElement).trigger("change"),!1}if(9==event.keyCode)$(inputElement).removeClass("hasMonthYearPicker"),hideMonthYearPicker();else if(event.altKey&&40===event.keyCode&&typeof ZFLive!=ResponseKey.UNDEFINED&&ZFLive.isAccessibilitySupported){var setFocuedElem=$("#monthYearPicker").find("li.select");0===$(setFocuedElem).length&&(setFocuedElem=$("#monthYearPicker").find("li.currentMnth")),0===$(setFocuedElem).length&&(setFocuedElem=$("#monthYearPicker").find("li:first")),setTimeout(function(){$(setFocuedElem).find("div").focus()},0)}})}function monthYearClassicInit(fieldlinkname,dateFormat,dateLocale,isSubformField,sfRow){var monthYearFldLi;monthYearFldLi=isSubformField?$(sfRow).find("li[compname="+fieldlinkname+"]"):getFieldElemWithFldLinkNameAttrLivefieldElem(fieldlinkname),initializeMonthYearPicker($(monthYearFldLi).find("input[id="+fieldlinkname+"-monthyear]"),dateFormat,dateLocale,!1,!0)}function setMonthLabelsForPicker(monthYearPickerUl,dateLocale){for(var localeMonthArray=CustomDateLocale[dateLocale].monthNamesShort,i=0;i<12;i++){var eachLi=$(monthYearPickerUl).find("li[monthIndex="+(i+1)+"]");$(eachLi).find("div").length>0?$(eachLi).find("div").text(localeMonthArray[i]):$(eachLi).text(localeMonthArray[i])}}function setMonthLabelsInMYPickerAndModifyActionsOfMYPickerYearSelect(monthYearPicker,dateLocale){setMonthLabelsForPicker($(monthYearPicker).find("ul[elname=monthsUl]"),dateLocale);var monthYearPickerYearElem=$(monthYearPicker).find("select[elname=selectYear]");$(monthYearPickerYearElem).select2({theme:"default select2MonthYear"}).on("select2:open",function(){$(".select2-search__field").attr("maxlength",4)})}function enableDisableMonthsAndAddRemoveClassInMYPicker(monthYearPicker,inpMonthValue,inpYearValue,selectYearValue,currYearValue){var checkYearValue,rangeType=$(monthYearPicker).attr("rangeType"),minYearValue=$(monthYearPicker).attr("minYearValue"),maxYearValue=$(monthYearPicker).attr("maxYearValue"),minMonthValue=$(monthYearPicker).attr("minMonthValue"),maxMonthValue=$(monthYearPicker).attr("maxMonthValue");$(monthYearPicker).find("li").removeClass("select").removeClass("currentMnth").removeClass("disabledMonth"),checkYearValue=typeof selectYearValue!=ResponseKey.UNDEFINED?selectYearValue:typeof inpYearValue!=ResponseKey.UNDEFINED?inpYearValue:ZFMonthYearComponent.currentDate.getFullYear();var disabledMonths=[],disabledMonthsInString="";typeof $(monthYearPicker).attr("disabledMonths")!=ResponseKey.UNDEFINED&&(disabledMonthsInString=$(monthYearPicker).attr("disabledMonths").split(","));for(var i=0;iminYearValue&&checkYearValue=maxYearValue&&(minMonthValue=0):7==rangeType&&minYearValue!=maxYearValue&&(checkYearValue>=maxYearValue&&(minMonthValue=0),checkYearValue<=minYearValue&&(maxMonthValue=11)),disableMonthValuesForMYPicker($(monthYearPicker).find("ul[elname=monthsUl]").find("li"),minMonthValue,maxMonthValue,disabledMonths)}addCurrentClass(monthYearPicker,currYearValue),typeof inpYearValue!=ResponseKey.UNDEFINED&&(typeof selectYearValue!=ResponseKey.UNDEFINED?inpYearValue==selectYearValue&&addSelectClass(monthYearPicker,inpMonthValue):minYearValue<=inpYearValue&&inpYearValue<=maxYearValue&&addSelectClass(monthYearPicker,inpMonthValue))}function configureMonthYearPicker(inputElement,dateFormat,dateLocale,isValidationRequired,isBuilder){var monthYearPicker=getMonthYearPickerInst();initializeMonthYearPicker(inputElement,dateFormat,dateLocale,isBuilder,isValidationRequired),setValidationForMonthYear(monthYearPicker,dateLocale,isValidationRequired)}function setValidationForMonthYear(monthYearPicker,dateLocale,isValidationRequired){setMonthLabelsInMYPickerAndModifyActionsOfMYPickerYearSelect(monthYearPicker,dateLocale),isValidationRequired||($(monthYearPicker).attr("minMonthValue",0),$(monthYearPicker).attr("maxMonthValue",11),$(monthYearPicker).attr("minYearValue",1900),$(monthYearPicker).attr("maxYearValue",2100),setYearRangeForMonthYearPicker(getMonthYearPickerInst(),1900,2100))}function onClickImgIconOfMonthYear(imgElem){var inputElem=$(imgElem).siblings("input[elname=month_limit_inp],input[elname=field-initial-value],input[elname=monthyear]"),isInputDisabled=$(inputElem).is(":disabled");typeof isInputDisabled!=ResponseKey.UNDEFINED&&isInputDisabled||$(inputElem).trigger("focus")}$(document).on("keypress",".select2MonthYear .select2-search__field",function(){$(this).val($(this).val().replace(/[^\d].+/,"")),(event.which<48||event.which>57)&&event.preventDefault()}),$(document).on("mousedown",function(event){var target=$(event.target);"#monthYearPicker"===target[0].id||0!==target.parents("#monthYearPicker").length||target.hasClass("hasMonthYearPicker")||hideMonthYearPicker()});