// $Id: $ /** * IMPORTANT NOTE: This compressed js file includes Zoho Forms Forms/Report live js. */ function ZFLiveFormFocusHanderOnNavigation(actionType,pageNo){this.actionType=actionType,this.pageNo=pageNo}function ZFLiveFieldFocusHander(fieldElem,forError){this.fieldElem=fieldElem,this.isDisabledField=$(fieldElem).hasClass("fieldDisabled"),this.isFocusForError=void 0!==forError&&forError}function setFocusForElementThatCannotBeFocused(focusElem,callBackOnFocus,callBackFunctionParam){if(isSfChild(focusElem)){var scrollToViewElem=$(focusElem);if("livefield-elem"!=$(focusElem).attr("elname")){var closestFieldElem=$(focusElem).closest('[elname="livefield-elem"]');$(closestFieldElem).length>0&&(scrollToViewElem=closestFieldElem)}$(scrollToViewElem)[0].scrollIntoView({behavior:"auto",block:"center"})}if(isEmbeddedForm()&&(isMobileBrowser()||isSafari()))setTimeout(function(){var hiddenInput=$("");$(hiddenInput).attr("type","text"),$(hiddenInput).attr("readonly","true"),$(hiddenInput).attr("style","position: absolute; opacity: 0; pointer-events: none"),$(focusElem).prepend(hiddenInput),$(hiddenInput).focus(),setTimeout(function(){var existingTabIndex=setTabIndexForElementAndMakeFocus(focusElem);$(hiddenInput).remove(),resetTabIndexForElementAndMakeCallBackWithTimeout(focusElem,existingTabIndex,callBackOnFocus,callBackFunctionParam)},500)},500);else{var focusTimout=0;isiOSMobileBrowser()&&(focusTimout=100),setTimeout(function(){var existingTabIndex=setTabIndexForElementAndMakeFocus(focusElem);resetTabIndexForElementAndMakeCallBackWithTimeout(focusElem,existingTabIndex,callBackOnFocus,callBackFunctionParam)},focusTimout)}}function setTabIndexForElementAndMakeFocus(focusElem){var existingTabIndex=$(focusElem).attr("tabindex");return(void 0===existingTabIndex||existingTabIndex<=0)&&$(focusElem).attr("tabindex",0),$(focusElem).focus(),existingTabIndex}function resetTabIndexForElementAndMakeCallBackWithTimeout(focusElem,existingTabIndex,callBackOnFocus,callBackFunctionParam){setTimeout(function(){void 0===existingTabIndex?$(focusElem).removeAttr("tabindex"):$(focusElem).attr("tabindex",existingTabIndex),void 0!==callBackOnFocus&&callBackOnFocus(callBackFunctionParam)},500)}function ZFFormulaCondition(){this.fieldLinkName,this.operator,this.condValue,this.is_subform_child=!1,this.result=!1,this.group_name}ZFLiveFormFocusHanderOnNavigation.prototype.setFocus=function(){if("onload"==this.actionType)this.setFocusOnLoad();else if("pageNav"==this.actionType)if(isMobileBrowser()&&isEmbeddedForm()){var firstLi=$("div[elname=formBodyULName][page_no='"+this.pageNo+"']").find("div[elname=livefield-elem]:visible").first();new ZFLiveFieldFocusHander($(firstLi),!1).focusThisFieldElement()}else this.setFocusOnPageNav()},ZFLiveFormFocusHanderOnNavigation.prototype.setFocusOnLoad=function(){$(ZFPageAnimation.scrollWindow).scrollTop(0)},ZFLiveFormFocusHanderOnNavigation.prototype.setFocusOnPageNav=function(){if(ZFLive.ShowPageTitle===PageTitleOptions.NAVIGATION_BAR&&$("#navigBar").is(":visible")){var pageNeedToBeFocused=$("div#pageTitleCont").find("p[pagenum='"+this.pageNo+"']");0==$("div#pageTitleCont").length&&(pageNeedToBeFocused=$("div#navigBar").find("div[pagenum='"+this.pageNo+"']")),$(pageNeedToBeFocused).attr("tabindex",0),setFocusForElementThatCannotBeFocused(pageNeedToBeFocused)}else if(ZFLive.ShowPageTitle===PageTitleOptions.PAGE)setFocusForElementThatCannotBeFocused($("div[elname=formBodyULName][page_no='"+this.pageNo+"']").find("div[elname=formPageHeader]:first").find("h2"));else{var firstLi=$("div[elname=formBodyULName][page_no='"+this.pageNo+"']").find("div[elname=livefield-elem]:visible").first();new ZFLiveFieldFocusHander($(firstLi),!1).focusThisFieldElement()}},ZFLiveFieldFocusHander.prototype.getParentSfElem=function(){return $(this.fieldElem).closest("div[elname=subFormFieldsUl]").closest("div[elname=livefield-elem]")},ZFLiveFieldFocusHander.prototype.setErrorForSfCard=function(sfParentElem){var rowId=getClosestParentSubFormUL(sfParentElem).attr("rowid"),thisSfCardElem=$(sfParentElem).find('div[elname="sfcardelem"][cardrowid="'+rowId+'"]');$(thisSfCardElem).attr("tabindex","1").focus().removeAttr("tabindex")},ZFLiveFieldFocusHander.prototype.focusThisFieldElement=function(){var elemTypeInt=$(this.fieldElem).attr("elem_type_int");if(void 0===elemTypeInt||9!=elemTypeInt)if(!isMobileBrowser()||isEmbeddedForm()){if(this.isFocusForError){var sfParentElem=this.getParentSfElem();if($(sfParentElem).length>0&&"2"==$(sfParentElem).attr("viewtype"))return void this.setErrorForSfCard($(sfParentElem))}this.isDisabledField?this.setFocusForFieldsThatCannotBeFocused():void 0===elemTypeInt||7!=elemTypeInt?void 0===elemTypeInt||5!=elemTypeInt?void 0===elemTypeInt||1!=elemTypeInt?void 0===elemTypeInt||6!=elemTypeInt?void 0===elemTypeInt||8!=elemTypeInt?this.setFocusForFormFieldType():this.setFocusForEmbedField():this.setFocusForPaymentField():this.setFocusForFieldsThatCannotBeFocused():this.setFocusForDescriptionField():this.setFocusForFirstFieldInSubFormElement()}else this.setFocusForFieldsThatCannotBeFocused();else this.setFocusForLayoutField()},ZFLiveFieldFocusHander.prototype.setFocusForPaymentField=function(){this.isFocusForError?$(this.fieldElem).find("input:enabled:first").focus():this.setFocusForElementThatCannotBeFocused($(this.fieldElem))},ZFLiveFieldFocusHander.prototype.setFocusForDescriptionField=function(){this.setFocusForElementThatCannotBeFocused($(this.fieldElem).find("label[elname=descFldLabel]"))},ZFLiveFieldFocusHander.prototype.setFocusForEmbedField=function(){this.setFocusForFieldsThatCannotBeFocused()},ZFLiveFieldFocusHander.prototype.setFocusForNameOrAddressField=function(){this.isFocusForError?this.setFocusForErrorCaseInAddressOrname():0===$(this.fieldElem).find("span[elname=compEachElem]:first").find("input:first").length?this.focusSelectElem($(this.fieldElem).find("select:first")):$(this.fieldElem).find("span[elname=compEachElem]:first").find("input:first").focus()},ZFLiveFieldFocusHander.prototype.setFocusForErrorCaseInAddressOrname=function(){var elemInp=$(this.fieldElem).find("div,span").find(".error1").first().find(":input[type!=hidden]:first");typeof elemInp!=ResponseKey.UNDEFINED&&$(elemInp).is("select")?this.focusSelectElem(elemInp):$(elemInp)[0].hasAttribute("disabled")?this.setFocusForElementThatCannotBeFocused($(elemInp)):$(elemInp).focus()},ZFLiveFieldFocusHander.prototype.focusSelectElem=function(selectElem){isEmbeddedForm()&&isSafari()?this.setFocusForElementThatCannotBeFocused($(selectElem).closest('[elname="livefield-elem"]'),ZFLiveFieldFocusHander.focusSelectElemWithoutSpecialHanding,selectElem):ZFLiveFieldFocusHander.focusSelectElemWithoutSpecialHanding(selectElem)},ZFLiveFieldFocusHander.focusSelectElemWithoutSpecialHanding=function(selectElem){$(selectElem).focus(),$(selectElem).next().find(".select2FormCont").focus(),$(selectElem).hasClass("select2-hidden-accessible")&&setTimeout(function(){$(selectElem).select2("focus")},100)},ZFLiveFieldFocusHander.prototype.setFocusForMatrixChoice=function(){if(isEmbeddedForm()&&isSafari()){var choiceType=$(this.fieldElem).attr("choicetype");if(choiceType==MatrixChoicesType.RADIO.CODE||choiceType==MatrixChoicesType.CHECKBOX.CODE)return void this.setFocusForElementThatCannotBeFocused($(this.fieldElem),ZFLiveFieldFocusHander.setFocusForMatrixChoiceCallBackHander,this)}this.setFocusForMatrixChoiceWithoutSpecialHandling()},ZFLiveFieldFocusHander.setFocusForMatrixChoiceCallBackHander=function(callingObject){callingObject.setFocusForMatrixChoiceWithoutSpecialHandling()},ZFLiveFieldFocusHander.prototype.setFocusForMatrixChoiceWithoutSpecialHandling=function(){$(this.fieldElem).attr("choicetype")!=MatrixChoicesType.DROPDOWN.CODE?this.setFocusForMatrixTextboxFld():this.setFocusForMatrixDropdown()},ZFLiveFieldFocusHander.prototype.setFocusForMatrixDropdown=function(){var selectElem=$(this.fieldElem).find("td:first").find("select:first");if(this.isFocusForError){var selectElemWithError=$(this.fieldElem).find("td:first").find("select.errorMatrixInput:first");$(selectElemWithError).length>0&&(selectElem=selectElemWithError)}$(selectElem).length>0&&this.focusSelectElem(selectElem)},ZFLiveFieldFocusHander.prototype.setFocusForMatrixTextboxFld=function(){var focusElem=$(this.fieldElem).find("input:first");if(this.isFocusForError){var firstErroInput=$(this.fieldElem).find("input.errorMatrixInput:first");$(firstErroInput).length>0&&(focusElem=firstErroInput)}$(focusElem).focus()},ZFLiveFieldFocusHander.prototype.setFocusForMultiLine=function(){$(this.fieldElem).find("textarea").focus()},ZFLiveFieldFocusHander.prototype.setFocusForTimeField=function(){var selectElem=$(this.fieldElem).find("select:first");this.focusSelectElem(selectElem)},ZFLiveFieldFocusHander.prototype.setFocusForDropdownField=function(){var selectElem=$(this.fieldElem).find("select");this.focusSelectElem(selectElem)},ZFLiveFieldFocusHander.prototype.setFocusForMultipleChoiceField=function(){$(this.fieldElem).find(".select2-search__field").focus()},ZFLiveFieldFocusHander.prototype.setFocusForImageChoiceField=function(){isEmbeddedForm()&&isSafari()?this.setFocusForElementThatCannotBeFocused($(this.fieldElem),ZFLiveFieldFocusHander.setFocusForImageChoiceCallBackHander,$(this.fieldElem)):this.setFocusForImageChoiceFieldWithoutSpecialHanding()},ZFLiveFieldFocusHander.prototype.setFocusForImageChoiceFieldWithoutSpecialHanding=function(){var choiceType=$(this.fieldElem).find("div[elname=imageChoiceEle]").attr("choicetype");choiceType==ImageChoicesType.RADIO||choiceType==ImageChoicesType.CHECKBOX?$(this.fieldElem).find("input:first").focus():choiceType==ImageChoicesType.IMG_PICKER&&$(this.fieldElem).find("div[elname=choiceContDiv]:first").attr("tabindex","-1").focus()},ZFLiveFieldFocusHander.setFocusForImageChoiceCallBackHander=function(callingObject){callingObject.setFocusForImageChoiceFieldWithoutSpecialHanding()},ZFLiveFieldFocusHander.prototype.isFieldWithInputBox=function(){var comptype=$(this.fieldElem).attr("comptype"),compTypeInt=parseInt(comptype),basicFields=[];return basicFields.push(ZFFieldTypeConstants.SINGLE_LINE),basicFields.push(ZFFieldTypeConstants.CURRENCY),basicFields.push(ZFFieldTypeConstants.WEBSITE),basicFields.push(ZFFieldTypeConstants.DECIMAL),-1!=$.inArray(compTypeInt,basicFields)},ZFLiveFieldFocusHander.prototype.isFieldSupportedWithReconfirm=function(){var comptype=$(this.fieldElem).attr("comptype"),compTypeInt=parseInt(comptype),basicFields=[];return basicFields.push(ZFFieldTypeConstants.NUMBER),basicFields.push(ZFFieldTypeConstants.EMAIL),basicFields.push(ZFFieldTypeConstants.PHONE),-1!=$.inArray(compTypeInt,basicFields)},ZFLiveFieldFocusHander.prototype.setFocusForFieldWithInputBox=function(){ZFLiveFieldFocusHander.setFocusForFieldWithInputBox(this.fieldElem)},ZFLiveFieldFocusHander.setFocusForFieldWithInputBox=function(fieldElem){$(fieldElem).find("input:first").focus()},ZFLiveFieldFocusHander.prototype.setFocusForFieldWithReconfirm=function(){this.isFocusForError?this.setFocusForFieldWithReconfirmDuringError():$(this.fieldElem).find("input:first").focus()},ZFLiveFieldFocusHander.prototype.setFocusForFieldWithReconfirmDuringError=function(){var errorElem=$(this.fieldElem).find("[elname=error]");if($(errorElem).is(":visible"))$(this.fieldElem).find(":input[type!=hidden]:first").focus();else{var needReconf=$(this.fieldElem).attr("need_reconf");if(typeof needReconf!=ResponseKey.UNDEFINED&&"true"==needReconf){var reconfErrorElem=$(this.fieldElem).find("[elname=reconf-error]");if($(reconfErrorElem).is(":visible")){var comptype=parseInt($(this.fieldElem).attr("comptype"));return void(comptype===ZFFieldTypeConstants.EMAIL||comptype===ZFFieldTypeConstants.NUMBER?$(this.fieldElem).find("span[elname=livefield-reconf-elem]").find("input").focus():$(this.fieldElem).find("div[elname=confPhoneFld]").find("input:first").focus())}}}},ZFLiveFieldFocusHander.prototype.setFocusForFormFieldType=function(){var compTypeInt=parseInt($(this.fieldElem).attr("comptype")),parentGridField=$(this.fieldElem).closest("div[elname=livefield-elem][elem_type_int=9][elemtype=gridField]");if($(parentGridField).length>0&&($(parentGridField).attr("expcollenabled")===BooleanConstants.TRUE&&$(parentGridField).attr("isexpanded")===BooleanConstants.FALSE))return void new ZFLiveFieldFocusHander($(parentGridField),!1).focusThisFieldElement();this.isFieldWithInputBox()?this.setFocusForFieldWithInputBox():this.isFieldSupportedWithReconfirm()?this.setFocusForFieldWithReconfirm():compTypeInt===ZFFieldTypeConstants.NAME||compTypeInt===ZFFieldTypeConstants.ADDRESS?this.setFocusForNameOrAddressField():compTypeInt===ZFFieldTypeConstants.MATRIX_CHOICE?this.setFocusForMatrixChoice():compTypeInt===ZFFieldTypeConstants.MULTI_LINE?this.setFocusForMultiLine():compTypeInt===ZFFieldTypeConstants.TIME?this.setFocusForTimeField():compTypeInt===ZFFieldTypeConstants.DROPDOWN?this.setFocusForDropdownField():compTypeInt===ZFFieldTypeConstants.MULTIPLE_CHOICE?this.setFocusForMultipleChoiceField():compTypeInt==ZFFieldTypeConstants.IMAGE_CHOICE?this.setFocusForImageChoiceField():compTypeInt===ZFFieldTypeConstants.ZOHO_CRM?this.focusZohoCrmField():compTypeInt===ZFFieldTypeConstants.SLIDER?this.setFocusForSliderField():compTypeInt===ZFFieldTypeConstants.RATING?this.setFocusForRatingField():compTypeInt===ZFFieldTypeConstants.SIGNATURE?this.setFocusForSignatureField():compTypeInt===ZFFieldTypeConstants.TERMS_CONDITIONS?this.setFocusForTermsAndConditionField():compTypeInt==ZFFieldTypeConstants.DECISION_BOX?this.setFocusForDecisionBoxField():compTypeInt==ZFFieldTypeConstants.RADIO?this.setFocusForRadioField():compTypeInt==ZFFieldTypeConstants.CHECKBOX?this.setFocusForRadioField():this.isDatePickerFields()?this.setFocusForDatePickerFields():this.isUploadFields()?this.setFocusForUploadFields():this.setFocusForFieldsThatCannotBeFocused()},ZFLiveFieldFocusHander.prototype.setFocusForDecisionBoxField=function(){isEmbeddedForm()&&isSafari()?this.setFocusForElementThatCannotBeFocused($(this.fieldElem),ZFLiveFieldFocusHander.setFocusForFieldWithInputBox,$(this.fieldElem)):this.setFocusForFieldWithInputBox()},ZFLiveFieldFocusHander.prototype.setFocusForRadioField=function(){isEmbeddedForm()&&isSafari()?this.setFocusForElementThatCannotBeFocused($(this.fieldElem),ZFLiveFieldFocusHander.setFocusForFieldWithInputBox,$(this.fieldElem)):this.setFocusForFieldWithInputBox()},ZFLiveFieldFocusHander.prototype.setFocusForCheckBoxField=function(){isEmbeddedForm()&&isSafari()?this.setFocusForElementThatCannotBeFocused($(this.fieldElem),ZFLiveFieldFocusHander.setFocusForFieldWithInputBox,$(this.fieldElem)):this.setFocusForFieldWithInputBox()},ZFLiveFieldFocusHander.prototype.isDatePickerFields=function(){var comptype=$(this.fieldElem).attr("comptype"),compTypeInt=parseInt(comptype),datePickerFields=[];return datePickerFields.push(ZFFieldTypeConstants.DATE),datePickerFields.push(ZFFieldTypeConstants.DATETIME),datePickerFields.push(ZFFieldTypeConstants.MONTHYEAR),-1!=$.inArray(compTypeInt,datePickerFields)},ZFLiveFieldFocusHander.prototype.setFocusForSliderField=function(){this.setFocusForElementThatCannotBeFocused($(this.fieldElem).find("a[elname=circular-slider]"))},ZFLiveFieldFocusHander.prototype.setFocusForRatingField=function(){this.setFocusForElementThatCannotBeFocused($(this.fieldElem).find("div[elname=ratingSubData]").find("a:first"))},ZFLiveFieldFocusHander.prototype.setFocusForSignatureField=function(){this.setFocusForFieldsThatCannotBeFocused(),isAccessibilitySupported()&&$(this.fieldElem).find("canvas").focus()},ZFLiveFieldFocusHander.prototype.setFocusForDatePickerFields=function(){isMobileBrowser()&&isEmbeddedForm()?$(this.fieldElem).find("input").focus():(this.setFocusForFieldsThatCannotBeFocused(),isAccessibilitySupported()&&$(this.fieldElem).find("input").focus())},ZFLiveFieldFocusHander.prototype.setFocusForTermsAndConditionField=function(){var focusElem=$(this.fieldElem).find("div[elname=terms]");0==focusElem.length&&(focusElem=$(this.fieldElem).find("input[elname=statusCB]")),this.setFocusForElementThatCannotBeFocused($(focusElem))},ZFLiveFieldFocusHander.prototype.isUploadFields=function(){var comptype=$(this.fieldElem).attr("comptype"),compTypeInt=parseInt(comptype),uploadFields=[];return uploadFields.push(ZFFieldTypeConstants.FILE_UPLOAD),uploadFields.push(ZFFieldTypeConstants.IMAGE_UPLOAD),uploadFields.push(ZFFieldTypeConstants.MEDIA_UPLOAD),-1!=$.inArray(compTypeInt,uploadFields)},ZFLiveFieldFocusHander.prototype.setFocusForUploadFields=function(){isEmbeddedForm()&&isSafari()?this.setFocusForElementThatCannotBeFocused($(this.fieldElem),ZFLiveFieldFocusHander.setFocusForFieldWithInputBox,$(this.fieldElem)):this.setFocusForFieldWithInputBox()},ZFLiveFieldFocusHander.prototype.setFocusForFirstFieldInGridElement=function(){var gridFlds=$(this.fieldElem).find("div[elname=livefield-elem]:visible");if(gridFlds.length>0){var firstGridField=$(gridFlds).first();new ZFLiveFieldFocusHander($(firstGridField)).focusThisFieldElement()}else this.setFocusForFieldsThatCannotBeFocused()},ZFLiveFieldFocusHander.prototype.setFocusForFirstFieldInSubFormElement=function(){if("2"==$(this.fieldElem).attr("viewtype"))this.setFocusForElementThatCannotBeFocused($(this.fieldElem).find("div[elname=addNewCardElem]"));else{var sfUls=$(this.fieldElem).find('[elname="subFormFieldsUl"]');if(sfUls.length>0){var firstSfUl=$(sfUls).first(),sfChildElem=$(firstSfUl).find("div[elname=livefield-elem]:visible").first();new ZFLiveFieldFocusHander($(sfChildElem)).focusThisFieldElement()}else this.setFocusForFieldsThatCannotBeFocused();isAccessibilitySupported()&&$(this.fieldElem).find("div[elname=sfMoreCircle]").focus()}},ZFLiveFieldFocusHander.prototype.setFocusForFieldsThatCannotBeFocused=function(){this.setFocusForElementThatCannotBeFocused($(this.fieldElem))},ZFLiveFieldFocusHander.prototype.setFocusForElementThatCannotBeFocused=function(focusElem,callBackOnFocus,callBackFunctionParam){setFocusForElementThatCannotBeFocused(focusElem,callBackOnFocus,callBackFunctionParam)},ZFLiveFieldFocusHander.prototype.focusZohoCrmField=function(){var zohoCrmSearchWrapperDiv=$(this.fieldElem).find('div[elname="zoho-crm-search-wrapper-div"]');if($(zohoCrmSearchWrapperDiv).is(":visible")){var searchTextElem=$(zohoCrmSearchWrapperDiv).find(':text[elname="search-entry-input"]');$(searchTextElem).focus()}else setFocusForFieldsThatCannotBeFocused($(this.fieldElem))},ZFLiveFieldFocusHander.prototype.setFocusForLayoutField=function(){if($(this.fieldElem).attr("expcollenabled")===BooleanConstants.TRUE){var expandCollapseDiv=$(this.fieldElem).find('[elname="expandCollapseDiv"]');this.setFocusForElementThatCannotBeFocused($(expandCollapseDiv))}else this.setFocusForFirstFieldInGridElement()};var ZFFormulaConstants={VALUE:"value",FIELD_LINK_NAME:"field_link_name",COMP_OPER:"comparison_oper",LOGICAL_OPER:"logical_oper",CONDITIONS:"conditions",EXPRESSIONS:"expressions",EXPRESSION:"expression",LINK_NAME:"link_name",IS_SUBFORM_CHILD:"is_subform_child",OPERATOR:"operator",RESULT:"result",CONDN_VALUE:"condValue",FieldLinkName:"fieldLinkName",ROW_LINK_NAME:"row",OPT_GROUP_NAME:"group_name"},MatrixMandatoryType={NO_MANDATORY:1,ALL_MANDATORY:2,CUSTOM_MANDATORY:3},MediaTypeLiveConstant={AUDIO:2,VIDEO:3},SavedEntriesConstants={PREVIOUS:"PREVIOUS",NEXT:"NEXT"},ZFLive=new function(){this.portalName,this.formLinkName,this.fileUploadFields=[],this.valueJson={},this.fetchedLatitude="",this.fetchedLongitude="",this.isReqFromMobile=!1,this.isFormAdmin,this.storedFiles={},this.allImageType=["jpeg","jpg","gif","png","tif","tiff","webp","jfif","ico"],this.allAudioType=["mp3","wav","ogg","m4a","flac","wma","aiff"],this.allVideoType=["mp4","wmv","mov","avi","mkv","webm"],this.sfUniqueValidator={},this.mapPlacesJson={},this.advRuleExecutedFormulaFieldsList=[],this.mapResponse=null,this.isMatrixInTableFormat=!1,this.formHolidays={},this.disabledDaysMap={},this.visitorDetails,this.isMaIntegrationVidCapture,this.currentActionErrFieldsList=[],this.gridSubFieldsErrorList={},this.isRestHookCaptureEnabled},ZFLiveErrorConstants={mandatoryerror:i18n.entervalue,mandatoryerrornumber:i18n.entervaluenumber,mandatoryerrorcaptcha:i18n.entervaluecaptcha,mandatoryerrorrecaptcha:i18n.entervaluerecaptcha,emailerror:i18n.entervalidmail,numbererror:i18n.entervalidnumber,decimalerror:i18n.invaliddecimal,invalidcurrency:i18n.invalidcurrency,decimallengtherror:i18n.moredecimalplaces,urlerror:i18n.invalidurl,phoneformaterror:i18n.invalidphone,phoneinitialvalueerror:i18n.invalidinitialphone,invalidUSAphone:i18n.invalidUSAphone,countrycodeformaterror:i18n.invalidcountrycode,choicemandatoryerror:i18n.selectchoice,optionmandatoryerror:i18n.chooseoption,datemandatoryerror:i18n.selectdate,selectcountrycode:i18n.selectcountrycode,ratingmandatoryerror:i18n.selectrating,timemandatoryerror:i18n.selecttime,incompletetimeerror:i18n.incompleteinputtime,incompleteinputtimetwentyfour:i18n.incompleteinputtimetwentyfour,decisionmandatoryerror:i18n.checkfield,fileuploadmandatoryerror:i18n.choosefile,fileuploadlimiterror:i18n.filescountexceed,uploadsize:i18n.uploadsize,signaturemandatoryerror:i18n.incompletesignature,matrixchoicemandatoryerror:i18n.matrixchoicemandatory,checktcfield:i18n.checktcfield,maxchoicelimit:i18n.maxchoicelimit,minchoicelimit:i18n.minchoicelimit,fileuploadmaxsize:i18n.fileuploadmaxsize,alloweddomain:i18n.alloweddomain,restricteddomain:i18n.restricteddomain,minvalerror:i18n.minvalerror,maxvalerror:i18n.maxvalerror,maxcharlimit:i18n.maxcharlimit,mincharlimit:i18n.mincharlimit,maxwordlimit:i18n.maxwordlimit,mindatelimit:i18n.mindatelimit,maxdatelimit:i18n.maxdatelimit,disabledayslimit:i18n.disabledayslimit,mindigitslimit:i18n.mindigitslimit,maxdigitslimit:i18n.maxdigitslimit,invaliddate:i18n.invaliddate,invaliddatetime:i18n.invaliddatetime,mindatetimelimit:i18n.mindatetimelimit,maxdatetimelimit:i18n.maxdatetimelimit,minonecharlimit:i18n.minonecharlimit,minonewordlimit:i18n.minonewordlimit,maxonecharlimit:i18n.maxonecharlimit,maxonewordlimit:i18n.maxonewordlimit,minwordlimit:i18n.minwordlimit,emailsdonotmatch:i18n.emailsdonotmatch,phonenosdonotmatch:i18n.phonenosdonotmatch,numbersdonotmatch:i18n.numbersdonotmatch,recaptchaerror:i18n.recaptchaerror,uploadservererror:i18n.uploadservererror,phoneformatnumeronlyerror:i18n.phoneformatnumeronlyerror,matrixtextinputlimit:i18n.matrixtextinputlimit,matrixinputvaluelimit:i18n.matrixinputvaluelimit,matrixchoicetextboxmandatory:i18n.matrixchoicetextboxmandatory,invalidpatternformat:i18n.invalidpatternformat,invalidletterregexformat:i18n.invalidletterregexformat,invalidletterandnumregexformat:i18n.invalidletterandnumregexformat,invalidletternumandspaceregexformat:i18n.invalidletternumandspaceregexformat,invalidletterandspaceregexformat:i18n.invalidletterandspaceregexformat,matrixchoicecustommandatory:i18n.matrixchoicecustommandatory,matrixchoicecustomtextboxmandatory:i18n.matrixchoicecustomtextboxmandatory,matrixchoiceerrormessage:i18n.matrixchoiceerrormessage,mediarecordertypeerror:i18n.mediarecordertypeerror,no_camera_permission:i18n.no_camera_permission,mediarecapierror:i18n.mediarecapierror,no_mike_permission:i18n.no_mike_permission,no_mike_info:i18n.no_mike_info,mediafile_size_error:i18n.mediafile_size_error,pasttimeonlyerrormessage:i18n.pasttimeonlyerrormessage,futuretimeonlyerrormessage:i18n.futuretimeonlyerrormessage,validtimerangeerrormessage:i18n.validtimerangeerrormessage,mindatetimeafterlimit:i18n.mindatetimeafterlimit,maxdatetimebeforelimit:i18n.maxdatetimebeforelimit,invalid_state_value:i18n.invalid_state_value,matrixlimitresponsepercol:i18n.matrixlimitresponsepercol,monthyearmandatoryerror:i18n.selectmonthyear,entervalidmonthyear:i18n.entervalidmonthyear,minmonthyearlimit:i18n.minmonthyearlimit,maxmonthyearlimit:i18n.maxmonthyearlimit,disabledmonthslimit:i18n.disabledmonthslimit,decimaldonotmatch:i18n.decimaldonotmatch,currencydonotmatch:i18n.currencydonotmatch},ZFSubFormFldLiveConstants={IS_SUBFORM_CHILD:"isSubFormChild"},ZFLiveConstants={VERIFICATIONCODE:{KEY:"verificationcode",DIGEST:"digest",CAPTCHAVAL:"captchavalue"},RESPONSE:{ERRORS:"errors",ERROR:"error",UNDEFINED:"undefined",FORM_STATUS:"form_status",DATELIMIT:"datelimit",TIMELIMIT:"timelimit",SPANLIMIT:"spanlimit",EXCEED_FIELDS:"exceed_fields",CHOICES:"choices"},RECAPTCHA:{ERROR_CBOX:"verification_recaptchacbox",ERROR_INV:"verification_recaptchainv",CHECKBOX:"recaptchacbox",INVISIBLE:"recaptchainv"},GEOLOCATION:{Key:"geo_location",MANDATORY:"geo_location_mandatory",FENCE:"geo_location_fence"}};function focusFirstLiElemOnLoad(){if(isStandardForm())return floatingFormComponentsHandler(),void new ZFLiveFormFocusHanderOnNavigation("onload").setFocus();var liToBeFocussed=isStandardForm()?$("#formBodyDiv").find("div[elname=livefield-elem]:visible").first():$("#formBodyDiv").find("li[elname=livefield-elem]:visible").first(),compType=parseInt($(liToBeFocussed).attr("comptype"));if(isNaN(compType))if("PaymentAmount"==$(liToBeFocussed).attr("compname")&&0!=$(liToBeFocussed).find("input:enabled").length)$(liToBeFocussed).find("input:enabled:first").focus();else{var elemType=$(liToBeFocussed).attr("elemtype");if(void 0!==elemType&&"subFormField"==elemType)if("1"==$(liToBeFocussed).attr("viewtype")){var sfUls=isStandardForm()?$(liToBeFocussed).find("div[elname=subFormFieldsUl]"):$(liToBeFocussed).find('[elname="subFormFieldsUl"]');sfUls.length>0&&(liToBeFocussed=isStandardForm()?$(sfUls).find("div[elname=livefield-elem]:visible").first():$(sfUls).find("li[elname=livefield-elem]:visible").first(),compType=parseInt($(liToBeFocussed).attr("comptype")),isNaN(compType)||focusFirstFieldLiElemOnLoad(liToBeFocussed,compType))}}else compType!=ZFFieldTypeConstants.DATE&&compType!=ZFFieldTypeConstants.MONTHYEAR&&compType!=ZFFieldTypeConstants.DATETIME&&focusFirstFieldLiElemOnLoad(liToBeFocussed,compType)}function focusFirstFieldLiElemOnLoad(liToBeFocussed,compType){if(compType!=ZFFieldTypeConstants.DATE&&compType!=ZFFieldTypeConstants.DATETIME&&compType!=ZFFieldTypeConstants.MONTHYEAR)if(!isStandardForm()||compType!=ZFFieldTypeConstants.NAME&&compType!=ZFFieldTypeConstants.ADDRESS)if(isStandardForm()&&compType==ZFFieldTypeConstants.MATRIX_CHOICE&&$(liToBeFocussed).attr("choicetype")==MatrixChoicesType.DROPDOWN.CODE){selectElem=$(liToBeFocussed).find("div[elname=zfFieldDiv]").find("td:first").find("select:first");$(selectElem).length>0?focusSelectElem(selectElem):$(liToBeFocussed).find("input:first").focus()}else if(compType==ZFFieldTypeConstants.ADDRESS){if(0==$(liToBeFocussed).find("span:first").find("select").length)$(liToBeFocussed).find("input:first").focus();else focusSelectElem(selectElem=$(liToBeFocussed).find("select:first"))}else if(compType===ZFFieldTypeConstants.ZOHO_CRM)ZFCrmLive.zfCrmLive.focusZohoCrmField(liToBeFocussed);else if(0!=$(liToBeFocussed).find("input").length)$(liToBeFocussed).find("input:first").focus();else if(compType===ZFFieldTypeConstants.TIME||compType===ZFFieldTypeConstants.DROPDOWN||compType===ZFFieldTypeConstants.MULTIPLE_CHOICE){focusSelectElem(selectElem=$(liToBeFocussed).find("select:first"))}else compType===ZFFieldTypeConstants.MULTI_LINE?$(liToBeFocussed).find("textarea").focus():compType!==ZFFieldTypeConstants.RATING&&compType!==ZFFieldTypeConstants.SLIDER||$(liToBeFocussed).find("a:first").focus();else{var selectElem=$(liToBeFocussed).find("div[elname=zfFieldDiv]").find("span:first").find("select:first");$(selectElem).length>0?focusSelectElem(selectElem):$(liToBeFocussed).find("input:first").focus()}compType!=ZFFieldTypeConstants.ADDRESS&&compType!=ZFFieldTypeConstants.NAME||setFocusForFirstElemAccessibility(liToBeFocussed,compType)}function disableButtonNotNeeded(){var fieldsCount=0,fieldElems=isStandardForm()?$(ZFLive.formFormFieldsOuterWrapper).find("div[elname=formBodyULName]").find("div[elname=livefield-elem]"):$(ZFLive.formFormFieldsOuterWrapper).find("ul[elname=formBodyULName]").find("li");if($(fieldElems).each(function(index,elem){null!=$(elem).attr("compname")&&(fieldsCount+=1)}),0==fieldsCount){var formElem=$(ZFLive.formFormFieldsOuterWrapper);$(formElem).find("button[elname=submit]").hide(),$(formElem).find("button[elname=save]").hide(),$(formElem).find("button[elname=review]").hide()}var descLiElem=isStandardForm()?$("#formBodyDiv").find("div[compname=HtmlText]"):$("#formBodyDiv").find("li[compname=HtmlText]");$(descLiElem).find(":button").prop("disabled",!0)}function addCustomCSSStyles(){if(!("opacity"in document.body.style))for(var customStyleTag=document.getElementById("CUSTOM_STYLE_TAG").styleSheet,rulesArrayInStyleTag=customStyleTag.rules,numOfRulesInStyleTag=rulesArrayInStyleTag.length,ruleIndex=0;ruleIndexselectedIdx&&indexselectedIdx&&$(anchorElem).removeClass(getRatingOnClass())}),$(ratCountEm).html(selectedIdx+1)}function selectRating(elem,ratingElemCnt,totalCount){var parentElem,selectedIdx,ratingId,ratCountEm;ratingId=$(elem).attr("name");var fldLiElem=getClosestFieldElemLi(elem);ratCountEm=$(fldLiElem).find(".ratingCount").find("em[id="+ratingId+"]"),parentElem=$(elem).parent(),selectedIdx=$(parentElem).find("a[elattr=selected]").index(),ratingElemCnt==selectedIdx+1?($(parentElem).find("a").each(function(index,anchorElem){$(anchorElem).removeClass(getRatingOnClass()),isOneFieldForm()&&$(anchorElem).removeClass("selected"),$(anchorElem).attr({value:"",elattr:""}),isAccessibilitySupported()&&$(anchorElem).attr("aria-checked",!1)}),$(ratCountEm).html(0)):($(parentElem).find("a").each(function(index,anchorElem){$(anchorElem).attr("elattr",""),index0&&(valueJson[$(elemnew).attr("name")+"_group_name"]=fromReview?getGroupNameofSelectedChoice(elemnew,fldLinkName):getGroupValueofSelectedChoice(elemnew,fldLinkName)))})}function constructCheckBox(valueJson,elem,fromReview){var checkboxJsonArr=[];$(elem).find("input[type=checkbox]").each(function(indexelem,elemnew){var val=$(elemnew).attr("value");if($(elemnew).is(":checked"))if($(elemnew).attr("allowothers"))0!=(val=$.trim($(elem).find("input[name=allow-others-text]").val())).length&&checkboxJsonArr.push(val);else if(fromReview){var labelText=$(elemnew).parent().find("label").find("em").clone().children("i").remove().end().text();checkboxJsonArr.push(labelText)}else checkboxJsonArr.push(val)}),checkboxJsonArr.length>0?valueJson[$(elem).attr("compname")]=checkboxJsonArr:valueJson[$(elem).attr("compname")]=""}function constructRadio(valueJson,elem,fromReview){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():fromReview?$(elemnew).parent().find("label").find("em").clone().children("i").remove().end().text():$(elemnew).attr("value"))}),valueJson[$(elem).attr("compname")]=value}function constructMatrixChoice(valueJson,elem,fromReview){var matrixRowJson={},matrixRowArr=[],choiceType=$(elem).attr("choicetype");if(isValidMatrixChoiceType(choiceType)){var matrixDiv=isNewHtmlDOM()?$(elem).find("div[elname='matrixTableWrap']"):elem;$(matrixDiv).find("tbody").find("tr").each(function(index1,elem1){var rowLinkName,matrxcolumnArr=[];if(choiceType==MatrixChoicesType.RADIO.CODE||choiceType==MatrixChoicesType.CHECKBOX.CODE?$(elem1).find("input:checked").each(function(index2,elem2){0==index2&&(rowLinkName=$(elem2).attr("name")),fromReview?matrxcolumnArr.push($(elem2).attr("columndisplay")):matrxcolumnArr.push($(elem2).attr("columnvalue"))}):choiceType==MatrixChoicesType.DROPDOWN.CODE?($(elem1).find("select").each(function(index2,elem2){0==index2&&(rowLinkName=$(elem2).attr("name"));var value=$.trim($(elem2).val());if(""!=value){var columnJson={};fromReview?(columnJson.columnname=$(elem2).attr("columndisplay"),columnJson.value=$(elem2).find("option:selected").text()):(columnJson.columnname=$(elem2).attr("columnvalue"),columnJson.value=value),matrxcolumnArr.push(columnJson)}}),fromReview||(rowLinkName+="-v1")):choiceType!=MatrixChoicesType.TEXTBOX.CODE&&choiceType!=MatrixChoicesType.NUMBER.CODE&&choiceType!=MatrixChoicesType.CURRENCY.CODE||($(elem1).find("input").each(function(index2,elem2){0==index2&&(rowLinkName=$(elem2).attr("name"));var value=$.trim($(elem2).val());if(""!=value){var columnJson={};if(fromReview){var columnName=$(elem2).attr("columndisplay");choiceType!=MatrixChoicesType.NUMBER.CODE&&choiceType!=MatrixChoicesType.CURRENCY.CODE||$(elem2).attr("column_unit")!=undefined&&""!=$(elem2).attr("column_unit")&&(columnName+=" ("+$(elem2).attr("column_unit")+") "),columnJson.columnname=columnName}else columnJson.columnname=$(elem2).attr("columnvalue");var inputType=$(elem2).attr("inputType");if(inputType==ZFFieldTypeConstants.CURRENCY||inputType==ZFFieldTypeConstants.DECIMAL){var decimalFormat=$(elem2).parent().attr("decimalformat");fromReview||(value=ZFUtil.getReformattedDecimal(value,decimalFormat))}columnJson.value=value,matrxcolumnArr.push(columnJson)}}),fromReview||(rowLinkName+="-v1")),matrxcolumnArr.length>0&&(matrixRowJson[rowLinkName]=matrxcolumnArr),fromReview){var rowJson={};rowJson.row_link_name=rowLinkName,rowJson.qstn_name=$(elem1).find("th").text(),matrixRowArr.push(rowJson)}})}fromReview&&(valueJson.choice_type=choiceType,valueJson.rows=matrixRowArr),valueJson[$(elem).attr("compname")]=matrixRowJson}function constructMultiSelect(valueJson,elem,fromReview){var multiJsonArr=[];$(elem).find("select").each(function(indexelem,elemnew){var id=$(elemnew).attr("id");if(id!=undefined){for(var txtSelectedObj=document.getElementById(id),i=0;i0?valueJson[$(elem).attr("compname")]=multiJsonArr:valueJson[$(elem).attr("compname")]=""}})}function constructDecision(valueJson,elem,fromReview){$(elem).find("input").each(function(indexelem,elemnew){var val=$(elemnew).is(":checked");fromReview?val&&$(elem).find("span[elname=True]").text().length>0?val=$(elem).find("span[elname=True]").text():!val&&$(elem).find("span[elname=False]").text().length>0&&(val=$(elem).find("span[elname=False]").text()):val=val?"true":"false";var namenew=$(elemnew).attr("name");valueJson[namenew]=val})}function constructTCField(valueJson,elem,fromReview){var cbElem=$(elem).find("input[elname=statusCB]"),tcValue=$(cbElem).is(":checked")?"true":"false",namenew=$(cbElem).attr("name");if(fromReview)if("true"==tcValue){var statustext=$(elem).attr("statustext");valueJson[namenew]=statustext}else valueJson[namenew]="";else valueJson[namenew]=tcValue}function constructFileUpload(valueJson,elem){var filepatharr=[],namenew=$(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+/,""))?valueJson[namenew+"-v1"]="":""!=$(fileElement).attr("filepath")&&(filepatharr.push($(fileElement).attr("filepath")),valueJson[namenew+"-v1"]=filepatharr)}else $(elem).find("div[name=fileElementDiv]").each(function(indexelem,elemnew){""!=$(elemnew).attr("filepath")&&filepatharr.push($(elemnew).attr("filepath"))}),valueJson[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?($(elem).closest("div[elname=livefield-elem]").find("input[type=radio]").attr("isSelected",!1),$(elem).closest("span[elname=allow-others-span]").find("input[elname=radio-input]").attr("isSelected",!0),$(elem).closest("span[elname=allow-others-span]").find("input[elname=radio-input]").prop("checked",!0)):($(elem).closest("span[elname=allow-others-span]").find("input[elname=radio-input]").attr("isSelected",!1),$(elem).closest("span[elname=allow-others-span]").find("input[elname=radio-input]").prop("checked",!1))}function checkCheckBoxOthers(elem){$(elem).val().length>0?$(elem).parent().find("input[elname=checkbox-input]").prop("checked",!0):$(elem).parent().find("input[elname=checkbox-input]").prop("checked",!1)}function constructSignatureEdit(valueJson,elem,fromReview){var linkName=$(elem).attr("compname");if("none"==$("#signContainer-"+linkName).css("display")){var idVal="editsignContainer-"+linkName,imgId="img-"+linkName,srcElem=$(elem).find("div[id="+idVal+"]").find("img[id="+imgId+"]");valueJson[linkName]=fromReview?$(srcElem).attr("src"):$(srcElem).attr("value")}else constructSignature(valueJson,elem)}function constructPaymentFieldForUpdate(valueJson,elem){$(elem).find("select").each(function(indexelem,elemnew){var namenew=$(elemnew).attr("name");valueJson[namenew]=$(elemnew).val()})}function constructPaymentField(valueJson,elem){var merchantType=$(elem).find("div[elname=merchantDiv]").attr("merchantType");if(null!=merchantType&&""!=merchantType){var paymentElem=$(elem).find("div[elname=paymentDetailsDiv]");$(paymentElem).find("input").each(function(indexelem,elemnew){var namenew=$(elemnew).attr("name");if(namenew==SystemGeneratedField.PAYMENT_AMOUNT.LINK_NAME){var payValue=$.trim($(elemnew).val());valueJson[namenew]=payValue}}),valueJson.merchant_type=merchantType}}function authNetResponseHandler(response){var paymentLi=$("#PaymentAmount-li"),paymentErrDiv=isNewHtmlDOM()?$(paymentLi).find("div[name=errDiv]"):$(paymentLi).find("span[elname=authNetPaymentError]");if($("#paymentProcessingDiv").hide(),"Error"===response.messages.resultCode){for(var authNetErrMsg="",i=0;i')),$(formBodyUL).last().append($('
'))):($(formBodyUL).last().append($('
  • ')),$(formBodyUL).last().append($('
  • ')))),$(formBodyUL).find("input[elname=authNetDataValue]").val(opaqueData.dataValue),$(formBodyUL).find("input[elname=authNetDataDescriptor]").val(opaqueData.dataDescriptor)}function clearAuthNetCardData(){var authNetMerchantDiv=$("#PaymentAmount-li").find("div[elname=authNetMerchantDiv]");$(authNetMerchantDiv).find("input[elname=authNetAccNo]").val("");var expMonthFirstOption=$(authNetMerchantDiv).find("select[elname=authNetExpMonth]").find("option:first").val(),expYearFirstOption=$(authNetMerchantDiv).find("select[elname=authNetExpYear]").find("option:first").val();$(authNetMerchantDiv).find("select[elname=authNetExpMonth]").val(expMonthFirstOption).trigger("change.select2"),$(authNetMerchantDiv).find("select[elname=authNetExpYear]").val(expYearFirstOption).trigger("change.select2"),$(authNetMerchantDiv).find("input[elname=authNetCardCode]").val("")}function handlePaypalCkoutAction(respJson){if($("#paypalCkoutActionDiv").show(),isStandardForm()&&isEmbeddedForm()){var popupHeight=$("#paypalCkoutActionDivCont").outerHeight(!0);setPopupPositionNearRefElem($("#paypalCkoutActionDivCont"),$("div[elname=footer]:visible"),-1*popupHeight,!0,!0)}else setPopUpElemPosition($("#paypalCkoutActionDivCont"));var paypalCkIntentJson={};paypal.Buttons({style:{shape:"rect",color:"gold",layout:"vertical"},createOrder:function(data,actions){return respJson[ZFFormPayments.KEY.PAYMNT_ID_JSON][ZFFormPayments.PAYPAL_CKOUT.ORDERID]},onApprove:function(data,actions){return actions.order.capture().then(function(details){paypalCkIntentJson[ZFFormPayments.KEY.PAYMNT_STATUS_FLG]=1,paypalCkoutStatusUpdate(details.id,paypalCkIntentJson,respJson)})},onError:function(err){paypalCkIntentJson[ZFLiveConstants.RESPONSE.ERROR]=err.message,paypalCkIntentJson[ZFFormPayments.KEY.PAYMNT_STATUS_FLG]=2,paypalCkoutStatusUpdate(null,paypalCkIntentJson,respJson)},onCancel:function(data){paypalCkIntentJson[ZFFormPayments.KEY.PAYMNT_STATUS_FLG]=3,paypalCkoutStatusUpdate(data.orderID,paypalCkIntentJson,respJson)}}).render("#paypalck-button-container")}function paypalCkoutStatusUpdate(orderID,paypalCkIntentJson,respJson){isNewHtmlDOM()&&$("#submitFreezeDiv").show();var sameFormUrl="";typeof respJson.same_form_url!==ResponseKey.UNDEFINED&&(sameFormUrl=respJson.same_form_url);var redirectURL=respJson.thankyou_page_URL,openRedirectURLIn=respJson.open_thankyou_page_URL_in,redirType=respJson.redirect_type,reqUri="/paypalckhdlr?custom="+respJson[ZFFormPayments.KEY.PAYMNT_ID_JSON][ZFFormPayments.KEY.REF_ID];null!=orderID&&(paypalCkIntentJson[ZFFormPayments.PAYPAL_CKOUT.ORDERID]=orderID);var ajaxOpts={URI:reqUri,METHOD:"POST",DATATYPE:"json",CONTENTTYPE:"application/json",ACCEPT:"application/json",DATA:JSON.stringify(paypalCkIntentJson),CALLBACK:function(jsonData,ajaxOpts,jqXhr){var paypalActDiv=$("#paypalCkoutActionDiv");paypalActDiv.hide(),paypalActDiv.find("#paypalck-button-container").html("");var paypalIntentResp=JSON.parse(jqXhr.responseText);if(200==jqXhr.status){if(6==paypalIntentResp.pmntstatusflag)performDefaultRedirection(redirectURL,openRedirectURLIn,sameFormUrl,ZFormType.FORMS,redirType);else if(4==paypalIntentResp.pmntstatusflag||5==paypalIntentResp.pmntstatusflag){isNewHtmlDOM()&&$("#submitFreezeDiv").hide();for(var errMsg="",errArr=paypalIntentResp[ZFLiveConstants.RESPONSE.ERRORS],i=0;i')):$(formBodyUL).last().append($('
  • '))),$("#stripeToken-li").find("input[elname=stripeToken]").val(result.paymentMethod.id),ZFLive.stripeCard.clear(),ZFLive.ValidateAndSubmitData()}function checkNotTransparentAndConvertColorCodeToHex(color,prop){return"transparent"!=color?"focusColor"==prop&&"rgb"==color.substring(0,3)?checkNotTransparentAndConvertColorCodeToHex($(".pageWrapper").css("--input-bdr-clr")):"inputBgColor"==prop?"rgba("+color+", "+parseFloat($(".pageWrapper").css("--input-bg-opacity"))+")":convertColorCodeToHex(color):color}function computeOpacityColorVal(hexColor){if(typeof hexColor!=ResponseKey.UNDEFINED&&hexColor.startsWith("#")&&7==hexColor.length){var R1=parseInt(hexColor.substr(1,2),16),gt=.5*parseInt(hexColor.substr(3,2),16)+127.5,bt=.5*parseInt(hexColor.substr(5,2),16)+127.5;return"#"+convertDecToHex(.5*R1+127.5)+convertDecToHex(gt)+convertDecToHex(bt)}}function squareTokenizeOrVerifyBuyerFail(paymentLi,error){ZFLive.enableSubmitBtn(),$(paymentLi).find("div[elname=squareMerchantDiv]").addClass("error1");var squareErrElem=isNewHtmlDOM()?$(paymentLi).find("div[name=errDiv]"):$(paymentLi).find("span[elname=squarePaymentError]");($(squareErrElem).text(error),animateErrorMsg(squareErrElem),isOneFieldForm())?(jumpToSpecificSlideWithParentFieldElem(paymentLi),showQvError(paymentLi)):showAndHidePage(isStandardForm()?$(paymentLi).closest("div[elname=formBodyULName]").attr("page_no"):paymentLi.parent().attr("page_no"));triggerFormResizeOnTimeOut(),resetCaptcha(),resetReCaptcha(),$(paymentLi).find("span[elname=squareMerchantDivFocusSpan]").focus(),cancelSubmitOrUpdateFormAction()}function squareVerfDetailsFill(){var needdata,verfDetailsJson={},billingContact={},isOneFieldform=isOneFieldForm(),formBodyUL=isOneFieldForm()?$(ZFSlideNav.slideContainer):isStandardForm()?$("#formBodyDiv").find("div[elname=formBodyULName]"):$("#formBodyDiv").find("ul[elname=formBodyULName]"),billAddrFldLinkName=ZFLive.square.integDetailsJson.billing_addr,billAddrFieldElem=$(formBodyUL).find("[id="+billAddrFldLinkName+"-li]");if(needdata=checkAndReturnNeedDataAttr(billAddrFieldElem),isOneFieldform)"true"==needdata&&(billingContact=constructAddressForSquareInteg(billAddrFieldElem));else{var needPageData=isStandardForm()?$(billAddrFieldElem).closest("div[elname=formBodyULName]").attr("needpagedata"):$(billAddrFieldElem).parent("ul").attr("needpagedata");"true"==needdata&&"true"==needPageData&&(billingContact=constructAddressForSquareInteg(billAddrFieldElem))}if(typeof billingContact.country!=ResponseKey.UNDEFINED){if(typeof ZFLive.square.integDetailsJson.buyer_email!=ResponseKey.UNDEFINED){var buyerEmailVal=constructEmailOrNameForSquareInteg(isOneFieldform,formBodyUL,ZFLive.square.integDetailsJson.buyer_email);typeof buyerEmailVal!=ResponseKey.UNDEFINED&&""!=buyerEmailVal&&(billingContact.email=buyerEmailVal)}if(typeof ZFLive.square.integDetailsJson.bill_fname_comp!=ResponseKey.UNDEFINED){var billFNameCompLinkName=ZFLive.square.integDetailsJson.bill_fname_comp,billFNameCompVal=constructEmailOrNameForSquareInteg(isOneFieldform,formBodyUL,billFNameCompLinkName.split("_")[0],billFNameCompLinkName);typeof billFNameCompVal!=ResponseKey.UNDEFINED&&""!=billFNameCompVal&&(billingContact.givenName=billFNameCompVal)}if(typeof ZFLive.square.integDetailsJson.bill_lname_comp!=ResponseKey.UNDEFINED){var billLNameCompLinkName=ZFLive.square.integDetailsJson.bill_lname_comp,billLNameCompVal=constructEmailOrNameForSquareInteg(isOneFieldform,formBodyUL,billLNameCompLinkName.split("_")[0],billLNameCompLinkName);typeof billLNameCompVal!=ResponseKey.UNDEFINED&&""!=billLNameCompVal&&(billingContact.familyName=billLNameCompVal)}verfDetailsJson.billingContact=billingContact}return verfDetailsJson}function constructEmailOrNameForSquareInteg(isOneFieldform,formBodyUL,linkName,complink){var fieldElemVal,fieldElem=$(formBodyUL).find("[id="+linkName+"-li]"),needdata=checkAndReturnNeedDataAttr(fieldElem);if(isOneFieldform)"true"==needdata&&(fieldElemVal=typeof complink!=ResponseKey.UNDEFINED?$.trim($(fieldElem).find("input[complink="+complink+"]").val()):$.trim($(fieldElem).find("input").val()));else{var needPageData=isStandardForm()?$(fieldElem).closest("div[elname=formBodyULName]").attr("needpagedata"):$(fieldElem).parent("ul").attr("needpagedata");"true"==needdata&&"true"==needPageData&&(fieldElemVal=typeof complink!=ResponseKey.UNDEFINED?$.trim($(fieldElem).find("input[complink="+complink+"]").val()):$.trim($(fieldElem).find("input").val()))}return fieldElemVal}function constructAddressForSquareInteg(elem){var isCountryFldValExists=!1,addressJson={};if($(elem).find("select").each(function(indexelem,elemnew){if(-1!=$(elemnew).attr("complink").indexOf(ZFFormField.ADDRESS.COUNTRY.KEY)){var countryCodeVal=$(elemnew).find("option:selected").attr("ctrycode");typeof countryCodeVal!=ResponseKey.UNDEFINED&&typeof ZFISOCountryCode[countryCodeVal]!=ResponseKey.UNDEFINED&&(addressJson.country=ZFISOCountryCode[countryCodeVal],isCountryFldValExists=!0)}}),isCountryFldValExists){var addressLinesArray=["",""],isAddressLinesArrayEmpty=!0;$(elem).find("input,select").each(function(indexelem,elemnew){var complink=$(elemnew).attr("complink"),val=$.trim($(elemnew).val());$(elemnew).attr("id")?"-Select-"!=val&&-1!=complink.indexOf(ZFFormField.ADDRESS.STATE.KEY)&&(addressJson.region=val):""!=val&&(-1!=complink.indexOf(ZFFormField.ADDRESS.CITY.KEY)?addressJson.city=val:-1!=complink.indexOf(ZFFormField.ADDRESS.STATE.KEY)?addressJson.region=val:-1!=complink.indexOf(ZFFormField.ADDRESS.ADDRESS_LINE1.KEY)?(addressLinesArray[0]=val,isAddressLinesArrayEmpty=!1):-1!=complink.indexOf(ZFFormField.ADDRESS.ADDRESS_LINE2.KEY)&&(addressLinesArray[1]=val,isAddressLinesArrayEmpty=!1))}),isAddressLinesArrayEmpty||(addressJson.addressLines=addressLinesArray)}return addressJson}function showGeoLocationLoadingDiv(){if(ZFLive.geolationMandatory)showGeolocationFetchingDiv();else if(ZFLive.needToShowInitialLoadingForGeoLocation){var geoLoadingDiv=$("#geolocationLoadingDiv");$(geoLoadingDiv).length>0&&$(geoLoadingDiv).show()}else ZFLive.performFocusSettingOnInitialLoading()}function hideGeoLocationLoadingDiv(){if(ZFLive.geolationMandatory){$(document).find('[ename="mainwrapperDiv"]').css("visibility",""),$(document).find('[elname="geolocationErrDiv"]').remove(),$(document.body).removeClass("hideWindowScroll geoLocationPopup"),isOneFieldForm()?$(document.body).removeClass("ofliveErrMsgWrapper"):isStandardForm()&&$(document.body).removeClass("thankyouPageWrap ofliveErrMsgWrapper"),setTimeout(function(){window.scroll({top:0})},0),ZFLive.performFocusSettingOnInitialLoading();var timeoutTime=isOneFieldForm()?510:0;setTimeout(function(){triggerFormResize()},timeoutTime)}else if(ZFLive.needToShowInitialLoadingForGeoLocation){var geoLoadingDiv=$("#geolocationLoadingDiv");$(geoLoadingDiv).length>0&&($(geoLoadingDiv).hide(),ZFLive.performFocusSettingOnInitialLoading())}}function showGeolocationFetchingDiv(){setTimeout(function(){window.scroll({top:0})},0);var geoLocationErrDiv=$(document).find('[elname="geolocationErrDiv"]');$(document.body).addClass("hideWindowScroll geoLocationPopup"),isOneFieldForm()?$(document.body).addClass("ofliveErrMsgWrapper"):isStandardForm()&&$(document.body).addClass("thankyouPageWrap ofliveErrMsgWrapper"),$(geoLocationErrDiv).show(),$(geoLocationErrDiv).find('[elname="fetchingMsg"]').show(),$(geoLocationErrDiv).find('[elname="geoErrMsg"]').hide()}function showGeolocationErr(errorMsg){var geoLocationErrDiv=$(document).find('[elname="geolocationErrDiv"]');$(geoLocationErrDiv).find('[elname="fetchingMsg"]').hide();var geoErrMsgSpan=$(geoLocationErrDiv).find('[elname="geoErrMsg"]');$(geoErrMsgSpan).text(errorMsg).show(),isAccessibilitySupported()&&!ZFLive.isEmbedded&&($(geoErrMsgSpan).attr("tabindex","-1"),setTimeout(function(){$(geoErrMsgSpan).focus()},0)),ZFLive.isEmbedded&&embedFormErrorPageResize()}function showErrorPage(errorMsg){setTimeout(function(){window.scroll({top:0})},0);var liveErrPageDiv=$(document).find('[elname="liveErrPageDiv"]');liveErrPageDiv.show(),$(document).find('[ename="mainwrapperDiv"]').css("visibility","hidden"),$(document.body).addClass("hideWindowScroll geoLocationPopup"),isOneFieldForm()?$(document.body).addClass("ofliveErrMsgWrapper"):isStandardForm()&&$(document.body).addClass("thankyouPageWrap ofliveErrMsgWrapper");var errMsgSpan=$(liveErrPageDiv).find('[elname="errMsg"]');$(errMsgSpan).text(errorMsg).show(),isAccessibilitySupported()&&!ZFLive.isEmbedded&&($(errMsgSpan).attr("tabindex","-1"),setTimeout(function(){$(errMsgSpan).focus()},0)),ZFLive.isEmbedded&&embedFormErrorPageResize()}function embedFormErrorPageResize(){if(document.getElementById("resizeform")&&1==document.getElementById("resizeform").value){var formPerma=document.getElementById("formPerma").value;$(document).find('[ename="mainwrapperDiv"]').remove();var timeoutTime=isOneFieldForm()?510:0;setTimeout(function(){triggerFormResizeToFixedHeight(formPerma,500)},timeoutTime)}}function fetchUserLocationSuccess(position){ZFLive.isFreePlan||"undefined"==typeof ZFLive.geoFencyJson||checkCurrentLocationisInsideGeofency(position)?(hideGeoLocationLoadingDiv(),ZFLive.fetchedLatitude=parseFloat(position.coords.latitude).toFixed(7),ZFLive.fetchedLongitude=parseFloat(position.coords.longitude).toFixed(7)):showGeolocationErr(ZFLive.geoFencyJson.fence_msg)}function fetchUserLocationErrorFunction(errroObj){ZFLive.geolationMandatory?showGeolocationErr(ZFLive.geolocationMandatoryMsg):hideGeoLocationLoadingDiv()}function checkCurrentLocationisInsideGeofency(position){var currentLat=parseFloat(position.coords.latitude).toFixed(7),currentLong=parseFloat(position.coords.longitude).toFixed(7),geoFencyJson=ZFLive.geoFencyJson;return ZMapsGeoUtils.getDistanceBetweenCoordinatesInMeters(currentLat,currentLong,geoFencyJson.lat,geoFencyJson.lon)<=Math.round(geoFencyJson.rad*("K"==geoFencyJson.unit?1e3:1609.34))}function detatchSquarePaymentCard(paymentForm){if("true"===paymentForm){var paymentLi=$("#PaymentAmount-li");$(paymentLi).find("div[elname=merchantDiv]").attr("merchantType")==ZFFormPayments.MERCHANT_TYPE.SQUARE&&typeof ZFLive.square.card!=ResponseKey.UNDEFINED&&ZFLive.square.card.detach()}}function clearSquarePaymentDataInCard(paymentForm){if("true"===paymentForm){var paymentLi=$("#PaymentAmount-li");$(paymentLi).find("div[elname=merchantDiv]").attr("merchantType")==ZFFormPayments.MERCHANT_TYPE.SQUARE&&typeof ZFLive.square.card!=ResponseKey.UNDEFINED&&ZFLive.square.card.clear()}}function getSalesiqPhoneVal(elem){var salesIQPhone="";return $(elem).find("div[elname=phoneFld]").find("input").each(function(indexelem,elemnew){var val=$.trim($(elemnew).val()),isCountryCodeEnabled=$(elemnew).attr("iscodeenabled");if(isCountryCodeEnabled!=undefined&&"true"==isCountryCodeEnabled&&""!=val&&null!=val){var countryCode=$(elemnew).intlTelInput("getSelectedCountryData").dialCode;countryCode!=undefined&&(salesIQPhone="+"+countryCode)}salesIQPhone+=val}),salesIQPhone}function constructFormFieldDataJsonForSubmit(valueJson,elem){var comptype=parseInt($(elem).attr("comptype")),compname=$(elem).attr("compname");"subFormField"===$(elem).attr("elemtype")?(ZFSubFormLive.zfSubFormLive=new ZFSubFormLive,ZFSubFormLive.zfSubFormLive.constructSubFormDataJson(valueJson,elem)):comptype===ZFFieldTypeConstants.ZOHO_CRM?ZFLive.mode===Mode.LIVE?ZFCrmLive.zfCrmLive.constructZohoCrmFldDataJson(valueJson,elem,!1):ZFLive.mode===Mode.SAVED_RECORD&&ZFCrmLive.zfCrmLive.constructZohoCrmFldDataJson(valueJson,elem,!0):compname==ZFFormPayments.STRIPE.TOKEN||compname==ZFFormPayments.AUTH_NET.DATA_VAL||compname==ZFFormPayments.AUTH_NET.DATA_DESC||compname==ZFFormPayments.SQUARE.TOKEN||compname==ZFFormPayments.SQUARE.VERFTOKEN?constructNormalField(valueJson,elem):compname==SystemGeneratedField.PAYMENT_AMOUNT.LINK_NAME?constructPaymentField(valueJson,elem):constructFormFieldDataJsonCommon(valueJson,elem,!1)}function constructFormFieldDataJsonForSave(valueJson,elem){var comptype=parseInt($(elem).attr("comptype"));$(elem).attr("compname");"subFormField"===$(elem).attr("elemtype")?(ZFSubFormLive.zfSubFormLive=new ZFSubFormLive,ZFSubFormLive.zfSubFormLive.constructSubFormDataJson(valueJson,elem)):comptype===ZFFieldTypeConstants.ZOHO_CRM?ZFCrmLive.zfCrmLive.constructZohoCrmFldDataJson(valueJson,elem,!0):constructFormFieldDataJsonCommon(valueJson,elem,!1)}function constructFormFieldDataJsonCommon(valueJson,elem,fromReview){var comptype=parseInt($(elem).attr("comptype")),compname=$(elem).attr("compname");comptype==ZFFieldTypeConstants.SINGLE_LINE||comptype==ZFFieldTypeConstants.NUMBER||comptype==ZFFieldTypeConstants.WEBSITE?constructNormalField(valueJson,elem):comptype==ZFFieldTypeConstants.MULTI_LINE?constructTextArea(valueJson,elem):comptype==ZFFieldTypeConstants.DATE?constructDate(valueJson,elem):comptype==ZFFieldTypeConstants.MONTHYEAR?constructMonthYear(valueJson,elem):comptype===ZFFieldTypeConstants.DATETIME?constructDateTime(valueJson,elem):comptype==ZFFieldTypeConstants.TIME?constructTime(valueJson,elem):comptype==ZFFieldTypeConstants.NAME?constructName(valueJson,elem,fromReview):comptype==ZFFieldTypeConstants.ADDRESS?constructAddress(valueJson,elem,fromReview):comptype==ZFFieldTypeConstants.EMAIL?constructEmailField(valueJson,elem):comptype==ZFFieldTypeConstants.PHONE?constructPhone(valueJson,elem):comptype==ZFFieldTypeConstants.DROPDOWN?constructDropdown(valueJson,elem,compname,fromReview):comptype==ZFFieldTypeConstants.RADIO?constructRadio(valueJson,elem,fromReview):comptype==ZFFieldTypeConstants.CHECKBOX?constructCheckBox(valueJson,elem,fromReview):comptype==ZFFieldTypeConstants.MULTIPLE_CHOICE?constructMultiSelect(valueJson,elem,fromReview):comptype==ZFFieldTypeConstants.DECISION_BOX?(fromReview&&(valueJson.display_name=$.trim($(elem).find('span[elname="display_name"]').contents().filter(function(){return!("EM"===this.nodeName.toUpperCase()&&$(this).hasClass("important"))}).text())),constructDecision(valueJson,elem,fromReview)):comptype==ZFFieldTypeConstants.TERMS_CONDITIONS?constructTCField(valueJson,elem,fromReview):comptype==ZFFieldTypeConstants.FILE_UPLOAD||comptype==ZFFieldTypeConstants.IMAGE_UPLOAD||comptype==ZFFieldTypeConstants.MEDIA_UPLOAD?fromReview?constructFileImageValForReview(valueJson,elem):ZFLive.isOldUploadType?constructFileUpload(valueJson,elem):constructFileUpload_New(valueJson,elem):comptype==ZFFieldTypeConstants.RATING?constructRating(valueJson,elem):comptype==ZFFieldTypeConstants.SLIDER?constructSlider(valueJson,elem):compname===ZFLiveConstants.VERIFICATIONCODE.KEY?constructVerCodeField(valueJson,elem):compname!==ZFLiveConstants.RECAPTCHA.CHECKBOX||getMSIEversion()<8?compname!==ZFLiveConstants.RECAPTCHA.INVISIBLE||getMSIEversion()<8?comptype==ZFFieldTypeConstants.SIGNATURE?constructSignatureEdit(valueJson,elem,fromReview):comptype==ZFFieldTypeConstants.GEOLOCATION?constructGeolocation(valueJson,elem):comptype==ZFFieldTypeConstants.IMAGE_CHOICE?constructImageChoiceField(valueJson,elem,fromReview):comptype==ZFFieldTypeConstants.MATRIX_CHOICE?constructMatrixChoice(valueJson,elem,fromReview):comptype!=ZFFieldTypeConstants.DECIMAL&&comptype!=ZFFieldTypeConstants.CURRENCY||constructDecimalField(valueJson,elem,fromReview):ZFLive.valueJson["grecaptcha-inv"]=grecaptcha.getResponse():$("#pop_recaptchacbox-li").is(":visible")?ZFLive.valueJson["grecaptcha-cbox"]=grecaptcha.getResponse(ZFLive.popupReCaptcha):ZFLive.valueJson["grecaptcha-cbox"]=grecaptcha.getResponse()}function displaySplashMsg(){$("#splash_message_div").show();var marginTop=isNewHtmlDOM()?150:50;if(isStandardForm()&&isEmbeddedForm()){var refElem=$("button[elname=submit]").length>0?$("button[elname=submit]"):$("button[elname=update]").length>0?$("button[elname=update]"):$("div[elname=footer]:visible");if($(refElem).length>0){$(refElem)[0].scrollIntoView({behaviour:"instant",block:"center",inline:"center"});var refElemTop=$(refElem).offset().top;marginTop=Math.max(20,refElemTop-window.visualViewport.pageTop)}}$("#splash_message_div_cont").animate({opacity:"1",marginTop:marginTop},600),$("#splash_message_div_cont").slideDown(500).delay(2e3).animate({opacity:"0.5",marginTop:-marginTop},600).slideUp(500)}function setSplashMsg(finalHeight){$("#splash_message_div_cont").css("margin-top",finalHeight),$("#splash_message_div").fadeIn().delay(1e3).fadeOut()}function setFileClear(){var filePreviewDiv=$("#formDiv").find("[elname=livefield-elem][comptype=19],[elname=livefield-elem][comptype=32],[elname=livefield-elem][comptype=35]");$(filePreviewDiv).each(function(idx,elem){var linkname=$(elem).attr("compname"),fileElementDiv=$("#formDiv").find("[compname="+linkname+"]").find('div[name="fileElementDiv"]');for(index=0;index0){var emElem=$(updateBtn[0]).find("em[elem=loadingImgElem]");$(emElem).show()}}else{var savingElem=$("#updateBtn").find("em[elem=loadingImgElem]");$(savingElem).show()}}function hideSavingElem(){if(isOneFieldForm()){var updateBtn=$("#slideContainer,#navFooter:visible").find("button[elname=update]:visible");if(updateBtn.length>0){var emElem=$(updateBtn[0]).find("em[elem=loadingImgElem]");$(emElem).delay(500).hide(500)}}else{var savingElem=$("#updateBtn").find("em[elem=loadingImgElem]");$(savingElem).delay(500).hide(500)}}function setPopUpElemPosition(elem){elem.css("position","absolute"),elem.css("top",Math.max(0,($(window).height()-elem.outerHeight())/3)+"px"),isStandardForm()||elem.css("left",Math.max(0,($(window).width()-elem.outerWidth())/2)+"px")}function setPopUpElemPositionNew(elem,refElem){if(elem.css("position","absolute"),window.top.location!==window.self.location&&$(window).height()>800){var newTopForElem=$(refElem).offset().top-$(window).scrollTop();newTopForElem+elem.height()>$(window).height()&&(newTopForElem=$(window).height()-elem.height()-20),elem.css("top",Math.max(0,newTopForElem)+"px")}else elem.css("top",Math.max(0,($(window).height()-elem.outerHeight())/3)+"px");isStandardForm()||elem.css("left",Math.max(0,($(window).width()-elem.outerWidth())/2)+"px")}function setElemPositionForReview(elem){elem.css("position","absolute"),elem.css("top",Math.max(0,($(window).height()-elem.outerHeight())/16)+"px"),isStandardForm()||elem.css("left",Math.max(0,($(window).width()-elem.outerWidth())/2)+"px")}function checkMandatoryTime(idd){var id=$(idd).attr("id"),toReturn=!0;return $("#"+id).find("input,select").each(function(indexelem,elemnew){""!=$(elemnew).val()||(toReturn=!1)}),toReturn}function checkMandatoryReCaptcha(){return grecaptcha&&0!==grecaptcha.getResponse().length}function validateTime(idd){var id=$(idd).attr("id"),containsVal=!1;$("#"+id).find("input,select").each(function(indexelem,elemnew){"Meridiem"!=$(elemnew).attr("timecomp")&&""!=$(elemnew).val()&&(containsVal=!0)});var isValidTime=!0;return $("#"+id).find("input,select").each(function(indexelem,elemnew){1!=containsVal||""!=$(elemnew).val()||(isValidTime=!1)}),isValidTime}function checkMandatory(elem,compType){if(23==compType){var inputElem=$(elem).find("div[name=slider]").get(0);if(""==$.trim($(inputElem).attr("value")))return!1}else{inputElem=$(elem).find("input").get(0);if(""==$.trim($(inputElem).val()))return!1}return!0}function checkMandatoryForCompositeElem(elem,compType,showErrorBorder){var toReturn=!0;return $(elem).find("input").each(function(index,inpElem){"true"==$(inpElem).attr("mandatory")&&(""==$.trim($(inpElem).val())?(toReturn=!1,showErrorBorder&&$(inpElem).parent().addClass("error1"),addErrorForAccessibility($(inpElem).attr("name"),!0,$(inpElem))):addErrorForAccessibility($(inpElem).attr("name"),!1,$(inpElem)))}),compType!=ZFFieldTypeConstants.ADDRESS&&compType!=ZFFieldTypeConstants.NAME||$(elem).find("select").each(function(myIndex,selElem){"true"==$(selElem).attr("mandatory")&&("-Select-"===$.trim($(selElem).val())?(toReturn=!1,showErrorBorder&&(isNewHtmlDOM()?$(selElem).parent().addClass("error1"):$(selElem).parent().parent().addClass("error1")),addErrorForAccessibility($(selElem).attr("name"),!0,$(selElem))):addErrorForAccessibility($(selElem).attr("name"),!1,$(selElem)))}),!!toReturn}function doesAnyCompositeFieldHasValue(elem,compType){var toReturn=!1;return $(elem).find("input").each(function(index,inpElem){if(""!=$.trim($(inpElem).val()))return toReturn=!0,!1}),$(elem).find("select").each(function(myIndex,selElem){if("-Select-"!==$.trim($(selElem).val()))return toReturn=!0,!1}),!!toReturn}function doesAnyCompInTimeHasVal(elem){var toReturn=!1;return $(elem).find("input,select").each(function(indexelem,elemnew){if(""!=$(elemnew).val())return toReturn=!0,!1}),toReturn}function checkMandatoryTextArea(elem){var inputElem=$(elem).find("textarea").get(0);return""!=$.trim($(inputElem).val())}function checkMandatoryDropDown(elem,fldLinkName){var inputElem=$(elem).find("select[name='"+fldLinkName+"']").get(0),value=$(inputElem).val();return"-Select-"!=value&&("zfs-others-zfs"!=value||0!=$(elem).find("input[name=allow-others-text]").val().trim().length)}function checkMandatorySignature(elem){var compname=$(elem).attr("compname"),signElem=document.getElementById("drawingCanvas-"+compname),flag=!1,editSignCont=$("#editsignContainer-"+compname);return $(editSignCont).length&&"none"!=$(editSignCont).css("display")?flag=!0:isEmptyCanvasElem(signElem)||(flag=!0),flag}function checkMandatoryRadio(elem){var checkedValues=[];return $(elem).find("input:radio:checked").each(function(index){if("radio-input"==$(this).attr("elname")){var val=$.trim($(this).parent().find("input[name=allow-others-text]").val());""!=val&&checkedValues.push(val)}else checkedValues.push($(this).val())}),0!=checkedValues.length}function checkMandatoryMatrixChoice(elem,highlightMandatoryError){return $(elem).attr("column_mandatory_type")==MatrixMandatoryType.NO_MANDATORY?checkRowMandatoryMatrixChoice(elem,highlightMandatoryError):checkMatrixRowColumnMandatory(elem,highlightMandatoryError)}function checkRowMandatoryMatrixChoice(Elem,highlightMandatoryError){var choiceType=$(Elem).attr("choicetype"),matrixDiv=isNewHtmlDOM()?$(Elem).find("div[elname='matrixTableWrap']"):Elem;if(choiceType==MatrixChoicesType.RADIO.CODE||choiceType==MatrixChoicesType.CHECKBOX.CODE){var flag=!0;return $(matrixDiv).find("tbody").find("tr").each(function(index,elem){"true"==$(elem).find("th").attr("row_mandatory")&&$(elem).find("input:checked").length<=0&&(flag=!1,addErrorForAccessibility($(Elem).attr("compname"),!0,$(elem).find("input")))}),flag}if(choiceType==MatrixChoicesType.DROPDOWN.CODE){flag=!0;return $(matrixDiv).find("tbody").find("tr").each(function(index,elem){var hasRowContainsValue=!1;"true"==$(elem).find("th").attr("row_mandatory")&&($(elem).find("select").each(function(index1,elem1){""==$.trim($(elem1).val())||(hasRowContainsValue=!0)}),hasRowContainsValue||(flag=!1,highlightMandatoryError&&(highlightMatrixSltError($(elem).find("select")),addErrorForAccessibility($(Elem).attr("compname"),!0,$(elem).find("select")))))}),flag}if(choiceType==MatrixChoicesType.TEXTBOX.CODE||choiceType==MatrixChoicesType.NUMBER.CODE||choiceType==MatrixChoicesType.CURRENCY.CODE){flag=!0;return $(matrixDiv).find("tbody").find("tr").each(function(index,elem){if("true"==$(elem).find("th").attr("row_mandatory")){var hasRowEmptyValue=!0;$(elem).find("input").each(function(index1,elem1){""==$.trim($(elem1).val())||(hasRowEmptyValue=!1)}),hasRowEmptyValue&&(flag=!1,highlightMandatoryError&&(highlightMatrixIptError($(elem).find("input")),addErrorForAccessibility($(Elem).attr("compname"),!0,$(elem).find("input"))))}}),flag}return!0}function checkMatrixRowColumnMandatory(elem,highlightMandatoryError){var unfilledQuestions,choiceType=$(elem).attr("choicetype"),compname=$(elem).attr("compname");return choiceType==MatrixChoicesType.CHECKBOX.CODE?unfilledQuestions=$(elem).find("input[elname="+compname+"]").filter(function(index,elem){var isMandatory="true"==$(elem).attr("is_mandatory")&&0==$(elem).is(":checked");return isAccessibilitySupported()&&isMandatory&&addErrorForAccessibility(compname,!0,$(elem)),isMandatory}):choiceType==MatrixChoicesType.DROPDOWN.CODE?(unfilledQuestions=$(elem).find("select[elname="+compname+"]").filter(function(index,elem1){var isMandatory="true"==$(elem1).attr("is_mandatory")&&""==$.trim($(elem1).val());return isAccessibilitySupported()&&isMandatory&&addErrorForAccessibility(compname,!0,$(elem1)),isMandatory}),highlightMandatoryError&&unfilledQuestions!==undefined&&highlightMatrixSltError(unfilledQuestions)):choiceType!=MatrixChoicesType.TEXTBOX.CODE&&choiceType!=MatrixChoicesType.NUMBER.CODE&&choiceType!=MatrixChoicesType.CURRENCY.CODE||(unfilledQuestions=$(elem).find("input[elname="+compname+"]").filter(function(index,elem){var isMandatory="true"==$(elem).attr("is_mandatory")&&""==$.trim($(elem).val());return isAccessibilitySupported()&&isMandatory&&addErrorForAccessibility(compname,!0,$(elem)),isMandatory}),highlightMandatoryError&&unfilledQuestions!==undefined&&highlightMatrixIptError($(unfilledQuestions))),unfilledQuestions!==undefined&&unfilledQuestions.length<=0}function checkMandatoryRating(elem){var checkedValues=[];return $(elem).find("a[elattr=selected]").each(function(index){checkedValues.push($(this).val())}),0!=checkedValues.length}function checkMandatoryCheckBox(elem){var checkedValues=[];return $(elem).find("input:checkbox:checked").each(function(index){if($(this).attr("allowothers")){var val=$.trim($(this).parent().find("input[name=allow-others-text]").val());""!=val&&checkedValues.push(val)}else checkedValues.push($(this).val())}),0!=checkedValues.length}function checkMandatoryMultiSelect(elem){return-1!=$(elem).find("select").get(0).selectedIndex}function checkMandatoryImageChoice(elem){var checkedValues=[],selectElem=$(elem).find("input");if(0!=selectElem.length)$(selectElem).each(function(){$(this).is(":checked")&&checkedValues.push($(this).attr("value"))});else{var divEle=$(elem).find("div[name=selectDiv]");$(divEle).each(function(){"selected"==$(this).attr("selected")&&checkedValues.push($(this).attr("value"))})}return 0!=checkedValues.length}function validateEmail(elem,compname,emailErrArray){var emailValue=$.trim($(elem).find("input[name="+compname+"]").val());if("undefined"!==emailValue&&""!==emailValue){if(!ZFUtil.validateEmailRegex(emailValue))return emailErrArray[0]=ZFLiveErrorConstants.emailerror,!1;if(!ZFLive.isSaveReq){var allowedDomain=$(elem).attr("allowed_domain_name"),restrictedDomain=$(elem).attr("restricted_domain_name"),domainOption=parseInt($(elem).attr("domain_option"));if(domainOption==EmailDomainOptions.ALLOW_SPECIFIC&&!isDomainExists(emailValue,allowedDomain))return allowedDomain=setdomainValues(allowedDomain),emailErrArray[0]=ZFUtil.replaceParams(ZFLiveErrorConstants.alloweddomain,allowedDomain),!1;if(domainOption==EmailDomainOptions.RESTRICT_SPECIFIC&&isDomainExists(emailValue,restrictedDomain))return restrictedDomain=setdomainValues(restrictedDomain),emailErrArray[0]=ZFUtil.replaceParams(ZFLiveErrorConstants.restricteddomain,restrictedDomain),!1}}return!0}function validateNumber(elem){var inputElem=$(elem).find("input").get(0),numValue=$.trim($(inputElem).val());if(null!=numValue&&""==!numValue){var strChar,result=!0;if("-"==numValue.charAt(0)&&1==numValue.length)return!1;for(i=0;i=0&&(1==format||2==format)||numValue.indexOf(",")>=0&&(3==format||4==format))return!((3==format||4==format?numValue.substring(numValue.indexOf(",")+1).length:numValue.substring(numValue.indexOf(".")+1).length)>decimalLen)}else if(numValue.indexOf(".")>=0)return!(numValue.substring(numValue.indexOf(".")+1).length>decimalLen);return!0}function validatePayment(elem){var inputElem=$(elem).find("input").get(0),numValue=$.trim($(inputElem).val());if(null!=numValue&&""==!numValue){var strChar,result=!0;for(i=0;i0){var bgColor,stickyNeeded=!1;!isOpaque(matrixLi)||isTransparent($(matrixLi),!1)||hasBgPattern($(matrixLi),!1)?!isTransparent(matrixLi,!0)||hasBgPattern(matrixLi,!1)||hasBgPattern(matrixLi,!0)?stickyNeeded=!1:!isOpaque($("#formBodyDiv"))||isTransparent($("#formBodyDiv"),!1)||hasBgPattern($("#formBodyDiv"),!1)?!isTransparent("#formBodyDiv",!0)||hasBgPattern($("#formBodyDiv"),!0)||hasBgPattern($("#formBodyDiv"),!1)?stickyNeeded=!1:!isOpaque($("#formRedirectURL"))||isTransparent($("#formRedirectURL"),!1)||hasBgPattern($("#formRedirectURL"),!1)?!isTransparent("#formRedirectURL",!0)||hasBgPattern($("#formRedirectURL"),!0)||hasBgPattern($("#formRedirectURL"),!1)?stickyNeeded=!1:isOpaque($("div[elname=bgDiv]"))&&!isTransparent($("div[elname=bgDiv]"),!1)&&"none"==$("div[elname=bgDiv]").css("background-image")&&(stickyNeeded=!0,bgColor=$("div[elname=bgDiv]").css("background-color")):(stickyNeeded=!0,bgColor=$("#formRedirectURL").css("background-color")):(stickyNeeded=!0,bgColor=$("#formBodyDiv").css("background-color")):(stickyNeeded=!0,bgColor=$(matrixLi).css("background-color")),stickyNeeded&&$("#formBodyDiv").find("li[comptype="+ZFFieldTypeConstants.MATRIX_CHOICE+"]").each(function(index,elem){$(elem).find("th[elname=matrixhead]").css("background-color",bgColor).addClass("matrixfreeze"),$(elem).find("table > tbody > tr").each(function(row,tr){$(tr).find("th[elname=matrixrowhead]").css("background-color",bgColor).addClass("matrixfreeze")})})}}function showUploadLimitErr(linkName,uploadlimit){var errorMsg;errorMsg=-1!=ZFLiveErrorConstants.fileuploadlimiterror.indexOf("{0}")?ZFUtil.replaceParams(ZFLiveErrorConstants.fileuploadlimiterror,uploadlimit):ZFLiveErrorConstants.fileuploadlimiterror;var fuErrTg=$("#error-"+linkName);fuErrTg.text(errorMsg),animateErrorMsg(fuErrTg),addErrorForAccessibility(linkName,!0)}function removeUploadFldsOnclckEvnt(fieldName){$("#"+fieldName+"-id").removeAttr("onclick")}function readFile_New(fileObj,fileUploadLi,linkName,fieldType,count,isCompressionEnabledForField,readComplete,readError){let isLiveForm=!1;typeof ZFLive.mode==ResponseKey.UNDEFINED||ZFLive.mode!=Mode.LIVE&&ZFLive.mode!=Mode.SAVED_RECORD&&ZFLive.mode!=Mode.EDIT||(isLiveForm=!0);let isLargeFileUpload=!1;typeof ZFLive.isLargeFileUploadForm!=ResponseKey.UNDEFINED&&typeof ZFLive.isLargeFileSizeAllowed!=ResponseKey.UNDEFINED&&ZFLive.isLargeFileUploadForm&&ZFLive.isLargeFileSizeAllowed&&(isLargeFileUpload=!0);var maxAllowedSize=20971520,maxSizeInMB=20;if(isLiveForm&&isLargeFileUpload&&(maxAllowedSize=1073741824,maxSizeInMB=1024),ZFLive.isImgCompressionWebEnabled&&isCompressionEnabledForField&&!isLargeFileUpload&&fieldType==ZFFieldTypeConstants.IMAGE_UPLOAD){let compressionRatio=.5;new Promise((compressionComplete,compressionError)=>{if(fileObj.size>52428800){compressionError({error:new Error("Compression not possible for file size greater than 50 MB"),imgProcessId:""})}else{$(fileUploadLi).find("div.uploadFileCont").hide(),$(fileUploadLi).find("a[elname=zoomIcon]").css("display","none"),$(fileUploadLi).find("div[elname=imageCompressionLoader]").show(),$(fileUploadLi).show();let imgProcessId="imgprocess_"+(new Date).getTime();uploadCounter(1,imgProcessId),processImage(fileObj,compressionRatio,imgProcessId,compressionComplete)}}).then(({processedFile:processedFile,imgProcessId:imgProcessId})=>{handleProcessedImage(processedFile,readComplete,readError,fileUploadLi,linkName,fieldType,count,maxAllowedSize,maxSizeInMB,imgProcessId)})["catch"](({error:error,imgProcessId:imgProcessId})=>{handleProcessedImage(fileObj,readComplete,readError,fileUploadLi,linkName,fieldType,count,maxAllowedSize,maxSizeInMB,imgProcessId)})}else new Promise((complete,error)=>{complete({processedFile:fileObj,imgProcessId:""})}).then(({processedFile:processedFile,imgProcessId:imgProcessId})=>{handleProcessedImage(processedFile,readComplete,readError,fileUploadLi,linkName,fieldType,count,maxAllowedSize,maxSizeInMB,imgProcessId)})}function handleProcessedImage(processedFile,readComplete,readError,fileUploadLi,linkName,fieldType,count,maxAllowedSize,maxSizeInMB,imgProcessId){if($(fileUploadLi).find("div[elname=imageCompressionLoader]").remove(),$(fileUploadLi).find("a[elname=zoomIcon]").css("display",""),$(fileUploadLi).find("div.uploadFileCont").show(),processedFile.size>maxAllowedSize){var errorMsg=ZFUtil.replaceParams(ZFLiveErrorConstants.uploadsize,maxSizeInMB),fuErrTg=$("#error-"+linkName);return fuErrTg.text(errorMsg),animateErrorMsg(fuErrTg),addErrorForAccessibility(linkName,!0),$(fileUploadLi).hide(),readError({error:new Error("File size exceeds the limit"),imgProcessId:imgProcessId}),void(typeof imgProcessId!=ResponseKey.UNDEFINED&&""!=imgProcessId&&uploadCounter(-1,imgProcessId))}$(fileUploadLi).show();var fileUploadUniqueName=linkName+"_fu"+count;if(ZFLive.storedFiles.hasOwnProperty(linkName))ZFLive.storedFiles[linkName][fileUploadUniqueName]=processedFile;else{var fileUploadJSON=[];fileUploadJSON[fileUploadUniqueName]=processedFile,ZFLive.storedFiles[linkName]=fileUploadJSON}var fileName=processedFile.name,fileExtension=fileName.substr(fileName.lastIndexOf(".")+1),fileNamewithoutExt=fileName.slice(0,-fileExtension.length);$(fileUploadLi).attr("elname","newlyAddedFUElement"),$(fileUploadLi).attr("name","singleFileElement"),isAccessibilitySupported()&&$(fileUploadLi).find("a[name=removeFileElement]").attr("aria-label",i18n.accessibilityremovefile+" "+fileName),$(fileUploadLi).attr("title",fileName),$(fileUploadLi).find("em[elname=fileName]").text(fileNamewithoutExt),$(fileUploadLi).find("b[elname=fileExtension]").text(fileExtension),$(fileUploadLi).find("p[elname=fileSize]").text(ZFLive.convertBytes(processedFile.size)),$(fileUploadLi).attr("Linkname",fileUploadUniqueName),$(fileUploadLi).find("a[name=removeFileElement]").attr("elname",fileUploadUniqueName);var fileType=processedFile.type;if(fileType.match("image.*")?$(fileUploadLi).find("div[elname=fileNonImage]").hide():($(fileUploadLi).find("a[elname=zoomIcon]").hide(),$(fileUploadLi).find("img[elname=fileImage]").hide()),fileType.match("audio.*")){fieldType==ZFFieldTypeConstants.FILE_UPLOAD&&($(fileUploadLi).find("div[elname=fileNonImage]").attr("id","previewMedia"),$(fileUploadLi).find("div[elname=fileNonImage]").removeClass("fileTypeIcon icon-file-empty"),$(fileUploadLi).find("div[elname=fileNonImage]").append(''));var previewMediaDiv=$(fileUploadLi).find("div[id=previewMedia]");$(previewMediaDiv).attr("onclick","ZFLive.playMedia(this,2)"),$(previewMediaDiv).attr("onkeyup","invokeClickOnPressOfEnter(this)"),$(previewMediaDiv).attr("tabindex",0)}else if(fileType.match("video.*")){fieldType==ZFFieldTypeConstants.FILE_UPLOAD&&($(fileUploadLi).find("div[elname=fileNonImage]").attr("id","previewMedia"),$(fileUploadLi).find("div[elname=fileNonImage]").removeClass("fileTypeIcon icon-file-empty"),$(fileUploadLi).find("div[elname=fileNonImage]").append(''));previewMediaDiv=$(fileUploadLi).find("div[id=previewMedia]");$(previewMediaDiv).attr("onclick","ZFLive.playMedia(this,3)"),$(previewMediaDiv).attr("onkeyup","invokeClickOnPressOfEnter(this)"),$(previewMediaDiv).attr("tabindex",0)}var reader=new FileReader;reader.onload=function(e){$(fileUploadLi).find("img[elname=fileImage]").attr("src",e.target.result),$(fileUploadLi).find("div[id=previewMedia]").attr("src",e.target.result)},reader.readAsDataURL(processedFile),readComplete({fileObj:processedFile,newFileUploadLi:fileUploadLi,imgProcessId:imgProcessId})}function processImage(originalFile,compressionPercentage,imgProcessId,compressionComplete){let fileNameInLowerCase=originalFile.name.toLowerCase();if("image/gif"===originalFile.type||fileNameInLowerCase.endsWith(".gif"))return void compressionComplete({processedFile:originalFile,imgProcessId:imgProcessId});new Promise((conversionComplete,conversionError)=>{checkAndConvertHeicImgs(originalFile,conversionComplete,conversionError)}).then(({convertedFile:convertedFile})=>{let scaleFactor=compressionPercentage,convertedFileSizeMB=parseFloat(convertedFile.size/1048576).toFixed(4),maxSizeMB=parseFloat(convertedFileSizeMB*scaleFactor),img=new Image;img.src=URL.createObjectURL(convertedFile),img.onload=function(){let convertImgWidth=this.width,convertImgHeight=this.height,maxImgWidthOrHeight=parseInt(Math.floor(Math.max(convertImgWidth,convertImgHeight)*scaleFactor)),options={maxSizeMB:maxSizeMB,maxWidthOrHeight:maxImgWidthOrHeight,useWebWorker:!0,libURL:browserImgCompressionJsURL};imageCompression(convertedFile,options).then(compressedFile=>{compressionComplete({processedFile:compressedFile,imgProcessId:imgProcessId})})["catch"](error=>{compressionComplete({processedFile:originalFile,imgProcessId:imgProcessId})})},img.onerror=function(){compressionComplete({processedFile:originalFile,imgProcessId:imgProcessId})}})["catch"](error=>{compressionComplete({processedFile:originalFile,imgProcessId:imgProcessId})})}function checkAndConvertHeicImgs(originalFile,conversionComplete,conversionError){let fileNameInLowerCase=originalFile.name.toLowerCase();if("image/heic"===originalFile.type||"image/heif"===originalFile.type||fileNameInLowerCase.endsWith(".heic")||fileNameInLowerCase.endsWith(".heif")){var fileName=originalFile.name,fileExtension=fileName.substr(fileName.lastIndexOf(".")+1),fileNamewithoutExt=fileName.slice(0,-fileExtension.length);let reader=new FileReader;reader.onload=function(e){let arrayBuffer=e.target.result;try{let heifFile=(new(window.libheif().HeifDecoder)).decode(arrayBuffer);if(!heifFile||0===heifFile.length)return void conversionError(new Error("heic image decoding failed"));let image=heifFile[0],canvas=document.createElement("canvas");canvas.width=image.get_width(),canvas.height=image.get_height();let context=canvas.getContext("2d"),imageData=context.createImageData(image.get_width(),image.get_height());new Promise((resolveImgConversionProcess,imgConversionProcessError)=>{image.display(imageData,success=>success?resolveImgConversionProcess():imgConversionProcessError(new Error("heic/heif processing error")))}).then(()=>{context.putImageData(imageData,0,0),canvas.toBlob(blob=>{let convertedFile=new File([blob],fileNamewithoutExt+".jpeg",{type:"image/jpeg"});conversionComplete({convertedFile:convertedFile})},"image/jpeg")})["catch"](error=>{conversionError(new Error("heic image conversion failed"))})}catch(error){conversionError(new Error("heic image decoding failed. try catch error"))}},reader.onerror=function(error){conversionError(new Error("heic image reading failed"))},reader.readAsArrayBuffer(originalFile)}else conversionComplete({convertedFile:originalFile})}function trimFileName(fileName){if(fileName)return fileName.length>15?fileName.substr(0,15)+"...":fileName}function removeErrorClass(){var fieldList=isOneFieldForm()?$(ZFSlideNav.slideContainer).find("div[elname=livefield-elem]"):isStandardForm()?$("#formBodyDiv").find("div[elname=livefield-elem][elemtype!=gridField]"):$("#formBodyDiv").find("li");$(fieldList).each(function(index,elem){checkErrTrackFieldListAndRemoveErrorFromLiElem(elem)})}function removeErrorFromLiElemWithoutAnimation(elem){removeErrorFromLiElem(elem,!0)}function removeErrorFromLiElem(elem,hidWithoutAnimation){var comptype=parseInt($(elem).attr("comptype")),linkname=$(elem).attr("linkname");if(comptype==ZFFieldTypeConstants.ADDRESS||comptype==ZFFieldTypeConstants.NAME||comptype==ZFFieldTypeConstants.GEOLOCATION)$(elem).find("div,span").each(function(index1,elem1){$(elem1).removeClass("error1")}),$(elem).removeClass("error");else{var compname=$(elem).attr("compname");if(compname==SystemGeneratedField.PAYMENT_AMOUNT.LINK_NAME)$(elem).find("div").each(function(index1,elem1){$(elem1).removeClass("error1")});else if(comptype==ZFFieldTypeConstants.EMAIL||comptype==ZFFieldTypeConstants.PHONE||comptype==ZFFieldTypeConstants.NUMBER||comptype==ZFFieldTypeConstants.DECIMAL||comptype==ZFFieldTypeConstants.CURRENCY){var needReconf=$(elem).attr("need_reconf");if(typeof needReconf!=ResponseKey.UNDEFINED&&"true"==needReconf){var reconfErrorElem=$(elem).find("p[elname=reconf-error]");$(reconfErrorElem).is(":visible")||($(elem).removeClass("error"),isAccessibilitySupported()&&(addErrorForAccessibility(compname+"-reconf",!1),addErrorForAccessibility(compname,!1)))}else $(elem).removeClass("error"),addErrorForAccessibility(compname,!1)}else if(ZFLive.isOldUploadType||comptype!=ZFFieldTypeConstants.FILE_UPLOAD&&comptype!=ZFFieldTypeConstants.IMAGE_UPLOAD&&comptype!=ZFFieldTypeConstants.MEDIA_UPLOAD)comptype==ZFFieldTypeConstants.MATRIX_CHOICE?($(elem).removeClass("error"),addErrorForAccessibility(compname,!1),$(elem).attr("choiceType")==MatrixChoicesType.TEXTBOX.CODE&&$(elem).find("input").length>0?removeMatrixError($(elem).find("input"),!1):($(elem).attr("choiceType")==MatrixChoicesType.NUMBER.CODE||$(elem).attr("choiceType")==MatrixChoicesType.CURRENCY.CODE)&&$(elem).find("input").length>0?removeMatrixError($(elem).find("input"),!0):$(elem).attr("choiceType")==MatrixChoicesType.DROPDOWN.CODE&&$(elem).find("select").length>0&&removeMatrixSltError($(elem).find("select"))):($(elem).removeClass("error"),addErrorForAccessibility(compname,!1));else{0==$(elem).find("li.fileUploadError").length&&$(elem).removeClass("error")}}"subFormField"===$(elem).attr("elemtype")&&("undefined"!=typeof ZFLive.sfUniqueValidator&&"undefined"!=typeof ZFLive.sfUniqueValidator[linkname]&&delete ZFLive.sfUniqueValidator[linkname],"2"==$(elem).attr("viewtype")&&$(elem).find('[elname="sfcardelem"]').find('[elname="sfCardInnerElem"]').removeClass("sfCardError"),$(elem).find('[elname="subFormFieldsUl"]').each(function(idx,ulElem){$(ulElem).find('[elname="sfEntryError"]').hide()})),hidWithoutAnimation!=undefined&&hidWithoutAnimation?($(elem).find("p[elname=error],div[elname=error]").hide().text(""),$(elem).find("#error-"+linkname).hide()):($(elem).find("p[elname=error],div[elname=error]").slideUp().text(""),$(elem).find("#error-"+linkname).slideUp())}function showSavePopUp(saveUrl,respJson){var emailValue="";if(respJson.hasOwnProperty("toaddress_saveandresume"))if(isOneFieldForm())emailValue=$("#slideContainer").find('div[linkname="'+respJson.toaddress_saveandresume+'"]').find('input[name="'+respJson.toaddress_saveandresume+'"]').val();else{var fldElem=isStandardForm()?$("#formBodyDiv").find('div[linkname="'+respJson.toaddress_saveandresume+'"]'):$("#formBodyDiv").find('li[linkname="'+respJson.toaddress_saveandresume+'"]');emailValue=$(fldElem).find('input[name="'+respJson.toaddress_saveandresume+'"]').val()}var saveUrlPopupDiv=$("#savePopUpDiv");$(saveUrlPopupDiv).find("textarea").val(saveUrl);var popupElem=$(saveUrlPopupDiv).find("div.popUpOuterSave");if($(saveUrlPopupDiv).find("div[elname=emailSavedLink]").removeClass("errSavemail").hide(),$(saveUrlPopupDiv).find("input[elname=emailID]").val(emailValue),$(saveUrlPopupDiv).find("p[elname=errorMsg]").hide(),$(saveUrlPopupDiv).find("div[elname=succesDiv]").hide(),$(saveUrlPopupDiv).find("div[elname=emailtoDiv]").hide(),respJson.save_and_resume){var saveAndResumeObj=respJson.save_and_resume;if(saveAndResumeObj.allow_email_savedLink)$(saveUrlPopupDiv).find("button[elname=sendEmailBtn]").off().click(function(e){isIELessThan9()||e.preventDefault(),ZFLive.sendSavedUrlInEmail(this)}),$(saveUrlPopupDiv).find("div[elname=emailSavedLink]").show(),$(saveUrlPopupDiv).find("div[elname=emailtoDiv]").show();else if(saveAndResumeObj.to_addr){var succesDiv=$(saveUrlPopupDiv).find("div[elname=succesDiv]");$(succesDiv).find("em[elname=successDivMsg]").text(i18n.saveandresume_email_sent),$(succesDiv).find("em[elname=emailMsg]").text(saveAndResumeObj.to_addr),$(succesDiv).show(),$(saveUrlPopupDiv).find("div[elname=emailtoDiv]").show()}}if($(saveUrlPopupDiv).show(),isStandardForm()&&isEmbeddedForm()){var popUpHeight=$(popupElem).outerHeight(!0),footerElem=$("div[elname=footer]:visible"),popupPosAdjustmentVal=-1*(popUpHeight-$(footerElem).outerHeight(!0)/2);setPopupPositionNearRefElem($(popupElem),$("button[elname=save]:visible"),popupPosAdjustmentVal,!0,!1),$("body").addClass("hideWindowScroll")}else isStandardForm()?($("body").addClass("hideWindowScroll"),ZFUtil.setElemPosition($(popupElem))):setPopupPositionNearFooter($(popupElem),!1);typeof emailValue!=ResponseKey.UNDEFINED&&emailValue.length>0?$(saveUrlPopupDiv).find("input[elname=emailID]").addClass("saveEmailDivDisabled"):($(saveUrlPopupDiv).find("input[elname=emailID]").removeClass("saveEmailDivDisabled"),$(saveUrlPopupDiv).find("input[elname=emailID]").focus()),isAccessibilitySupported()&&($(saveUrlPopupDiv).find("input[elname=emailID]").is(":visible")?$(saveUrlPopupDiv).find("input[elname=emailID]").focus():$(saveUrlPopupDiv).find("textarea").focus())}function performPaymentAndSubmitData(merchantType){var payemntLi=$("#PaymentAmount-li"),parentUl=isStandardForm()?$(payemntLi).closest("div[elname=formBodyULName]"):payemntLi.parent("ul[elname=formBodyULName]");"true"===payemntLi.attr("needdata")&&isOneFieldForm()||"true"===payemntLi.attr("needdata")&&"true"==parentUl.attr("needpagedata")?merchantType==ZFFormPayments.MERCHANT_TYPE.STRIPE?ZFLive.generateStripeTokenAndSubmitData():merchantType==ZFFormPayments.MERCHANT_TYPE.AUTHORIZE_NET?ZFLive.generatePaymentTokenAndSubmitData():ZFLive.ValidateAndSubmitData():ZFLive.ValidateAndSubmitData()}function showError(errorObj){var compname=errorObj[0],parentElem=$("#"+compname+"-li");if(isOneFieldForm()){jumpToSpecificSlideWithParentFieldElem(parentElem);for(var i=0;i=0}function calcFormFormulaWhichHasSFFormula(formulaLinkName){for(var formulaJsonArr=JSON.parse(ZFLive.formulaJson),formulaInd=0;formulaInd0){var parentSFLi,sfPopUp=$(fldLiElem).closest("#subFormPopUp");if($(sfPopUp).length>0){var sfLinkName=$(sfPopUp).attr("linkname");parentSFLi=getFieldElemWithFldLinkNameAttrLivefieldElem(sfLinkName)}else parentSFLi=getClosestSubformElemLi(fldLiElem);if(isOneFieldForm())return"true"==$(parentSFLi).attr("needdata")&&"true"==$(fldLinkElem).attr("needdata");var parentPage=isStandardForm()?$(parentSFLi).closest("div[elname=formBodyULName]"):$(parentSFLi).parent("ul");return"true"==$(parentSFLi).attr("needdata")&&"true"==$(parentPage).attr("needpagedata")&&"true"==$(fldLinkElem).attr("needdata")}return!1}if(isOneFieldForm())return"true"==$(fldLinkElem).attr("needdata");parentPage=isStandardForm()?$(fldLinkElem).closest("div[elname=formBodyULName]"):$(fldLinkElem).parent("ul");return"true"==checkAndReturnNeedDataAttr(fldLinkElem)&&"true"==$(parentPage).attr("needpagedata")}function evaluateFormulaInSubFormField(expression,formulaLinkName){var sfRowIter=getSFFieldElemWithFldLinkNameAttr(formulaLinkName);$(sfRowIter).each(function(index,formulaElem){var formulaParentElem=isNewHtmlDOM()?$(formulaElem).closest('div[elname="subFormFieldsUl"]'):$(formulaElem).closest("ul");"subFormFieldsUl"==$(formulaParentElem).attr("elname")&&(isSubFormElem=!0,rowId=$(formulaParentElem).attr("rowid"),formulaExpressionParser(expression,formulaLinkName,isSubFormElem,rowId))})}function evaluateConditionalFormulaInSubFormField(formulaJson,formulaLinkName){var sfRowIter=getSFFieldElemWithFldLinkNameAttr(formulaLinkName);$(sfRowIter).each(function(index,formulaElem){var formulaParentElem=isNewHtmlDOM()?$(formulaElem).closest('div[elname="subFormFieldsUl"]'):$(formulaElem).closest("ul");if("subFormFieldsUl"==$(formulaParentElem).attr("elname")){var rowId=$(formulaParentElem).attr("rowid");formulaExpressionParser(getConditionalExpression(formulaJson,!0,rowId),formulaLinkName,!0,rowId)}})}function setValueInFormula(formulaLinkName,result,isSubFormElem,rowId,needAdvRuleExec){var formulaFldLiElem,parsedResult=0;result=(result+"").replace(/[()]/g,""),formulaFldLiElem=isSubFormElem?getSFFieldElemWithCompNameAttr(formulaLinkName+"_"+rowId):getFieldElem(formulaLinkName);var formulaFldTextElem=$(formulaFldLiElem).find(":text"),decimalLength=$(formulaFldLiElem).attr("decimallength");if(isFinite(result))if(-1==decimalLength){parsedResult=/^-?\d+$/.test(result)?parseFloat(result):parseFloat(result).toFixed(2)}else parsedResult=parseFloat(result).toFixed(decimalLength);else parsedResult=0;var decimalFormat=$(formulaFldLiElem).attr("decimalformat");if(parsedResult=ZFUtil.getFormattedDecimal(parsedResult,decimalFormat),$(formulaFldTextElem).val(parsedResult),typeof ZFLive.mode==ResponseKey.UNDEFINED||ZFLive.mode!=Mode.LIVE&&ZFLive.mode!=Mode.SAVED_RECORD&&ZFLive.mode!=Mode.EDIT||ZFLive.prefillFieldLabel(formulaFldTextElem),null!=ZFLive.paymentMerchantList&&ZFLive.setValueInPayment(formulaLinkName),isSubFormElem&&(setSubFormCardFormula(formulaFldLiElem,formulaLinkName,rowId,parsedResult),setSfTotalVal(formulaFldLiElem)),ZFLive.mode!=undefined&&!isSubFormElem){var evalAllRulesArr=[];if(isAdvancedRule())needAdvRuleExec&&zf_rule.evalAdvRules(zf_rule.on_form_load_ruleorder,undefined,undefined,undefined);else{var groupActionVisibleHiddenJsonObj={};groupActionVisibleHiddenJsonObj[ZFRuleConstants.SHOW_GROUP]={},groupActionVisibleHiddenJsonObj[ZFRuleConstants.HIDE_GROUP]={};var ruleResultObj=getRuleResultObject();evalAllRulesArr=[];zf_rule.evalRules($(formulaFldTextElem),evalAllRulesArr,groupActionVisibleHiddenJsonObj,ruleResultObj),performShowHideGroupActionsInSelectFields(groupActionVisibleHiddenJsonObj),ZFLive.checkAndPrefillFldLabelAfterRule(ruleResultObj,groupActionVisibleHiddenJsonObj)}isOneFieldForm()&&updateSlides(),triggerFormResize()}}function setSubFormCardFormula(formulaFldLiElem,formulaLinkName,rowId,parsedResult){var sfPopUp=$(formulaFldLiElem).closest("#subFormPopUp");if($(sfPopUp).length>0){var sfLinkName=$(sfPopUp).attr("linkname"),sfLi=getFieldElemWithFldLinkNameAttrLivefieldElem(sfLinkName),formulaFldInCard=$(sfLi).find('div[elname="sfcardelem"][cardrowid="'+rowId+'"]').find('[elname="sfCardContDiv"][linkname="'+formulaLinkName+'"]');$(formulaFldInCard).length>0&&$(formulaFldInCard).find('[elname="recordVal"]').text(parsedResult)}else{sfLi=getClosestSubformElemLi(formulaFldLiElem);if("2"==$(sfLi).attr("viewtype")){formulaFldInCard=$(sfLi).find('div[elname="sfcardelem"][cardrowid="'+rowId+'"]').find('[elname="sfCardContDiv"][linkname="'+formulaLinkName+'"]');$(formulaFldInCard).length>0&&$(formulaFldInCard).find('[elname="recordVal"]').text(parsedResult)}}}function isExpressionHasCurrentFld(expression,currentFieldName){if(void 0===expression||null==expression)return!1;var tempToken="",isExpHasCurrentFld=!1;for(expression=expression.replace(/ /g,""),i=0;i0&&operatorStack.length>0){var roundVar=operatorStack[operatorStack.length-1];if(roundVar==DateCalculationType.ROUNDUP||roundVar==DateCalculationType.ROUNDDOWN||roundVar==DateCalculationType.ROUND){var valueToBeRounded=roundTheValueInFormula(valueStack.pop(),operatorStack.pop());valueStack.push(valueToBeRounded)}if(roundVar==DateCalculationType.AGE){var datedob=valueStack.pop();operatorStack.pop();valueStack.push(getAgeInFormula(datedob))}if(roundVar==DateCalculationType.COUNT){var count_value=valueStack.pop();operatorStack.pop();valueStack.push(count_value)}}}else if("+"==token||"-"==token||"*"==token||"/"==token){for(;0!=operatorStack.length&&leftHasGreaterPrecedence(operatorStack[operatorStack.length-1],token);)calculateFormulaFromStack(valueStack,operatorStack,dateCalcType);operatorStack.push(token)}else token!==DateCalculationType.DAYS&&token!==DateCalculationType.MONTHS&&token!==DateCalculationType.YEARS&&token!==DateCalculationType.HOURS&&token!==DateCalculationType.MINUTES&&token!==DateCalculationType.AllowedDaysCount||(dateCalcType=token);for(;0!=operatorStack.length;)calculateFormulaFromStack(valueStack,operatorStack,dateCalcType);return valueStack.pop()}function calculateFormulaForAllEntryInSubFormFld(formulaJson){var linkName=formulaJson.link_name,formula_type=formulaJson.formula_type;getClosestParentSubFormUL(getSFFieldElemWithFldLinkNameAttr(linkName)).each(function(idx,elem){formula_type==ZFFormulaTypeConstants.CONDITIONAL?formulaExpressionParser(getConditionalExpression(formulaJson,!0,parseInt($(elem).attr("rowid"))),linkName,!0,parseInt($(elem).attr("rowid"))):formulaExpressionParser(formulaJson.expression,linkName,!0,parseInt($(elem).attr("rowid")))}),calcFormFormulaWhichHasSFFormula(linkName)}function addValueToExpArray(tempToken,expressionArr,isSubFormElem,rowId,isCountPresent,isChildfrmulaCalcNeeded){addValueToExpArray(tempToken,expressionArr,isSubFormElem,rowId,isCountPresent,isChildfrmulaCalcNeeded,!1)}function addValueToExpArray(tempToken,expressionArr,isSubFormElem,rowId,isCountPresent,isChildfrmulaCalcNeeded,addTempVar){if(isFormField(tempToken)){if(isChildfrmulaCalcNeeded)getFormFieldType(tempToken)===ZFFieldTypeConstants.FORMULA&&ZFLive.evalChildFormulaExpression(tempToken);isCountPresent&&(tempToken+="_count");var value=getValue(tempToken,isSubFormElem,rowId);addTempVar&&""!=value&&typeof ZFLive.disabledDaysMap[tempToken]!=ResponseKey.UNDEFINED&&(value=value+"--zf--"+ZFLive.disabledDaysMap[tempToken]),null!=value&&""!=value||(value=0),expressionArr.push(value)}else expressionArr.push(tempToken)}function leftHasGreaterPrecedence(leftOptr,rightOptr){if("("==leftOptr)return!1;var operatorPrecedenceObj={"*":2,"/":2,"+":1,"-":1};return operatorPrecedenceObj[leftOptr]>=operatorPrecedenceObj[rightOptr]}function calculateFormulaFromStack(valueStack,operatorStack,dateCalcType){var rightOperand=valueStack.pop(),Operator=operatorStack.pop(),leftOperand=valueStack.pop(),result=0;switch(dateCalcType){case DateCalculationType.DAYS:result=getDaysDiffResult_forGenFormat(leftOperand,rightOperand,Operator,dateCalcType);break;case DateCalculationType.MONTHS:case DateCalculationType.YEARS:result=getMonthsOrYearsDiffResult_forGenFormat(leftOperand,rightOperand,Operator,dateCalcType);break;case DateCalculationType.HOURS:case DateCalculationType.MINUTES:result=calculateMinutesOrHours_forGenFormat(leftOperand,rightOperand,Operator,dateCalcType);break;case DateCalculationType.AllowedDaysCount:result=getAllowedDaysCountResult_forGenFormat(leftOperand,rightOperand,Operator,dateCalcType)}valueStack.push(result)}function calculateFormula(expressionStr){var result=0;""!=expressionStr&&(result=new Function("return "+expressionStr)(),isFinite(result)||(result=0));return result}function calculateDate(leftOperand,rightOperand,operator,dateCalcType){var result=0,dateFormat=$("#zf_date_format").val();if(ZFUtil.validateDate(leftOperand,dateFormat)&&ZFUtil.validateDate(rightOperand,dateFormat)&&"-"===operator){var splitLeftDate=ZFUtil.splitDateVal(leftOperand,dateFormat),leftDate=new Date(splitLeftDate[2],splitLeftDate[1],splitLeftDate[0]),splitRightDate=ZFUtil.splitDateVal(rightOperand,dateFormat),rightDate=new Date(splitRightDate[2],splitRightDate[1],splitRightDate[0]);if(dateCalcType===DateCalculationType.DAYS)result=Math.floor((treatAsUTC(leftDate)-treatAsUTC(rightDate))/864e5);else if(dateCalcType===DateCalculationType.MONTHS){result=12*(splitLeftDate[2]-splitRightDate[2])+(splitLeftDate[1]-splitRightDate[1])}else if(dateCalcType===DateCalculationType.YEARS){result=splitLeftDate[2]-splitRightDate[2]}}return result}function calculateDate_genFormat(leftOperand,rightOperand,operator,dateCalcType,leftDisabledDays,rightDisabledDays){var result=0,dateRegexVal=new RegExp("^\\w{0,2}-\\w{0,2}-\\w{4}$","u");if(isPatternMatches(leftOperand,dateRegexVal)&&isPatternMatches(rightOperand,dateRegexVal)&&"-"===operator){var splitLeftDate=splitDateElementForDDMMYYYYFormat(leftOperand),leftDate=new Date(splitLeftDate[2],splitLeftDate[1],splitLeftDate[0]),splitRightDate=splitDateElementForDDMMYYYYFormat(rightOperand),rightDate=new Date(splitRightDate[2],splitRightDate[1],splitRightDate[0]);if(dateCalcType===DateCalculationType.DAYS)result=Math.floor((treatAsUTC(leftDate)-treatAsUTC(rightDate))/864e5);else if(dateCalcType===DateCalculationType.MONTHS){result=12*(splitLeftDate[2]-splitRightDate[2])+(splitLeftDate[1]-splitRightDate[1])}else if(dateCalcType===DateCalculationType.YEARS){result=splitLeftDate[2]-splitRightDate[2]}else if(dateCalcType===DateCalculationType.AllowedDaysCount){result=ZFUtil.calculateDateDiffWithoutHolidays(leftDate,rightDate,operator,leftDisabledDays,rightDisabledDays)}}return result}function splitDateElementForDDMMYYYYFormat(dateval){var dateelements=new Array(3);return dateelements[0]=dateval.substring(0,dateval.indexOf("-")),dateelements[1]=dateval.substring(dateval.indexOf("-")+1,dateval.lastIndexOf("-")),dateelements[2]=dateval.substr(dateval.lastIndexOf("-")+1,dateval.length),dateelements}function splitDateElementForDDMMYYYYFormatForformulaCurrentDate(){var dateval=ZFLive.formulaCurrentDateddmmyyyyhhmm.split(" ")[0],dateelements=new Array(3);return dateelements[0]=dateval.substring(0,dateval.indexOf("-")),dateelements[1]=dateval.substring(dateval.indexOf("-")+1,dateval.lastIndexOf("-"))-1,dateelements[2]=dateval.substr(dateval.lastIndexOf("-")+1,dateval.length),dateelements}function getValue(fieldLinkName,isSubFormElem,rowId){var val="",fldLiElem=undefined,isCountPresent=!1,fieldLinkNameForFormulaExp=fieldLinkName;-1!=fieldLinkName.indexOf("_count")&&(isCountPresent=!0,fieldLinkName=fieldLinkName.replace("_count",""));var fieldLinkNameForGetVal=fieldLinkName;if(isSubFormElem!==undefined&&!0===isSubFormElem){var testForSubFormChildField=getSFFieldElemWithCompNameAttr(fieldLinkName+"_"+rowId);if(1==$(testForSubFormChildField).length){fldLiElem=testForSubFormChildField;var sfPopUp=$(fldLiElem).closest("#subFormPopUp");if(fieldLinkNameForGetVal=fieldLinkName+"_"+rowId,0==$(sfPopUp).length)parentSFLi=getClosestSubformElemLi(fldLiElem);else{var sfLinkName=$(sfPopUp).attr("linkname");parentSFLi=getFieldElemWithFldLinkNameAttrLivefieldElem(sfLinkName)}if(0==ZFUtil.isFieldVisible(parentSFLi))return val;if("false"==$(parentSFLi).attr("needdata"))return val}else fldLiElem=getFieldElemWithCompNameAttr(fieldLinkName)}else if(fldLiElem=getFieldElemWithCompNameAttr(fieldLinkName),0==$(fldLiElem).length){var subFormChildFieldsLi=getSFFieldElemWithFldLinkNameAttr(fieldLinkName);if($(subFormChildFieldsLi).length>0){var parentSFLi=getClosestSubformElemLi($(subFormChildFieldsLi)[0]);return 0==ZFUtil.isFieldVisible(parentSFLi)?val:"false"==$(parentSFLi).attr("needdata")?val:($(subFormChildFieldsLi).each(function(index,elem){if($(elem).attr("compname")!=fieldLinkName+"_0"){var thisVal=getValue(fieldLinkNameForFormulaExp,!0,parseInt(getClosestParentSubFormUL(elem).attr("rowId")));null!=thisVal&&""!=thisVal&&thisVal!=undefined&&(val=Number(val)+Number(thisVal))}}),val)}}var needDataPage=isStandardForm()?$(fldLiElem).closest('div[elname="formBodyULName"]').attr("needpagedata"):fldLiElem.parent('ul[elname="formBodyULName"]').attr("needpagedata"),comptype=parseInt($(fldLiElem).attr("comptype"));if(comptype===ZFFieldTypeConstants.FORMULA)val=getFormulaValueFromLiElem(fldLiElem);else if("true"===checkAndReturnNeedDataAttr(fldLiElem)){if("false"==needDataPage)return val;if(comptype===ZFFieldTypeConstants.CURRENCY||comptype===ZFFieldTypeConstants.DECIMAL){if(validateCurrencyWithoutFormat(fldLiElem)){var decimalFormat=$(fldLiElem).attr("decimalformat");val=ZFUtil.getReformattedDecimal($.trim($(fldLiElem).find("input").val()),decimalFormat)}}else if(comptype===ZFFieldTypeConstants.NUMBER)validateNumber(fldLiElem)&&(val=$.trim($(fldLiElem).find("input").val()));else if(comptype===ZFFieldTypeConstants.SLIDER)val=$(fldLiElem).find("div[name=slider]").attr("value");else if(comptype==ZFFieldTypeConstants.RATING){var parentRatingDiv=$(fldLiElem).find("div[elname=ratingSubData]");val=parentRatingDiv.find("a").attr("value")}else if(comptype==ZFFieldTypeConstants.RADIO)$(fldLiElem).find("input:checked").each(function(index,elem){if($(elem).attr("allowothers")){var otherVal=$(fldLiElem).find("input[name=allow-others-text]").val();isNaN(otherVal)||(val=Number(val)+Number(otherVal))}else{var formulaVal=$(elem).attr("formula_val");formulaVal==undefined&&(formulaVal=""),val=Number(val)+Number(formulaVal)}});else if(comptype==ZFFieldTypeConstants.CHECKBOX)isCountPresent?(val=$(fldLiElem).find("input:checked").length,$(fldLiElem).find("input[elname=checkbox-input]").is(":checked")&&0==$.trim($(fldLiElem).find("input[name=allow-others-text]").val()).length&&(val-=1)):$(fldLiElem).find("input:checked").each(function(index,elem){if($(elem).attr("allowothers")){var otherVal=$(fldLiElem).find("input[name=allow-others-text]").val();isNaN(otherVal)||(val=Number(val)+Number(otherVal))}else{var formulaVal=$(elem).attr("formula_val");formulaVal==undefined&&(formulaVal=""),val=Number(val)+Number(formulaVal)}});else if(comptype==ZFFieldTypeConstants.DROPDOWN)$(fldLiElem).find("select[name='"+fieldLinkNameForGetVal+"']").find("option:selected").each(function(index,elem){if("zfs-others-zfs"===$(elem).val()){var otherVal=$(fldLiElem).find("input[name=allow-others-text]").val();isNaN(otherVal)||(val=Number(val)+Number(otherVal))}else{var formulaVal=$(elem).attr("formula_val");formulaVal==undefined&&(formulaVal=""),val=Number(val)+Number(formulaVal)}});else if(comptype==ZFFieldTypeConstants.MULTIPLE_CHOICE)isCountPresent?val=$(fldLiElem).find("div[elemname=fieldContentDiv]").find("option:selected").length:$(fldLiElem).find("div[elemname=fieldContentDiv]").find("option:selected").each(function(index,elem){var formulaVal=$(elem).attr("formula_val");formulaVal==undefined&&(formulaVal=""),val=Number(val)+Number(formulaVal)});else if(comptype==ZFFieldTypeConstants.IMAGE_CHOICE)isCountPresent?(val=0,$(fldLiElem).find("div[elname=choiceContDiv]").each(function(index,elem){$(elem).hasClass("selected")&&(val+=1)})):$(fldLiElem).find("div[elname=choiceContDiv]").each(function(index,elem){if($(elem).hasClass("selected")){var formulaVal=$(elem).find("img").attr("formula_val");formulaVal==undefined&&(formulaVal=""),val=Number(val)+Number(formulaVal)}});else if(comptype==ZFFieldTypeConstants.DATE||comptype==ZFFieldTypeConstants.MONTHYEAR||comptype==ZFFieldTypeConstants.DATETIME||comptype==ZFFieldTypeConstants.TIME)if(comptype==ZFFieldTypeConstants.DATE){var date=$.trim($(fldLiElem).find("input").val());ZFUtil.validateDate(date,$("#zf_date_format").val(),$("#zf_date_format").attr("dateLocale"))&&(date=ZFUtil.convertToGeneralDate_ddMMMyyyy(date),val=date);var linkName=$(fldLiElem).attr("linkname");ZFLive.disabledDaysMap[linkName]=$(fldLiElem).attr("disableddays")}else if(comptype==ZFFieldTypeConstants.MONTHYEAR){date=$.trim($(fldLiElem).find("input").val());ZFUtil.validateMonthYear(date,$("#zf_date_format").val(),$("#zf_date_format").attr("dateLocale"))&&(date=ZFUtil.convertToGeneralDateFromMonth_ddMMMyyyy(date),val=date)}else if(comptype==ZFFieldTypeConstants.DATETIME){var dateTime=$.trim($(fldLiElem).find("input").val()),timeFormat=$(fldLiElem).attr("timeformat");ZFUtil.validateDateTime(dateTime,$("#zf_date_format").val(),$("#zf_date_format").attr("dateLocale"),timeFormat)&&(dateTime=ZFUtil.convertToGeneralDateTime_ddMMMyyyyhhmm(dateTime,timeFormat,$("#zf_date_format").attr("dateLocale")),val=dateTime);linkName=$(fldLiElem).attr("linkname");ZFLive.disabledDaysMap[linkName]=$(fldLiElem).attr("disableddays")}else if(comptype==ZFFieldTypeConstants.TIME){var timeValue="",hours=(timeFormat=$(fldLiElem).attr("timeformat"),$(fldLiElem).find('select[timecomp="hours"]').val()),minutes=$(fldLiElem).find('select[timecomp="minutes"]').val(),meridian=$(fldLiElem).find('select[timecomp="Meridiem"]').val();""!=(timeValue=""===hours||""===minutes||""===meridian?"":meridian===undefined?hours+":"+minutes:hours+":"+minutes+" "+meridian)&&ZFUtil.validateTimeFormat(timeValue,timeFormat)&&(val=ZFUtil.convertToGeneralTime_hhmm(timeValue))}}return val}function getFormulaValueFromLiElem(formulaFldLiElem){var value=$.trim($(formulaFldLiElem).find(":text").val()),decimalFormat=$(formulaFldLiElem).attr("decimalformat");return value=ZFUtil.getReformattedDecimal(value,decimalFormat)}function isFormField(token){var isFormFld=!1;if(null!=ZFLive.formulaFieldsList)for(var fieldsArr=JSON.parse(ZFLive.formulaFieldsList),fldInd=0;fldInd0?$(liElem).each(function(){$(this).attr("compname")!==linkName+"_0"&&bindEventsOnFieldsForFormula(compType,$(this).attr("compname"))}):bindEventsOnFieldsForFormula(compType,linkName)}function bindEventsOnFieldsForFormula(compType,linkName){var liElem=getFieldElem(linkName);if(compType==ZFFieldTypeConstants.NUMBER||compType==ZFFieldTypeConstants.CURRENCY||compType==ZFFieldTypeConstants.DECIMAL)$(liElem).on("blur","input",function(){removeLeadingZeros($(this).closest("li")),ZFLive.evalExpression(this)});else if(compType==ZFFieldTypeConstants.RATING)$(liElem).on("click","a,span",function(){ZFLive.evalExpression(this)});else if(compType==ZFFieldTypeConstants.SLIDER){var sliderElems=$(liElem).find("a");for(index=0;index0?valueJson[$(elem).attr("compname")]=valueJsonArr:valueJson[$(elem).attr("compname")]=""}function goTo(pageNo){if("{}"===JSON.stringify(zfPageRule.pageRules)){var currentPg=$("#navigBar").attr("currentPage");currentPg!=pageNo&&(document.activeElement.blur(),ZFLive.skipValidation||pageNo0?focusFirstField($(sfUls).first()):$(lielem).focus(),isAccessibilitySupported()&&(isStandardForm()?$(lielem).find("span[elname=sfLivemoreListIcon]").focus():$(lielem).find("div[elname=sfMoreCircle]").focus())}}else{var comptype=lielem.attr("comptype"),compTypeInt=parseInt(comptype);if(1==comptype||3==comptype||4==comptype||7==comptype||8==comptype||9==comptype||10==comptype||11==comptype||13==comptype||14==comptype||18==comptype||19==comptype||20==comptype||30==comptype&&"3"!=$(lielem).attr("choiceType")||32==comptype||35==comptype)$(lielem).find("input:first").focus(),setFocusForFirstElemAccessibility(lielem,comptype);else if(2==comptype)$(lielem).find("textarea").focus();else if(6==comptype){focusSelectElem($(lielem).find("select:first")),setFocusForFirstElemAccessibility(lielem,comptype)}else if(12==comptype||15==comptype){focusSelectElem($(lielem).find("select")),setFocusForFirstElemAccessibility(lielem,comptype)}else if(29==comptype){var choiceType=$(lielem).find("div[elname=imageChoiceEle]").attr("choicetype");choiceType==ImageChoicesType.RADIO||choiceType==ImageChoicesType.CHECKBOX?$(lielem).find("input:first").focus():choiceType==ImageChoicesType.IMG_PICKER&&$(lielem).find("div[elname=choiceContDiv]:first").attr("tabindex","-1").focus()}else compTypeInt===ZFFieldTypeConstants.ZOHO_CRM?ZFCrmLive.zfCrmLive.focusZohoCrmField(lielem):(typeof ZFLive===ResponseKey.UNDEFINED||ZFLive.mode!=Mode.LIVE&&ZFLive.mode!=Mode.SAVED_RECORD&&ZFLive.mode!=Mode.EDIT||("subFormFieldsUl"==$(UlElem).attr("elname")?$(lielem).focus():setFocusForNonFocusableFieldsOldStandard($(lielem))),setFocusForFirstElemAccessibility(lielem,comptype))}}}function setFocusForNonFocusableFieldsOldStandard(lielem){if(isEmbeddedForm())setFocusForElementThatCannotBeFocused(lielem);else{var formBodyOffset=$(ZFLive.formFormFieldsOuterWrapper).offset();window.scrollTo({top:formBodyOffset.top,left:0})}}function focusFirstErrorElem(parentElem){if(isStandardForm()){new ZFLiveFieldFocusHander($(parentElem),!0).focusThisFieldElement()}else{var fieldType=parseInt($(parentElem).attr("comptype"));if(fieldType===ZFFieldTypeConstants.ZOHO_CRM)ZFCrmLive.zfCrmLive.focusZohoCrmField(parentElem);else if(fieldType==ZFFieldTypeConstants.ADDRESS||fieldType==ZFFieldTypeConstants.NAME||fieldType==ZFFieldTypeConstants.GEOLOCATION){var elemInp=$(parentElem).find("div,span").find(".error1").first().find(":input[type!=hidden]:first");typeof elemInp!=ResponseKey.UNDEFINED&&$(elemInp).is("select")&&isiOSMobileBrowser()?$(elemInp).parent().focus():$(elemInp).focus()}else if(fieldType==ZFFieldTypeConstants.RATING||fieldType==ZFFieldTypeConstants.SIGNATURE||fieldType==ZFFieldTypeConstants.SLIDER)parentElem.focus(),setFocusForFirstElemAccessibility(parentElem,fieldType);else{var parentSubformLi=isNewHtmlDOM()?$(parentElem).closest("div[elname=subFormFieldsUl]").closest("div[elname=livefield-elem]"):$(parentElem).closest("ul[elname=subFormFieldsUl]").closest("li[elname=livefield-elem]"),sfViewType=parentSubformLi.length>0?$(parentSubformLi).attr("viewtype"):"";if(parentSubformLi.length>0&&"subFormField"==$(parentSubformLi).attr("elemtype")&&"2"==sfViewType){var rowId=getClosestParentSubFormUL(parentElem).attr("rowid"),thisSfCardElem=$(parentSubformLi).find('div[elname="sfcardelem"][cardrowid="'+rowId+'"]');$(thisSfCardElem).attr("tabindex","1").focus().removeAttr("tabindex")}else if("subFormField"==$(parentElem).attr("elemtype")){$(parentElem).attr("compname");$(parentElem).focus()}else{if(fieldType===ZFFieldTypeConstants.EMAIL||fieldType===ZFFieldTypeConstants.PHONE||fieldType===ZFFieldTypeConstants.NUMBER||fieldType===ZFFieldTypeConstants.DECIMAL||fieldType===ZFFieldTypeConstants.CURRENCY){var errorElem=$(parentElem).find("p[elname=error]");if($(errorElem).is(":visible"))return void parentElem.find(":input[type!=hidden]:first").focus();var needReconf=$(parentElem).attr("need_reconf");if(typeof needReconf!=ResponseKey.UNDEFINED&&"true"==needReconf){var reconfErrorElem=$(parentElem).find("p[elname=reconf-error]");if($(reconfErrorElem).is(":visible"))return void(fieldType===ZFFieldTypeConstants.EMAIL||fieldType===ZFFieldTypeConstants.NUMBER||fieldType===ZFFieldTypeConstants.DECIMAL||fieldType===ZFFieldTypeConstants.CURRENCY?$(parentElem).find("span[elname=livefield-reconf-elem]").find("input").focus():$(parentElem).find("div[elname=confPhoneFld]").find("input").focus())}}var errInpElem=parentElem.find(":input[type!=hidden]:first");typeof errInpElem!=ResponseKey.UNDEFINED&&$(errInpElem).is("select")&&isiOSMobileBrowser()?$(errInpElem).parent().focus():$(errInpElem).focus(),setFocusForFirstElemAccessibility(parentElem,fieldType)}}}}function setNeedDataForPrevPage(prevPageNum,currPage){prevPageNum=parseInt(prevPageNum)+1;var formBodyDiv=$("#formBodyDiv"),needToCallPrefill=!1;if(isAdvancedRule()){for(var needAdvRulesToBeExecuted=!1;prevPageNum800){var fieldElems=isStandardForm()?$(pageUl).find('div[elemtype="subFormField"][needToResetWidth="true"]'):$(pageUl).find('li[elemtype="subFormField"][needToResetWidth="true"]');$(fieldElems).each(function(index,elem){var isFldVisible=$(this).is(":visible");isFldVisible||$(this).show();var widthModificationRatioValue=(formWidth-72)/728,subFormLabelDiv=$(this).find('[elname="subFormLabelDiv"]'),isSfSummaryPresent=!1,sfSummaryDiv=$(elem).find('[elname="sfSummaryDiv"]');$(sfSummaryDiv).length>0&&(isSfSummaryPresent=!0);var subFormLabelDivFlds=isStandardForm()?$(subFormLabelDiv).find("div[elname=livefield-elem]"):$(subFormLabelDiv).find("li");$(subFormLabelDivFlds).each(function(liIndex,liElem){if($(this).attr("compname")){var actualCompName=$(this).attr("compname").slice(6),elemToAdjWidth=$(liElem).find("label");if(elemToAdjWidth.length>0){var newWidth=$(elemToAdjWidth).width()*widthModificationRatioValue;if(elemToAdjWidth.width(newWidth),isSfSummaryPresent){var summaryElem=isStandardForm()?$(sfSummaryDiv).find('div[linkname="sum_'+actualCompName+'"]'):$(sfSummaryDiv).find('li[linkname="sum_'+actualCompName+'"]');$(summaryElem).find("label").width(newWidth)}if(isStandardForm()?$(elem).find('div[linkname="'+actualCompName+'"]').find("div.tempContDiv").width(newWidth):$(elem).find('li[linkname="'+actualCompName+'"]').find("div.tempContDiv").width(newWidth),"5"==$(this).attr("comptype")||"16"==$(this).attr("comptype")){var newWidthForInput=newWidth-24;$(elem).find('li[linkname="'+actualCompName+'"]').find("input").css("width",newWidthForInput)}if("4"==$(this).attr("comptype")){newWidthForInput=newWidth-39;$(elem).find('li[linkname="'+actualCompName+'"]').find("input").css("width",newWidthForInput)}"25"==$(this).attr("comptype")&&$(elem).find('li[linkname="'+actualCompName+'"][elname=livefield-elem]').find("canvas").attr("width",$(elem).find('li[linkname="'+actualCompName+'"][elname=livefield-elem]').find("div[elname=signContainer]").parent().width())}}}),isFldVisible||$(this).hide(),$(this).attr("needToResetWidth","false")})}}function selectPage(pageNo){if(isStandardForm())selectPageNavBar(pageNo);else{var navigBar=$("#navigBar");navigBar.attr("currentPage",pageNo);var navigType=navigBar.attr("navigtype"),tr=navigBar.find("tr:first");if(tr.find("td").addClass("unselected"),tr.find("td").removeClass("selected currentPTab"),1==navigType){for(var count=2*pageNo,i=0;i1?60*Number(hourAndMinute[0])*60*1e3+60*Number(hourAndMinute[1])*1e3:0}function splitMeridianAndGetTime(value){return value.split(" ").length>1?ZFUtil.getRailwayTime(value):value}function isValidDateTimeForFormula(operand,dateFormat){return"string"==typeof operand&&operand.indexOf(" ")>1&&ZFUtil.validateDateTime(operand,dateFormat)}function isValideTimeForFormula(operand){return"string"==typeof operand&&ZFUtil.validateTimeFormat(operand,2)}function roundTheValueInFormula(valueToBeRounded,roundOfType){return roundOfType==DateCalculationType.ROUNDUP?Math.ceil(valueToBeRounded):roundOfType==DateCalculationType.ROUNDDOWN?Math.floor(valueToBeRounded):roundOfType==DateCalculationType.ROUND?Math.round(valueToBeRounded):valueToBeRounded}function getAgeInFormula(dateofBirth){if(0!=dateofBirth){var splitLeftDate=splitDateElementForDDMMYYYYFormat(dateofBirth.split(" ")[0]),dobdate=new Date(splitLeftDate[2],splitLeftDate[1],splitLeftDate[0]),splitRightDate=splitDateElementForDDMMYYYYFormatForformulaCurrentDate(),today=new Date(splitRightDate[2],splitRightDate[1],splitRightDate[0]),age=today.getFullYear()-dobdate.getFullYear();return age>0?today.getMonth()>dobdate.getMonth()?age:today.getMonth()==dobdate.getMonth()?today.getDate()maxLen)return errMsg=1===maxLen?ZFLiveErrorConstants.maxonecharlimit:ZFLiveErrorConstants.maxcharlimit.replace("{0}",maxLen.toString()),comptype==ZFFieldTypeConstants.EMAIL&&hideFieldReConfErr(compname),$(errorIdd).text(errMsg),!1}else if(dataSpecJson[DataSpecConst.RANGE_TYPE]===RangeProperty.WORDS&&comptype==ZFFieldTypeConstants.MULTI_LINE){var errMsg,wordArr=$.trim($(elem).find("textarea").val()).match(/\S+/g);if((inputLength=null!==wordArr?wordArr.length:0)maxLen)return errMsg=1===maxLen?ZFLiveErrorConstants.maxonewordlimit:ZFLiveErrorConstants.maxwordlimit.replace("{0}",maxLen.toString()),$(errorIdd).text(errMsg),!1}return!0}function hideFieldReConfErr(compname){var reconfCompname=compname+"-reconf",reconfErrorId=ZFLive.errorId(reconfCompname);"none"!=$(reconfErrorId).css("display")&&$(reconfErrorId).hide()}function formatDecimalValue(elem,comptype,compname){if(validateCurrencyWithoutFormat(elem)){var decimalFormat=$(elem).attr("decimalformat"),inputVal=$.trim($(elem).find("input").val()),reFormattedVal=$.trim(ZFUtil.getReformattedDecimal(inputVal,decimalFormat)),formattedVal=ZFUtil.getFormattedDecimal(reFormattedVal,decimalFormat);comptype==ZFFieldTypeConstants.DECIMAL?$(elem).find('input[name="'+compname+'"]').val(formattedVal):comptype==ZFFieldTypeConstants.CURRENCY?$(elem).find('input[name="'+compname+'"]').val(formattedVal):$(elem).find("input").val(formattedVal)}}function setSfTotalValForSlider(compName){setSfTotalVal(isStandardForm()?$('div[elname=livefield-elem][compname="'+compName+'"]'):$('li[elname=livefield-elem][compname="'+compName+'"]'))}function setSfTotalVal(elem){var parentElname=(isStandardForm()?$(elem).closest("div[elname=subFormFieldsUl]"):$(elem).closest("ul")).attr("elname");if(void 0!==parentElname&&"subFormFieldsUl"==parentElname){var sfLi=isStandardForm()?$(elem).closest('div[elemtype="subFormField"]'):$(elem).closest('li[elemtype="subFormField"]');if($(sfLi).length>0&&"true"==$(sfLi).attr("show_summary")){var comptype=parseInt($(elem).attr("comptype"));comptype!==ZFFieldTypeConstants.NUMBER&&comptype!==ZFFieldTypeConstants.DECIMAL&&comptype!==ZFFieldTypeConstants.CURRENCY&&comptype!==ZFFieldTypeConstants.FORMULA&&comptype!==ZFFieldTypeConstants.SLIDER||setValueForSummary($(sfLi),$(elem))}}}function initializeSFSummary(){var fields=isStandardForm()?$("#formBodyDiv").find('div[elemtype="subFormField"][show_summary=true]'):$("#formBodyDiv").find('li[elemtype="subFormField"][show_summary=true]');$(fields).each(function(idx,sfLi){resetSFSummary($(sfLi))})}function setValueInFldLabel(compname,val,isFromOnLoad,comptype,needData){var allowDynFldPrefill=!0;if(ZFLive.prefillFieldsListChangedManually==undefined&&(ZFLive.prefillFieldsListChangedManually={}),isFromOnLoad?allowDynFldPrefill=!isFieldPrefilledByUrl(compname):addFieldPrefilledByUrlChangedManually(compname),allowDynFldPrefill){val!=undefined&&""!==val.trim()&&needData||(val="___");var prefillStr="setlabel_"+compname,prefillSpan=getFormBodyDiv().find("span[elname="+prefillStr+"]");if($(prefillSpan).hide().text(val).fadeIn("fast"),comptype!=undefined&&comptype==ZFFieldTypeConstants.WEBSITE){var prefillATag=getFormBodyDiv().find("a[elname="+prefillStr+"]");prefillATag!=undefined&&$(prefillATag).length>0&&(ZFUtil.validateLiveUrl(val)?ZFUtil.checkUrlStartWithProtocol(val)?$(prefillATag).hide().attr("href",val).text(val).fadeIn("fast"):$(prefillATag).hide().attr("href",LocationProtocols.HTTP+"://"+val).text(val).fadeIn("fast"):$(prefillATag).hide().removeAttr("href").text("___").fadeIn("fast"))}if(isOneFieldForm()&&ZFLive.onefldSidePanelEn){var quickViewList=$("#quickViewFieldsList");$(prefillSpan).each(function(index,elem){var parentElem=$(elem).closest("div[elname=livefield-elem][reltype=parent]"),parentCompName=$(parentElem).attr("compname");if(typeof parentCompName!=ResponseKey.UNDEFINED){var advLabel=$(parentElem).find("span.fieldLabelTxt:first").text();typeof advLabel!=ResponseKey.UNDEFINED&&quickViewList.find("li[elemname="+parentCompName+"]").text(advLabel)}})}triggerFormResizeOnTimeOut()}}function isAllowedFldTypeForPrefillLabel(fldType){return fldType==ZFFieldTypeConstants.SINGLE_LINE||fldType==ZFFieldTypeConstants.NUMBER||fldType==ZFFieldTypeConstants.ADDRESS||fldType==ZFFieldTypeConstants.NAME||fldType==ZFFieldTypeConstants.DROPDOWN||fldType==ZFFieldTypeConstants.RADIO||fldType==ZFFieldTypeConstants.EMAIL||fldType==ZFFieldTypeConstants.WEBSITE||fldType==ZFFieldTypeConstants.PHONE||fldType==ZFFieldTypeConstants.DATE||fldType==ZFFieldTypeConstants.MONTHYEAR||fldType==ZFFieldTypeConstants.DATETIME||fldType==ZFFieldTypeConstants.TIME||fldType==ZFFieldTypeConstants.CURRENCY||fldType==ZFFieldTypeConstants.SLIDER||fldType==ZFFieldTypeConstants.RATING||fldType==ZFFieldTypeConstants.FORMULA||fldType==ZFFieldTypeConstants.DECIMAL}function isFieldPrefilledByUrl(compname){if(ZFLive.prefillFieldsList!=undefined){if(isFieldPrefilledByUrlChangedManually(compname))return!1;for(var fldsArr=JSON.parse(ZFLive.prefillFieldsList),index=0;index0&&$(matrixFldElem).each(function(index,elem){if(!$(elem).find("p[elname=error]").is(":visible")){var inptElem=$(elem).find("input");$(inptElem).removeAttr("isLastError"),removeMatrixError(inptElem,!0)}})}function inputAddedToField(elem,comptype,fromClientValidation){if(comptype==ZFFieldTypeConstants.SINGLE_LINE||comptype==ZFFieldTypeConstants.DECIMAL||comptype==ZFFieldTypeConstants.NUMBER||comptype==ZFFieldTypeConstants.CURRENCY||comptype==ZFFieldTypeConstants.DATE||comptype==ZFFieldTypeConstants.MONTHYEAR||comptype==ZFFieldTypeConstants.DATETIME||comptype==ZFFieldTypeConstants.WEBSITE)return $.trim($(elem).find("input").val()).length>0;if(comptype==ZFFieldTypeConstants.MULTI_LINE)return $.trim($(elem).find("textarea").val()).length>0;if(comptype==ZFFieldTypeConstants.PHONE){var hasNoInput=!0;return $(elem).find("div[elname=phoneFld]").find("input").each(function(inde,elemnew){return hasNoInput=0===$.trim($(elemnew).val()).length}),!hasNoInput}if(comptype==ZFFieldTypeConstants.EMAIL)return $.trim($(elem).find("input:first").val()).length>0;if(comptype==ZFFieldTypeConstants.MATRIX_CHOICE){if(!fromClientValidation)return"true"!=$(elem).attr("mandatory")||checkMandatoryMatrixChoice(elem,!1)}else if(comptype==ZFFieldTypeConstants.ADDRESS){if($(elem).attr("statefldtype")==AddrStateFldInputType.DROPDOWN){var complink=$(elem).attr("linkname")+ZFFormField.ADDRESS.STATE.KEY,stateDd=$(elem).find("select[complink = "+complink+"]"),isPrevVal=$(stateDd).find("option:selected").attr("isprevval");if(typeof isPrevVal!=ResponseKey.UNDEFINED&&"true"==isPrevVal)return!0}}return!1}function needConf(elem){var needReconf=$(elem).attr("need_reconf");return typeof needReconf!=ResponseKey.UNDEFINED&&"true"==needReconf}function needToValidatePhone(compname,toCompareElname){var needToValidate=!1;if(getDocumentActiveLiElementCompName()===compname){var closestDivElname=$(document.activeElement).closest("div[name=phone-elements]").attr("elname");typeof closestDivElname!=undefined&&closestDivElname==toCompareElname&&(needToValidate=!0)}else needToValidate=!0;return needToValidate}function validateConstrLiElem(elem,compname,errorIdd,inputElem){var constrJson=ZFLive.constraintJson,linkname=$(elem).attr("linkname"),comptype=parseInt($(elem).attr("comptype")),ismandatory=$(elem).attr("mandatory"),isInputAddedToField=inputAddedToField(elem,comptype,!0),matrixMandatory=!1;if("true"==ismandatory)if(comptype===ZFFieldTypeConstants.SINGLE_LINE||comptype===ZFFieldTypeConstants.MULTI_LINE||comptype===ZFFieldTypeConstants.NUMBER||comptype===ZFFieldTypeConstants.CURRENCY||comptype===ZFFieldTypeConstants.DECIMAL||comptype===ZFFieldTypeConstants.DATE||comptype===ZFFieldTypeConstants.DATETIME||comptype===ZFFieldTypeConstants.EMAIL||comptype===ZFFieldTypeConstants.WEBSITE||comptype===ZFFieldTypeConstants.PHONE||comptype===ZFFieldTypeConstants.MONTHYEAR){if(!isInputAddedToField){if(comptype==ZFFieldTypeConstants.DATE)return $(errorIdd).text(ZFLiveErrorConstants.datemandatoryerror),!1;if(comptype==ZFFieldTypeConstants.MONTHYEAR)return $(errorIdd).text(ZFLiveErrorConstants.monthyearmandatoryerror),!1;if(comptype===ZFFieldTypeConstants.DATETIME)return $(errorIdd).text(ZFLiveErrorConstants.datemandatoryerror),!1;if(comptype===ZFFieldTypeConstants.PHONE){var fldDiv=$(elem).find("div[elname=phoneFormatElem]"),phoneFormat=$(fldDiv).attr("phoneFormat");return this.hideFieldReConfErr(compname),phoneFormat===ZFPhoneFormatConstants.USAFORMAT?(setTimeout(function(){needToValidatePhone(compname,"confPhoneFld")&&($(errorIdd).text(ZFLiveErrorConstants.mandatoryerrornumber),showWarningErrorMsg(elem,errorIdd,compname),isSfChild(elem)&&clearSFUniqueError(elem))},0),undefined):($(errorIdd).text(ZFLiveErrorConstants.mandatoryerrornumber),!1)}if(comptype===ZFFieldTypeConstants.NUMBER||comptype===ZFFieldTypeConstants.DECIMAL||comptype===ZFFieldTypeConstants.CURRENCY){var reconfCompname=compname+"-reconf",reconfErrorId=ZFLive.errorId(reconfCompname);return $(reconfErrorId).is(":visible")&&$(reconfErrorId).hide(),addFieldToErrTrackFieldList(elem),checkAndAddFieldToGridErrTrackFieldList(elem),$(errorIdd).text(ZFLiveErrorConstants.mandatoryerrornumber),!1}if(comptype===ZFFieldTypeConstants.EMAIL){reconfCompname=compname+"-reconf",reconfErrorId=ZFLive.errorId(reconfCompname);return $(reconfErrorId).is(":visible")&&$(reconfErrorId).hide(),$(errorIdd).text(ZFLiveErrorConstants.mandatoryerror),addFieldToErrTrackFieldList(elem),checkAndAddFieldToGridErrTrackFieldList(elem),!1}return $(errorIdd).text(ZFLiveErrorConstants.mandatoryerror),!1}}else if(comptype===ZFFieldTypeConstants.NAME||comptype===ZFFieldTypeConstants.ADDRESS){if(!checkMandatoryForCompositeElem(elem,comptype,!1))return setTimeout(function(){var documentActElem=document.activeElement,select2List=$(documentActElem).closest("span.select2FormList");if(typeof select2List!==ResponseKey.UNDEFINED&&select2List.length>0){var select2UL=$(select2List).find("ul:first");$(select2UL).attr("id").split("-")[1].split("_")[0]!==compname&&($(errorIdd).text(ZFLiveErrorConstants.mandatoryerror),showWarningErrorMsg(elem,errorIdd,compname))}else{getDocumentActiveLiElementCompName()!==compname&&($(errorIdd).text(ZFLiveErrorConstants.mandatoryerror),showWarningErrorMsg(elem,errorIdd,compname))}},0),undefined}else comptype===ZFFieldTypeConstants.MATRIX_CHOICE&&(matrixMandatory=!checkMandatoryMatrixChoice(elem,!1))&&setTimeout(function(){if(getDocumentActiveLiElementCompName()!==compname){var rowMandatoryType=$(elem).attr("row_mandatory_type"),columnMandatoryType=$(elem).attr("column_mandatory_type");rowMandatoryType==MatrixMandatoryType.ALL_MANDATORY&&columnMandatoryType==MatrixMandatoryType.NO_MANDATORY?$(errorIdd).text(ZFLiveErrorConstants.matrixchoicetextboxmandatory):rowMandatoryType!=MatrixMandatoryType.NO_MANDATORY&&$(errorIdd).text(ZFLiveErrorConstants.matrixchoicecustomtextboxmandatory),removeMatrixError($(elem).find("input"),!0),isMatrixChoiceRangeErrAvailableAfterClientValidation(errorIdd)?checkMandatoryMatrixChoice(elem,!0):isOneFieldForm()?showWarningErrorMsgOF(elem,errorIdd):showWarningErrorMsg(elem,errorIdd,compname)}},0);if(isInputAddedToField||comptype===ZFFieldTypeConstants.MATRIX_CHOICE||comptype===ZFFieldTypeConstants.NAME){if(typeof constrJson[linkname]!==ResponseKey.UNDEFINED){var dataSpecJson=constrJson[linkname];if(comptype==ZFFieldTypeConstants.SINGLE_LINE){var isValidationSuccess=rangeValidationForTextFields(elem,errorIdd,dataSpecJson,comptype,compname),patternJson=dataSpecJson[DataSpecConst.PATTERN.KEY];return isValidationSuccess&&!$.isEmptyObject(patternJson)?regexValidationForSingleLineField(elem,errorIdd,patternJson,comptype,compname):isValidationSuccess}if(comptype==ZFFieldTypeConstants.MULTI_LINE)return rangeValidationForTextFields(elem,errorIdd,dataSpecJson,comptype,compname);if(comptype===ZFFieldTypeConstants.NUMBER){if(validateNumber(elem)){var inputVal=$.trim($(elem).find("input").val());return rangeValidForNumDeciCurrFld(elem,dataSpecJson,inputVal,errorIdd,comptype)}return hideFieldReConfErr(compname),$(errorIdd).text(ZFLiveErrorConstants.numbererror),addFieldToErrTrackFieldList(elem),checkAndAddFieldToGridErrTrackFieldList(elem),!1}if(comptype===ZFFieldTypeConstants.DECIMAL||comptype==ZFFieldTypeConstants.CURRENCY){inputVal=$.trim($(elem).find("input").val());if(decimLenFormValidation(elem,errorIdd,comptype)){var decimalFormat=$(elem).attr("decimalformat");return inputVal=$.trim(ZFUtil.getReformattedDecimal(inputVal,decimalFormat)),rangeValidForNumDeciCurrFld(elem,dataSpecJson,inputVal,errorIdd,comptype)}return hideFieldReConfErr(compname),$(errorIdd).text(ZFLiveErrorConstants.decimalerror),addFieldToErrTrackFieldList(elem),checkAndAddFieldToGridErrTrackFieldList(elem),!1}if(comptype==ZFFieldTypeConstants.DATE)return rangeValidationForDate(elem,dataSpecJson,errorIdd,comptype);if(comptype==ZFFieldTypeConstants.MONTHYEAR)return rangeValidationForMonthYear(elem,dataSpecJson,errorIdd);if(comptype==ZFFieldTypeConstants.DATETIME)return rangeValidationForDateTime(elem,dataSpecJson,errorIdd,comptype);if(comptype==ZFFieldTypeConstants.EMAIL){var emailErrArray=new Array;return validateEmail(elem,compname,emailErrArray)?rangeValidationForTextFields(elem,errorIdd,dataSpecJson,comptype,compname):(hideFieldReConfErr(compname),$(errorIdd).text(emailErrArray[0]),addFieldToErrTrackFieldList(elem),checkAndAddFieldToGridErrTrackFieldList(elem),!1)}if(comptype==ZFFieldTypeConstants.MATRIX_CHOICE)return setTimeout(function(){needMatrixRangeValidation(elem,compname,matrixMandatory)?isMatrixChoiceRangeErrAvailableAfterClientValidation(errorIdd)?(rangeValidationForMatrixChoiceFields(elem,errorIdd,dataSpecJson,undefined)?($(errorIdd).removeClass("rangeError"),isOneFieldForm()?animateHideErrorMsgOF(errorIdd):($(errorIdd).hide(),addErrorForAccessibility(compname,!1))):($(errorIdd).addClass("rangeError"),isOneFieldForm()?animateErrorMsgOF(errorIdd):animateErrorMsg(errorIdd)),$(elem).removeClass("error")):getDocumentActiveLiElementCompName()!==compname?rangeValidationForMatrixChoiceFields(elem,errorIdd,dataSpecJson,undefined)?isOneFieldForm()?animateHideErrorMsgOF(errorIdd):($(errorIdd).hide(),addErrorForAccessibility(compname,!1)):isOneFieldForm()?animateErrorMsgOF(errorIdd):animateErrorMsg(errorIdd):rangeValidationForMatrixChoiceFields(elem,errorIdd,dataSpecJson,inputElem):matrixMandatory||removeErrorFromLiElem(elem)},0),undefined;if(comptype==ZFFieldTypeConstants.PHONE){fldDiv=$(elem).find("div[elname=phoneFormatElem]"),phoneFormat=$(fldDiv).attr("phoneFormat"),ismandatory=$(elem).attr("mandatory"),reconfCompname=compname+"-reconf";return $(reconfCompname).hide(),setTimeout(function(){if(needToValidatePhone(compname,"confPhoneFld"))if(validatePhoneField(elem,errorIdd,ismandatory)&&phoneLengthCheck(elem,errorIdd,dataSpecJson)){$(document.activeElement).parents("div[name=phone-elements]").attr("elname");$(errorIdd).removeClass("rangeError").removeClass("warningMessage"),$(elem).find("p[elname=error]").hide();var reconf_input=$(elem).find("div[elname=confPhoneFld]").find("input");needConf(elem)&&$.trim($(reconf_input).val()).length>0?ZFLive.checkPhFldIdentical(elem,compname,!0,!1)?isSfChild(elem)?validateSFUniqueness(elem):removeErrorFromLiElem(elem):isSfChild(elem)&&clearSFUniqueError(elem):isSfChild(elem)?validateSFUniqueness(elem):removeErrorFromLiElem(elem)}else hideFieldReConfErr(compname),showWarningErrorMsg(elem,errorIdd,compname),isSfChild(elem)&&clearSFUniqueError(elem);else isSfChild(elem)&&validateSFUniqueness(elem)},0),undefined}}else if(comptype==ZFFieldTypeConstants.ADDRESS){var complink=(linkname=$(elem).attr("linkname"))+ZFFormField.ADDRESS.STATE.KEY;if($(elem).attr("statefldtype")==AddrStateFldInputType.DROPDOWN){var stateDd=$(elem).find("select[complink="+complink+"]"),isPrevVal=$(stateDd).find("option:selected").attr("isprevval");if(typeof isPrevVal!=ResponseKey.UNDEFINED&&"true"==isPrevVal){var validStateOptionNotPrevVal,stateDropdownPrevVal=$(stateDd).find("option:selected").attr("lwrvalue");return $(stateDd).find("option").each(function(optionIdx,option){$(option).attr("lwrvalue")==stateDropdownPrevVal&&"true"!=$(option).attr("isprevval")&&(validStateOptionNotPrevVal=$(option))}),0==$(validStateOptionNotPrevVal).length&&setTimeout(function(){var documentActElem=document.activeElement,select2List=$(documentActElem).closest("span.select2FormList");if(typeof select2List!==ResponseKey.UNDEFINED&&select2List.length>0){var select2UL=$(select2List).find("ul:first");$(select2UL).attr("id").split("-")[1].split("_")[0]!==compname&&($(errorIdd).text(ZFLiveErrorConstants.invalid_state_value),showWarningErrorMsg(elem,errorIdd,compname))}else{getDocumentActiveLiElementCompName()!==compname&&($(errorIdd).text(ZFLiveErrorConstants.invalid_state_value),showWarningErrorMsg(elem,errorIdd,compname))}},0),undefined}}}else if(comptype==ZFFieldTypeConstants.WEBSITE){if(!ZFUtil.validateLiveUrl($(elem).find("input").val()))return $(errorIdd).text(ZFLiveErrorConstants.urlerror),!1}else if(comptype==ZFFieldTypeConstants.NAME){var regexType=parseInt($(elem).attr("regex_type"));if(regexType!=FieldRegexTypes.NONE&&!isRegexValidationSuccess(elem,errorIdd,regexType,!1))return undefined}}else comptype==ZFFieldTypeConstants.PHONE&&needConf(elem)&&ZFLive.checkPhFldIdentical(elem,compname,!0,!1);return!0}function checkIfPrevValSelectedInAddrStateDd(elem,showErrorBorder){var complink=$(elem).attr("linkname")+ZFFormField.ADDRESS.STATE.KEY,stateDd=$(elem).find("select[complink = "+complink+"]"),isprevVal=$(stateDd).find("option:selected").attr("isprevval");if(typeof isprevVal!=ResponseKey.UNDEFINED&&"true"==isprevVal){var validStateOptionNotPrevVal,stateDropdownPrevVal=$(stateDd).find("option:selected").attr("lwrvalue");if($(stateDd).find("option").each(function(optionIdx,option){$(option).attr("lwrvalue")==stateDropdownPrevVal&&"true"!=$(option).attr("isprevval")&&(validStateOptionNotPrevVal=$(option))}),0==$(validStateOptionNotPrevVal).length)return showErrorBorder&&(isNewHtmlDOM()?$(stateDd).parent().addClass("error1"):$(stateDd).parent().parent().addClass("error1")),!1}return!0}function removePrevValOptionIfItExistsInAddrStateDd(stateDropdown){var prevValOption=$(stateDropdown).find("option[isprevval=true]");$(prevValOption).length>0&&$(prevValOption).remove()}function updateStateDdInAddrStateDd(countryCodeVal,stateDropdown){if(clearAddrStateDropdown(null,stateDropdown),typeof ZFLive.addressStateList[countryCodeVal]!=ResponseKey.UNDEFINED&&ZFLive.addressStateList[countryCodeVal].length>0){doTextTransformAndAppendToAddrStateDd(countryCodeVal,stateDropdown);var validStateOptionNotPrevVal,stateDropdownPrevVal=$(stateDropdown).find("option:selected[isprevval=true]").val();if(typeof stateDropdownPrevVal!=ResponseKey.UNDEFINED&&""!=stateDropdownPrevVal)stateDropdownPrevVal=stateDropdownPrevVal.toLowerCase(),$(stateDropdown).find("option").each(function(optionIdx,option){$(option).attr("lwrvalue")==stateDropdownPrevVal&&"true"!=$(option).attr("isprevval")&&(validStateOptionNotPrevVal=$(option))}),$(validStateOptionNotPrevVal).length>0&&($(validStateOptionNotPrevVal).attr("selected",!0).trigger("change.select2"),$(stateDropdown).find("option[isprevval=true]").remove());else $(stateDropdown).val("-Select-").trigger("change.select2")}}function doTextTransformAndAppendToAddrStateDd(countryCodeVal,stateDropdown){var newOption,lielem=$(stateDropdown).closest("[elname=livefield-elem]"),textTransformType=$(lielem).attr("casetype");$.each(ZFLive.addressStateList[countryCodeVal],function(key,state){if(1==textTransformType)newOption=new Option(state.toLowerCase(),state.toLowerCase());else if(2==textTransformType)newOption=new Option(state.toUpperCase(),state.toUpperCase());else if(3==textTransformType){var optionValue=changeCapitalizeCase(state);newOption=new Option(optionValue,optionValue)}else newOption=new Option(state,state);$(newOption).attr("lwrvalue",state.toLowerCase()),$(stateDropdown).append(newOption)})}function clearAddrStateDropdown(inputElem,stateDropdown){if(null==stateDropdown){var elem=$(inputElem).closest('[elname="livefield-elem"]'),linkname=$(elem).attr("linkname");stateDropdown=$(elem).find("select[complink="+linkname+ZFFormField.ADDRESS.STATE.KEY+"]")}$(stateDropdown).find("option[isprevval!='true'][value!='-Select-']").remove()}function phoneLengthCheck(elem,errorIdd,dataSpecJson){var numOfDigits=0;if($(elem).find("div[elname=phoneFormatElem]").attr("phoneFormat")==ZFPhoneFormatConstants.INTERNATIONAL){if($(elem).find("div[elname=phoneFld]").find("input").each(function(indexelem,inpElem){numOfDigits+=getNumberOfDigitsInString($.trim($(inpElem).val()))}),numOfDigitsdataSpecJson[DataSpecConst.MAX_LEN])return $(errorIdd).text(ZFLiveErrorConstants.maxdigitslimit.replace("{0}",dataSpecJson[DataSpecConst.MAX_LEN])),addFieldToErrTrackFieldList(elem),checkAndAddFieldToGridErrTrackFieldList(elem),!1}return!0}function rangeValidationForDate(elem,dataSpecJson,errorIdd,comptype){var inpVal=$.trim($(elem).find("input").val()),dateFormat=$("#zf_date_format").val(),dateLocale=$("#zf_date_format").attr("dateLocale"),clientDateFormat=$(elem).find("div[elname][datelocale]").attr("elname");if(!(ZFUtil.validateDate(inpVal,dateFormat,dateLocale)&&inpVal.length>0))return $(errorIdd).text(ZFLiveErrorConstants.invaliddate),!1;var dynamicMaxJson=dataSpecJson[DataSpecConst.MAX_LIMIT],dynamicMinJson=dataSpecJson[DataSpecConst.MIN_LIMIT],dateElem=ZFUtil.splitDateVal(inpVal,dateFormat,dateLocale),userDate=new Date(dateElem[2],dateElem[1],dateElem[0]),dateRangeType=dataSpecJson[DataSpecConst.TYPE];if("2"==dateRangeType){var limitDateElem=getCurrentDateElemForLimit(dateFormat,dateLocale),limitDate=new Date(limitDateElem[2],limitDateElem[1],limitDateElem[0]);if(typeof dataSpecJson[DataSpecConst.INCLUDE_TODAY]==ResponseKey.UNDEFINED||dataSpecJson[DataSpecConst.INCLUDE_TODAY]||limitDate.setDate(limitDate.getDate()-1),(dayDiff=ZFUtil.getDateDiff(userDate,limitDate))<0){var errMsg=ZFLiveErrorConstants.maxdatelimit.replace("{0}",convertJsDateTimeToNormal(limitDate,dateFormat,dateLocale,!1));return $(errorIdd).text(errMsg),!1}}else if("3"==dateRangeType){limitDateElem=getCurrentDateElemForLimit(dateFormat,dateLocale),limitDate=new Date(limitDateElem[2],limitDateElem[1],limitDateElem[0]);if(typeof dataSpecJson[DataSpecConst.INCLUDE_TODAY]==ResponseKey.UNDEFINED||dataSpecJson[DataSpecConst.INCLUDE_TODAY]||limitDate.setDate(limitDate.getDate()+1),(dayDiff=ZFUtil.getDateDiff(limitDate,userDate))<0){errMsg=ZFLiveErrorConstants.mindatelimit.replace("{0}",convertJsDateTimeToNormal(limitDate,dateFormat,dateLocale,!1));return $(errorIdd).text(errMsg),!1}}else if("4"==dateRangeType){limitDateElem=getCurrentDateElemForLimit(dateFormat,dateLocale),limitDate=new Date(limitDateElem[2],limitDateElem[1],limitDateElem[0]);if(typeof(dayDiff=ZFUtil.getDateDiff(limitDate,userDate))!=ResponseKey.UNDEFINED&&0!=dayDiff){errMsg=ZFLiveErrorConstants.mindatelimit.replace("{0}",convertJsDateTimeToNormal(limitDate,dateFormat,dateLocale,!1));return $(errorIdd).text(errMsg),!1}}else{var dateLocaleConvertedLimit;if("5"==dateRangeType||"7"==dateRangeType)if(typeof dataSpecJson[DataSpecConst.FROM_DATE]!==ResponseKey.UNDEFINED){if(dateComparision(inpVal,dateLocaleConvertedLimit=ZFUtil.getCurrentDateInLocale(dataSpecJson[DataSpecConst.FROM_DATE],clientDateFormat,dateLocale),dateFormat,dateLocale)){errMsg=ZFLiveErrorConstants.mindatelimit.replace("{0}",dateLocaleConvertedLimit);return $(errorIdd).text(errMsg),!1}}else if(typeof dataSpecJson[DataSpecConst.MIN_LIMIT]!==ResponseKey.UNDEFINED){var minDate=getDateLimit(elem,dynamicMinJson,dateFormat,dateLocale,dataSpecJson[DataSpecConst.DISABLED_DAYS]);if(typeof minDate!=ResponseKey.UNDEFINED)if((dayDiff=ZFUtil.getDateDiff(minDate,userDate))<0){errMsg=ZFLiveErrorConstants.mindatelimit.replace("{0}",convertJsDateTimeToNormal(minDate,dateFormat,dateLocale,!1));return $(errorIdd).text(errMsg),!1}}if("6"==dateRangeType||"7"==dateRangeType)if(typeof dataSpecJson[DataSpecConst.TO_DATE]!==ResponseKey.UNDEFINED){if(dateComparision(dateLocaleConvertedLimit=ZFUtil.getCurrentDateInLocale(dataSpecJson[DataSpecConst.TO_DATE],clientDateFormat,dateLocale),inpVal,dateFormat,dateLocale)){errMsg=ZFLiveErrorConstants.maxdatelimit.replace("{0}",dateLocaleConvertedLimit);return $(errorIdd).text(errMsg),!1}}else if(typeof dataSpecJson[DataSpecConst.MAX_LIMIT]!==ResponseKey.UNDEFINED){var dayDiff,maxDate=getDateLimit(elem,dynamicMaxJson,dateFormat,dateLocale,dataSpecJson[DataSpecConst.DISABLED_DAYS]);if(typeof maxDate!=ResponseKey.UNDEFINED)if((dayDiff=ZFUtil.getDateDiff(userDate,maxDate))<0){errMsg=ZFLiveErrorConstants.maxdatelimit.replace("{0}",convertJsDateTimeToNormal(maxDate,dateFormat,dateLocale,!1));return $(errorIdd).text(errMsg),!1}}}if(typeof dataSpecJson[DataSpecConst.DISABLED_DAYS]!==ResponseKey.UNDEFINED){var disabledDays=dataSpecJson[DataSpecConst.DISABLED_DAYS];if(!ZFUtil.blockDays(userDate,disabledDays)[0]){errMsg=ZFLiveErrorConstants.disabledayslimit.replace("{0}",getDayName(userDate.getDay(),dateLocale));return $(errorIdd).text(errMsg),!1}}if(typeof ZFLive.formHolidays!==ResponseKey.UNDEFINED&&!ZFUtil.blockHolidays(userDate)[0]){errMsg=i18n.holidayerror;return $(errorIdd).text(errMsg),!1}return!0}function rangeValidationForDateTime(elem,dataSpecJson,errorIdd,comptype){var dateTime=$.trim($(elem).find("input").val()),dateFormat=$("#zf_date_format").val(),dateLocale=$("#zf_date_format").attr("dateLocale"),timeFormat=$(elem).attr("timeformat");if(!ZFUtil.validateDateTime(dateTime,dateFormat,dateLocale,timeFormat))return $(errorIdd).text(ZFLiveErrorConstants.invaliddatetime),!1;var jsDateTime=new Date(ZFUtil.convertToGeneralDateTime(dateTime,dateFormat,dateLocale,timeFormat)),dynamicMaxJson=dataSpecJson[DataSpecConst.DYNAMIC_TO_DATE],dynamicMinJson=dataSpecJson[DataSpecConst.DYNAMIC_FROM_DATE],splitDateTimeIndex=dateTime.indexOf(" ");if(timeFormat!=TimeFormat.HOURS_12.CODE||"dd-mmm-yyyy"!=dateFormat.toLowerCase()&&"dd-mmmm-yyyy"!=dateFormat.toLowerCase()&&"mmmm-dd-yyyy"!=dateFormat.toLowerCase()||(splitDateTimeIndex=ZFUtil.getSplitIndexofDateTime(dateTime)),ZFLive.isDateTimeAdvPropsEnabled){var dateRangeType=dataSpecJson[DataSpecConst.TYPE];if("2"==dateRangeType){var includeToday=dataSpecJson[DataSpecConst.INCLUDE_TODAY],allowPastTimeOnly=dataSpecJson[DateTimeSpecConst.ALLOW_PAST_TIME_ONLY];if(includeToday){var currentDateTime=ZFLive.currentDate;if(timeFormat==TimeFormat.HOURS_24.CODE&&(currentDateTime=changeTo24hrFormat(currentDateTime,dateLocale,dateRangeType)),allowPastTimeOnly){if(!compareDateTimeValues(dateTime,currentDateTime,dateFormat,dateLocale,timeFormat)){var errMsg=ZFLiveErrorConstants.maxdatetimebeforelimit.replace("{0}",currentDateTime);return $(errorIdd).text(errMsg),!1}}else{var currentDateWithFullTime=currentDateTime.substring(0,currentDateTime.indexOf(" "));if(timeFormat==TimeFormat.HOURS_12.CODE?currentDateWithFullTime=currentDateWithFullTime+" 11:59 "+CustomDateLocale[dateLocale].PM:currentDateWithFullTime+=" 23:59",compareDateTimeValues(currentDateWithFullTime,dateTime,dateFormat,dateLocale,timeFormat)){errMsg=ZFLiveErrorConstants.maxdatetimelimit.replace("{0}",currentDateWithFullTime);return $(errorIdd).text(errMsg),!1}}}else{var pastDate=ZFLive.pastDate;if(timeFormat==TimeFormat.HOURS_24.CODE&&(pastDate=changeTo24hrFormat(pastDate,dateLocale,dateRangeType)),compareDateTimeValues(pastDate,dateTime,dateFormat,dateLocale,timeFormat)){errMsg=ZFLiveErrorConstants.maxdatetimelimit.replace("{0}",pastDate);return $(errorIdd).text(errMsg),!1}}}else if("3"==dateRangeType){includeToday=dataSpecJson[DataSpecConst.INCLUDE_TODAY];var allowFutureTimeOnly=dataSpecJson[DateTimeSpecConst.ALLOW_FUTURE_TIME_ONLY];if(includeToday){currentDateTime=ZFLive.currentDate;if(timeFormat==TimeFormat.HOURS_24.CODE&&(currentDateTime=changeTo24hrFormat(currentDateTime,dateLocale)),allowFutureTimeOnly){if(!compareDateTimeValues(currentDateTime,dateTime,dateFormat,dateLocale,timeFormat)){errMsg=ZFLiveErrorConstants.mindatetimeafterlimit.replace("{0}",currentDateTime);return $(errorIdd).text(errMsg),!1}}else{currentDateWithFullTime=currentDateTime.substring(0,currentDateTime.indexOf(" "));if(timeFormat==TimeFormat.HOURS_12.CODE?currentDateWithFullTime=currentDateWithFullTime+" 12:00 "+CustomDateLocale[dateLocale].AM:currentDateWithFullTime+=" 00:00",compareDateTimeValues(dateTime,currentDateWithFullTime,dateFormat,dateLocale,timeFormat)){errMsg=ZFLiveErrorConstants.mindatetimelimit.replace("{0}",currentDateWithFullTime);return $(errorIdd).text(errMsg),!1}}}else{pastDate=ZFLive.futureDate;if(timeFormat==TimeFormat.HOURS_24.CODE&&(pastDate=changeTo24hrFormat(pastDate,dateLocale,dateRangeType)),compareDateTimeValues(dateTime,pastDate,dateFormat,dateLocale,timeFormat)){errMsg=ZFLiveErrorConstants.mindatetimelimit.replace("{0}",pastDate);return $(errorIdd).text(errMsg),!1}}}else if("4"==dateRangeType){allowPastTimeOnly=dataSpecJson[DateTimeSpecConst.ALLOW_PAST_TIME_ONLY],allowFutureTimeOnly=dataSpecJson[DateTimeSpecConst.ALLOW_FUTURE_TIME_ONLY],currentDateTime=ZFLive.currentDate;timeFormat==TimeFormat.HOURS_24.CODE&&(currentDateTime=changeTo24hrFormat(currentDateTime,dateLocale,dateRangeType));var startDateTime=currentDateTime.substring(0,currentDateTime.indexOf(" ")),endDateTime=currentDateTime.substring(0,currentDateTime.indexOf(" "));if(timeFormat==TimeFormat.HOURS_12.CODE?(startDateTime=startDateTime+" 12:00 "+CustomDateLocale[dateLocale].AM,endDateTime=endDateTime+" 11:59 "+CustomDateLocale[dateLocale].PM):(startDateTime+=" 00:00",endDateTime+=" 23:59"),allowPastTimeOnly?(endDateTime=currentDateTime,timeFormat==TimeFormat.HOURS_24.CODE&&(endDateTime=changeTo24hrFormat(currentDateTime,dateLocale))):allowFutureTimeOnly&&(startDateTime=currentDateTime,timeFormat==TimeFormat.HOURS_24.CODE&&(startDateTime=changeTo24hrFormat(currentDateTime,dateLocale))),allowPastTimeOnly){if(!compareDateTimeValues(dateTime,endDateTime,dateFormat,dateLocale,timeFormat)){errMsg=ZFLiveErrorConstants.maxdatetimebeforelimit.replace("{0}",endDateTime);return $(errorIdd).text(errMsg),!1}}else if(compareDateTimeValues(endDateTime,dateTime,dateFormat,dateLocale,timeFormat)){errMsg=ZFLiveErrorConstants.maxdatetimelimit.replace("{0}",endDateTime);return $(errorIdd).text(errMsg),!1}if(allowFutureTimeOnly){if(!compareDateTimeValues(startDateTime,dateTime,dateFormat,dateLocale,timeFormat)){errMsg=ZFLiveErrorConstants.mindatetimeafterlimit.replace("{0}",startDateTime);return $(errorIdd).text(errMsg),!1}}else if(compareDateTimeValues(dateTime,startDateTime,dateFormat,dateLocale,timeFormat)){errMsg=ZFLiveErrorConstants.mindatetimelimit.replace("{0}",startDateTime);return $(errorIdd).text(errMsg),!1}}else{if("5"==dateRangeType||"7"==dateRangeType){allowFutureTimeOnly=dataSpecJson[DateTimeSpecConst.ALLOW_FUTURE_TIME_ONLY];if(typeof dataSpecJson[DataSpecConst.FROM_DATE]!==ResponseKey.UNDEFINED){if(compareDateTimeValues(dateTime,fromDate=dataSpecJson[DataSpecConst.FROM_DATE],dateFormat,dateLocale,timeFormat)){errMsg=ZFLiveErrorConstants.mindatetimelimit.replace("{0}",fromDate);return $(errorIdd).text(errMsg),!1}}else if(typeof dataSpecJson[DataSpecConst.DYNAMIC_FROM_DATE]!==ResponseKey.UNDEFINED){if(typeof(minDateTime=ZFUtil.getDateTimeFromDynamicJson(elem,dynamicMinJson,dateFormat,dateLocale,"min",dataSpecJson[DataSpecConst.DISABLED_DAYS],allowFutureTimeOnly,timeFormat))!=ResponseKey.UNDEFINED&&minDateTime.getTime()>jsDateTime.getTime()){errMsg=ZFLiveErrorConstants.mindatelimit.replace("{0}",convertJsDateTimeToNormal(minDateTime,dateFormat,dateLocale,!0,timeFormat));return $(errorIdd).text(errMsg),!1}}}if("6"==dateRangeType||"7"==dateRangeType){allowPastTimeOnly=dataSpecJson[DateTimeSpecConst.ALLOW_PAST_TIME_ONLY];if(typeof dataSpecJson[DataSpecConst.TO_DATE]!==ResponseKey.UNDEFINED){if(compareDateTimeValues(toDate=dataSpecJson[DataSpecConst.TO_DATE],dateTime,dateFormat,dateLocale,timeFormat)){errMsg=ZFLiveErrorConstants.maxdatetimelimit.replace("{0}",toDate);return $(errorIdd).text(errMsg),!1}}else if(typeof dataSpecJson[DataSpecConst.DYNAMIC_TO_DATE]!==ResponseKey.UNDEFINED){if(typeof(maxDateTime=ZFUtil.getDateTimeFromDynamicJson(elem,dynamicMaxJson,dateFormat,dateLocale,"max",dataSpecJson[DataSpecConst.DISABLED_DAYS],allowPastTimeOnly,timeFormat))!=ResponseKey.UNDEFINED&&jsDateTime.getTime()>maxDateTime.getTime()){errMsg=ZFLiveErrorConstants.maxdatelimit.replace("{0}",convertJsDateTimeToNormal(maxDateTime,dateFormat,dateLocale,!0,timeFormat));return $(errorIdd).text(errMsg),!1}}}}if(typeof dataSpecJson[DateTimeSpecConst.MINUTES_INTERVAL]!=ResponseKey.UNDEFINED){var minutesInterval=dataSpecJson[DateTimeSpecConst.MINUTES_INTERVAL],minutes=dateTime.substring(splitDateTimeIndex+1).substring(3,5);if(1==minutesInterval){if(minutes%5!=0)return errMsg=(errMsg=(errMsg=i18n.invalidminuteintervalerrormessage.replace("{0}","00")).replace("{1}","05")).replace("{2}","55"),$(errorIdd).text(errMsg),!1}else if(2==minutesInterval){if(minutes%10!=0)return errMsg=(errMsg=(errMsg=i18n.invalidminuteintervalerrormessage.replace("{0}","00")).replace("{1}","10")).replace("{2}","50"),$(errorIdd).text(errMsg),!1}else if(3==minutesInterval){if(minutes%15!=0)return errMsg=(errMsg=(errMsg=i18n.invalidminuteintervalerrormessage.replace("{0}","00")).replace("{1}","15")).replace("{2}","45"),$(errorIdd).text(errMsg),!1}else if(4==minutesInterval&&minutes%30!=0){errMsg=i18n.invalidminuteintervalthirtyerrormessage;return $(errorIdd).text(errMsg),!1}}if(typeof dataSpecJson[DataSpecConst.DISABLED_DAYS]!==ResponseKey.UNDEFINED){var disabledDays=dataSpecJson[DataSpecConst.DISABLED_DAYS];if(!ZFUtil.blockDays(jsDateTime,disabledDays)[0]){errMsg=ZFLiveErrorConstants.disabledayslimit.replace("{0}",getDayName(jsDateTime.getDay(),dateLocale));return $(errorIdd).text(errMsg),!1}}if(typeof ZFLive.formHolidays!==ResponseKey.UNDEFINED)if(!ZFUtil.blockHolidays(jsDateTime)[0]){errMsg=i18n.holidayerror;return $(errorIdd).text(errMsg),!1}if(typeof dataSpecJson[DateTimeSpecConst.TIME_SLOTS]!==ResponseKey.UNDEFINED){var timeSlots=dataSpecJson[DateTimeSpecConst.TIME_SLOTS],type=timeSlots.type;if(type!=undefined){if(timeFormat==TimeFormat.HOURS_12.CODE&&(dateTime=changeTo24hrFormat(dateTime,dateLocale)),1==type)return compareTimeSlots(dateTime,(slots=timeSlots.slots)[0].start,slots[0].end,splitDateTimeIndex,dateFormat,dateLocale,errorIdd);if(2==type)for(var multipleSlots=timeSlots.slots,i=0;ijsDateTime.getTime()){errMsg=ZFLiveErrorConstants.mindatelimit.replace("{0}",convertJsDateTimeToNormal(minDateTime,dateFormat,dateLocale,!0));return $(errorIdd).text(errMsg),!1}}if(typeof dataSpecJson[DataSpecConst.TO_DATE]!==ResponseKey.UNDEFINED){if(compareDateTimeValues(toDate=dataSpecJson[DataSpecConst.TO_DATE],dateTime,dateFormat,dateLocale,timeFormat)){errMsg=ZFLiveErrorConstants.maxdatetimelimit.replace("{0}",toDate);return $(errorIdd).text(errMsg),!1}}else if(typeof dataSpecJson[DataSpecConst.DYNAMIC_TO_DATE]!==ResponseKey.UNDEFINED){var maxDateTime;if(typeof(maxDateTime=ZFUtil.getDateTimeFromDynamicJson(elem,dynamicMaxJson,dateFormat,dateLocale,"max",dynamicMinJson,minDateTime))!=ResponseKey.UNDEFINED&&maxDateTime.getTime()maxLen){errMsg=getErrMessageForDigitValidation(numOfDigits,minLen,maxLen);return $(errorIdd).text(errMsg),addIDAttrinErrActionList(elem),checkAndAddFieldToGridErrTrackFieldList(elem),!1}}else if(dataSpecJson[DataSpecConst.RANGE_TYPE]===RangeProperty.VALUES){var isSubFormElem=!1,rowId=undefined,formulaParentElem=$(elem).closest("ul");if(typeof formulaParentElem!==ResponseKey.UNDEFINED&&"subFormFieldsUl"==$(formulaParentElem).attr("elname")&&(isSubFormElem=!0,rowId=$(formulaParentElem).attr("rowid")),typeof dataSpecJson[DataSpecConst.MIN_VAL]!==ResponseKey.UNDEFINED){var minVal=undefined;if((minVal=!isNaN(dataSpecJson[DataSpecConst.MIN_VAL])?dataSpecJson[DataSpecConst.MIN_VAL]:getFldValueForRangeValidation(elem,comptype,dataSpecJson[DataSpecConst.IS_NEGATIVE],dataSpecJson[DataSpecConst.MIN_VAL],DateCalculationType.ROUNDDOWN,isSubFormElem,rowId))!=undefined&&check_Lessthan(inputVal,minVal,comptype)){minVal=ZFUtil.getFormattedDecimal(minVal,$(elem).attr("decimalformat"));errMsg=ZFLiveErrorConstants.minvalerror.replace("{0}",minVal.toString());return $(errorIdd).text(errMsg),addIDAttrinErrActionList(elem),checkAndAddFieldToGridErrTrackFieldList(elem),!1}}if(typeof dataSpecJson[DataSpecConst.MAX_VAL]!==ResponseKey.UNDEFINED){var maxVal=undefined;if((maxVal=!isNaN(dataSpecJson[DataSpecConst.MAX_VAL])?dataSpecJson[DataSpecConst.MAX_VAL]:getFldValueForRangeValidation(elem,comptype,dataSpecJson[DataSpecConst.IS_NEGATIVE],dataSpecJson[DataSpecConst.MAX_VAL],DateCalculationType.ROUNDUP,isSubFormElem,rowId))!=undefined&&check_Greaterthan(inputVal,maxVal,comptype)){maxVal=ZFUtil.getFormattedDecimal(maxVal,$(elem).attr("decimalformat"));errMsg=ZFLiveErrorConstants.maxvalerror.replace("{0}",maxVal.toString());return $(errorIdd).text(errMsg),addIDAttrinErrActionList(elem),checkAndAddFieldToGridErrTrackFieldList(elem),!1}}}return!0}function getFldValueForRangeValidation(elem,compType,isNegativeValAllowed,fldLinkName,roundOfType,isSubFormElem,rowId){var result=getValue(fldLinkName,isSubFormElem,rowId);if(null==result||""==result)return undefined;if(compType==ZFFieldTypeConstants.NUMBER)return Math.trunc(result);var decimalLength=$(elem).attr("decimallength");return truncateDecimals(result,Number(decimalLength))}function truncateDecimals(num,decimalLength){var numStr=num.toString(),decPos=numStr.indexOf("."),substrLength=-1==decPos?numStr.length:1+decPos+decimalLength;return numStr.substr(0,substrLength)}function getErrMessageForDigitValidation(numOfDigits,minLen,maxLen){return numOfDigitsmaxLen?ZFLiveErrorConstants.maxdigitslimit.replace("{0}",maxLen.toString()):void 0}function checkDatePicker(input){isIELessThan9()||typeof ZFLive.constraintJson===ResponseKey.UNDEFINED||setTimeout(function(){0===$(document.activeElement).closest("div[id=ui-datepicker-div]").length&&(isOneFieldForm()?ZFLive.validateFieldConstraintOF(input):ZFLive.validateFieldConstraint(input))},0)}function checkDatePicker_SF(input){isIELessThan9()||typeof ZFLive.constraintJson===ResponseKey.UNDEFINED||setTimeout(function(){0===$(document.activeElement).closest("div[id=ui-datepicker-div]").length&&ZFLive.validateFieldConstraintOF_SF(input)},0)}function isValidMatrixChoiceType(matrixChoiceType){return matrixChoiceType==MatrixChoicesType.RADIO.CODE||matrixChoiceType==MatrixChoicesType.CHECKBOX.CODE||matrixChoiceType==MatrixChoicesType.DROPDOWN.CODE||matrixChoiceType==MatrixChoicesType.TEXTBOX.CODE||matrixChoiceType==MatrixChoicesType.NUMBER.CODE||matrixChoiceType==MatrixChoicesType.CURRENCY.CODE}function convertJsDateTimeToNormal(jsDate,dateFormat,dateLocale,needTime,timeFormat){var normalDateTime,datesep;(dateFormat=dateFormat.toLowerCase()).indexOf("-")>=0?datesep="-":dateFormat.indexOf("/")>=0?datesep="/":dateFormat.indexOf(".")>=0&&(datesep=".");var date=jsDate.getDate(),year=jsDate.getFullYear(),monthNo=jsDate.getMonth(),month=monthNo+1;if(month=month<10?"0"+month:month,"dd-mmm-yyyy"==dateFormat){var monthArray=new Array("Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep","Oct","Nov","Dec");typeof dateLocale!=ResponseKey.UNDEFINED&&(monthArray=CustomDateLocale[dateLocale].monthNamesShort),month=monthArray[monthNo]}else if("dd-mmmm-yyyy"==dateFormat||"mmmm-dd-yyyy"==dateFormat){monthArray=new Array("January","February","March","April","May","June","July","August","September","October","November","December");typeof dateLocale!=ResponseKey.UNDEFINED&&(monthArray=CustomDateLocale[dateLocale].monthNames),month=monthArray[monthNo]}if(date=date<10?"0"+date:date,"dd-mmm-yyyy"==dateFormat||"dd-mmmm-yyyy"==dateFormat?normalDateTime=date+datesep+month+datesep+year:"yyyy/mm/dd"==dateFormat||"yyyy-mm-dd"==dateFormat?normalDateTime=year+datesep+month+datesep+date:"mm-dd-yyyy"==dateFormat||"mm/dd/yyyy"==dateFormat||"mmmm-dd-yyyy"==dateFormat?normalDateTime=month+datesep+date+datesep+year:"dd.mm.yyyy"!=dateFormat&&"dd-mm-yyyy"!=dateFormat&&"dd/mm/yyyy"!=dateFormat||(normalDateTime=date+datesep+month+datesep+year),needTime)if(timeFormat==TimeFormat.HOURS_12.CODE){var meridiem="AM";(hours=jsDate.getHours())>=12&&(hours-=12,meridiem="PM"),"AM"==meridiem?meridiem=CustomDateLocale[dateLocale].AM:"PM"==meridiem&&(meridiem=CustomDateLocale[dateLocale].PM),0==hours&&(hours=12),normalDateTime=normalDateTime+" "+(hours=hours<10?"0"+hours:hours)+":"+(minutes=(minutes=jsDate.getMinutes())<10?"0"+minutes:minutes)+" "+meridiem}else{var hours,minutes;normalDateTime=normalDateTime+" "+(hours=(hours=jsDate.getHours())<10?"0"+hours:hours)+":"+(minutes=(minutes=jsDate.getMinutes())<10?"0"+minutes:minutes)}return normalDateTime}function getDayName(day,dateLocale){var dayNamesArray=new Array("Sunday","Monday","Tuesday","Wednesday","Thursday","Friday","Saturday");return typeof dateLocale!=ResponseKey.UNDEFINED&&(dayNamesArray=CustomDateLocale[dateLocale].dayNames),dayNamesArray[day]}function getMonthName(month,dateLocale){return CustomDateLocale[dateLocale].monthNames[month]}function setWidthForCurrencySymbolInSubForm(pageUl){var sfFields=isStandardForm()?$(pageUl).find('div[elemtype="subFormField"][viewtype="1"]'):$(pageUl).find('li[elemtype="subFormField"][viewtype="1"]');$(sfFields).each(function(sfInd,sfLi){if($(sfLi).find('[elname="subFormLabelDiv"]').length>0&&$(sfLi).find('[elname="subFormLabelDiv"]').is(":visible")){isStandardForm()?$(sfLi).find("div[elname=subFormFieldsCloneUl]").show():$(sfLi).find("ul[elname=subFormFieldsCloneUl]").show();var currencyFields=isStandardForm()?$(sfLi).find("div[comptype=4]"):$(sfLi).find("li[comptype=4]");$(currencyFields).each(function(index,elem){var symbolWidth=$(elem).find("span[elname=currencySymbolSpan]").outerWidth(!0)+1,totalWidth=$(elem).find("div[elname=tempContDiv]").outerWidth(!0);$(elem).find("input").css("width",totalWidth-symbolWidth)}),isStandardForm()?$(sfLi).find("div[elname=subFormFieldsCloneUl]").hide():$(sfLi).find("ul[elname=subFormFieldsCloneUl]").hide(),currencyFields=isStandardForm()?$(sfLi).find("div[elname=subFormFieldsUl]").find("div[comptype=4]"):$(sfLi).find("ul[elname=subFormFieldsUl]").find("li[comptype=4]"),$(currencyFields).each(function(index,elem){var symbolWidth=$(elem).find("span[elname=currencySymbolSpan]").outerWidth(!0)+1,totalWidth=$(elem).find("div[elname=tempContDiv]").outerWidth(!0);$(elem).find("input").css("width",totalWidth-symbolWidth)})}})}function recaptcha_callback_inv(){$("#pleaseWait_Div").hide(),ZFLive.isSaveReq?ZFLive.ProceedToSave(!1):ZFLive.mode==Mode.EDIT?ZFLive.ProceedToUpdate():ZFLive.generatePaymentTokenAndProceedToSubmit()}function recaptcha_callback_inv_error(){setTimeout(function(){showErrorPopUp(i18n.captchaErrorHeading,i18n.captchaErrorMessage)},100),ZFLive.enableSubmitBtn(),keyNavForshowErrorPopUp()}function recaptcha_callback_cbox(){$("#error-recaptchacbox").hide()}function preventCutCopyPasteInEmailReconf(){if(isOneFieldForm())$(ZFSlideNav.slideContainer).find("div[elname=livefield-elem][comptype="+ZFFieldTypeConstants.EMAIL+"]").find("span[elname=livefield-reconf-elem]").find("input").on("cut copy paste",function(e){e.preventDefault()});else{var fldElem=isStandardForm()?$("#formBodyDiv").find("div[comptype="+ZFFieldTypeConstants.EMAIL+"]"):$("#formBodyDiv").find("li[comptype="+ZFFieldTypeConstants.EMAIL+"]");$(fldElem).find("span[elname=livefield-reconf-elem]").find("input").on("cut copy paste",function(e){e.preventDefault()})}}function preventCutCopyPasteInNumberReconf(){if(isOneFieldForm())$(ZFSlideNav.slideContainer).find("div[elname=livefield-elem][comptype="+ZFFieldTypeConstants.NUMBER+"]").find("span[elname=livefield-reconf-elem]").find("input").on("cut copy paste",function(e){e.preventDefault()});else{var fldElem=isStandardForm()?$("#formBodyDiv").find("div[comptype="+ZFFieldTypeConstants.NUMBER+"]"):$("#formBodyDiv").find("li[comptype="+ZFFieldTypeConstants.NUMBER+"]");$(fldElem).find("span[elname=livefield-reconf-elem]").find("input").on("cut copy paste",function(e){e.preventDefault()})}}function preventCutCopyPasteInPhoneReconf(){if(isOneFieldForm())$(ZFSlideNav.slideContainer).find("div[elname=livefield-elem][comptype="+ZFFieldTypeConstants.PHONE+"]").find("div[elname=confPhoneFld]").find("input").on("cut copy paste",function(e){e.preventDefault()});else{var fldElem=isStandardForm()?$("#formBodyDiv").find("div[comptype="+ZFFieldTypeConstants.PHONE+"]"):$("#formBodyDiv").find("li[comptype="+ZFFieldTypeConstants.PHONE+"]");$(fldElem).find("div[elname=confPhoneFld]").find("input").on("cut copy paste",function(e){e.preventDefault()})}}function preventCutCopyPasteInDecimalReconf(){if(isOneFieldForm())$(ZFSlideNav.slideContainer).find("div[elname=livefield-elem][comptype="+ZFFieldTypeConstants.DECIMAL+"]").find("span[elname=livefield-reconf-elem]").find("input").on("cut copy paste",function(e){e.preventDefault()});else{var fldElem=isStandardForm()?$("#formBodyDiv").find("div[comptype="+ZFFieldTypeConstants.DECIMAL+"]"):$("#formBodyDiv").find("li[comptype="+ZFFieldTypeConstants.DECIMAL+"]");$(fldElem).find("span[elname=livefield-reconf-elem]").find("input").on("cut copy paste",function(e){e.preventDefault()})}}function preventCutCopyPasteInCurrencyReconf(){if(isOneFieldForm())$(ZFSlideNav.slideContainer).find("div[elname=livefield-elem][comptype="+ZFFieldTypeConstants.CURRENCY+"]").find("span[elname=livefield-reconf-elem]").find("input").on("cut copy paste",function(e){e.preventDefault()});else{var fldElem=isStandardForm()?$("#formBodyDiv").find("div[comptype="+ZFFieldTypeConstants.CURRENCY+"]"):$("#formBodyDiv").find("li[comptype="+ZFFieldTypeConstants.CURRENCY+"]");$(fldElem).find("span[elname=livefield-reconf-elem]").find("input").on("cut copy paste",function(e){e.preventDefault()})}}function makeProgressAPIcall(fileUploadLi,uploadID,fileUploadPath,linkName,retryCount){if(retryCount<=5){var formPerma=document.getElementById("formPerma").value,ajaxOpts={URI:0!==formPerma.length?"/"+ZFLive.portalName+"/form/"+ZFLive.formLinkName+"/formperma/"+formPerma+"/checkwdfileuploadstatus?upload_id="+uploadID:"/"+ZFLive.portalName+"/form/"+ZFLive.formLinkName+"/checkwdfileuploadstatus?upload_id="+uploadID,METHOD:"PUT",ACCEPT:"application/json",xhrFields:{withCredentials:!0},CALLBACK:function(jsonData,ajaxOpts,jqXhr){if(200==jqXhr.status){var responseJson=JSON.parse(jqXhr.responseText);if(typeof responseJson.statusCode!=ResponseKey.UNDEFINED){var statusCode=responseJson.statusCode;"D201"==statusCode?fileUploadSuccess(uploadID,fileUploadLi,fileUploadPath):"D9217"==statusCode?setTimeout(function(){makeProgressAPIcall(fileUploadLi,uploadID,fileUploadPath,linkName,retryCount+1)},5e3):fileUploadError(uploadID,fileUploadLi,linkName)}else fileUploadError(uploadID,fileUploadLi,linkName)}else fileUploadError(uploadID,fileUploadLi,linkName)}};ZFUtil.sendAjax(ajaxOpts,this,ZFLive.isPublicFormAccess)}else fileUploadError(uploadID,fileUploadLi,linkName)}function fileUploadSuccess(uploadID,fileUploadLi,fileUploadPath){$(fileUploadLi).attr("uploadPath",fileUploadPath),$(fileUploadLi).find("div[elname=progressbar_line]").hide(),$(fileUploadLi).find("p[elname=fileSize]").show(),$(fileUploadLi).find("a[name=removeFileElement]").show(),triggerFormResizeOnTimeOut(),uploadCounter(-1,uploadID)}function fileUploadError(uploadID,fileUploadLi,linkName,errMsg){var errorId=isNewHtmlDOM()?$("div[id="+linkName+"-li]").find("div[elname=fu_error]"):"#fu_error-"+linkName;if(typeof errMsg!=ResponseKey.UNDEFINED&&null!=errMsg||(errMsg=ZFLiveErrorConstants.uploadservererror),$(errorId).text(errMsg),animateErrorMsg(errorId),$(fileUploadLi).addClass("fileUploadError"),$(fileUploadLi).find("div[elname=progressbar_line]").hide(),$(fileUploadLi).find("p[elname=fileSize]").show(),$(fileUploadLi).find("a[name=removeFileElement]").show(),addErrorForAccessibility(linkName,!0),1==ZFLive.submitButtonClicked||1==ZFLive.isSFPopUpEnterTriggered){var liElem=$("#"+linkName+"-li");if(liElem.addClass("error"),ZFUtil.isDataNeeded(liElem))showAndHidePage(isStandardForm()?$(liElem).closest("div[elname=formBodyULName]").attr("page_no"):liElem.closest('ul[elname="formBodyULName"]').attr("page_no")),focusFirstErrorElem(liElem)}triggerFormResizeOnTimeOut(),uploadCounter(-1,uploadID)}function reUploadAllFiles(){for(var key in ZFLive.storedFiles){var fileUploadJSON=ZFLive.storedFiles[key],liElem=$("#"+key+"-li");Object.keys(fileUploadJSON).length>0&&($(liElem).find("li[elname=newlyAddedFUElement]").remove(),ZFLive.reAddMultipleFileUploadFields(fileUploadJSON,key))}}function readFileAgain(fileObj,fileUploadLi,linkName,fileUploadUniqueName){var fileName=fileObj.name,fileExtension=fileName.substr(fileName.lastIndexOf(".")+1),fileNamewithoutExt=fileName.slice(0,-fileExtension.length),fileType=fileObj.type;if(fileObj.size>2e7){var errorMsg=ZFUtil.replaceParams(ZFLiveErrorConstants.uploadsize,20),rdFileErrTg=$(ZFLive.formFormFieldsOuterWrapper).find("#error-"+linkName);return rdFileErrTg.text(errorMsg),animateErrorMsg(rdFileErrTg),addErrorForAccessibility(linkName,!0),!1}var reader=new FileReader;return reader.onload=function(e){fileUploadLi.find("img[elname=fileImage]").attr("src",e.target.result),fileUploadLi.attr("elname","newlyAddedFUElement"),fileUploadLi.attr("name","singleFileElement"),fileUploadLi.attr("title",fileName),fileUploadLi.attr("Linkname",fileUploadUniqueName),fileUploadLi.find("em[elname=fileName]").text(fileNamewithoutExt),fileUploadLi.find("b[elname=fileExtension]").text(fileExtension),fileUploadLi.find("p[elname=fileSize]").text(ZFLive.convertBytes(fileObj.size)),fileUploadLi.find("a[name=removeFileElement]").attr("elname",fileUploadUniqueName),fileType.match("image.*")?fileUploadLi.find("div[elname=fileNonImage]").hide():(fileUploadLi.find("a[elname=zoomIcon]").hide(),fileUploadLi.find("img[elname=fileImage]").hide()),fileUploadLi.show()},reader.readAsDataURL(fileObj),!0}$(document).ready(function(){ZFLive.enableSubmitBtn(),setMaxWidthForDescriptionFieldImages($("#formDiv").width()),document.fonts&&document.fonts.ready.then(function(){triggerFormResize()})}),ZFLive.checkAndConstructAddressMapDetails=function(addressLIElem,addressJsonObj){if($(addressLIElem).find("a[elname=mapLink]").length>0){var compName=$(addressLIElem).attr("compname");if(ZFLive.mapPlacesJson.hasOwnProperty(compName)&&isNeedPlaceID(addressJsonObj,ZFLive.mapPlacesJson[compName])){var maplinkName=$(addressLIElem).attr("mapLinkName"),mapResponseDiv=$(addressLIElem).find("div[elname=mapResponseDiv]");ZFLive.constructAddressMapDetails(addressJsonObj,maplinkName,mapResponseDiv)}}},ZFLive.constructAddressMapDetails=function(addressJsonObj,maplinkName,mapResponseDiv){var mapReponse=mapResponseDiv.text();if(mapReponse!=undefined&&""!=mapReponse){var mapReponseJson=JSON.parse(mapReponse),mapJson={};mapJson.place_id=mapReponseJson.place_id,mapJson.lat=parseFloat(mapReponseJson.lat).toFixed(5),mapJson.lon=parseFloat(mapReponseJson.lon).toFixed(5),mapJson.label=mapReponseJson.label,addressJsonObj[maplinkName]=mapJson}},ZFLive.generatePaymentTokenAndSubmitData=function(){var paymentProcessingDiv=$("#paymentProcessingDiv");$(paymentProcessingDiv).show(),isStandardForm()&&isEmbeddedForm()?setPopupPositionNearRefElem($("#paymentProcessingDivCont"),$("button[elname=submit]"),-50,!0,!1):setPopUpElemPosition($("#paymentProcessingDivCont")),isAccessibilitySupported()&&$(paymentProcessingDiv).find("span[elname=paymentProcessingSpan]").focus();var paymentLI=$("#PaymentAmount-li"),authNetMerchantDiv=$(paymentLI).find("div[elname=authNetMerchantDiv]"),secureDataToAuthNet={cardData:{cardNumber:$(authNetMerchantDiv).find("input[elname=authNetAccNo]").val(),month:$(authNetMerchantDiv).find("select[elname=authNetExpMonth]").val(),year:$(authNetMerchantDiv).find("select[elname=authNetExpYear]").val(),cardCode:$(authNetMerchantDiv).find("input[elname=authNetCardCode]").val()},authData:{clientKey:ZFLive.authNetPublicClientKey,apiLoginID:ZFLive.authNetApiLoginID}};Accept.dispatchData(secureDataToAuthNet,authNetResponseHandler)},ZFLive.createStripeCardAndMount=function(){var fontColour="#444444",placeholderClr="#7b7c86",errorTxtClr="#ff0000",fntSize="13px",fntFamily="Open Sans, Consolas, Menlo, monospace";if(isNewHtmlDOM()){var clampFntSize=$(".pageWrapper").find(".fieldtext:first").css("font-size");typeof clampFntSize!=ResponseKey.UNDEFINED&&clampFntSize.length>0&&(fntSize=clampFntSize);var valTxtClr=convertColorCodeToHex($(".pageWrapper").css("--value-txt-clr"));typeof valTxtClr!=ResponseKey.UNDEFINED&&valTxtClr.length>0&&(fontColour=valTxtClr,placeholderClr=valTxtClr+"7F");var errTxtClr=$(".pageWrapper").css("--error-bg-clr");typeof errTxtClr!=ResponseKey.UNDEFINED&&errTxtClr.length>0&&(errorTxtClr=errTxtClr);var bodyFntFamily=$(".pageWrapper").css("--body-font");typeof bodyFntFamily!=ResponseKey.UNDEFINED&&bodyFntFamily.length>0&&(fntFamily=bodyFntFamily)}var elementStyles={base:{color:fontColour,iconColor:fontColour,fontFamily:fntFamily,fontSize:fntSize,"::placeholder":{color:placeholderClr},":-webkit-autofill":{color:placeholderClr}},invalid:{color:errorTxtClr,fontSize:fntSize,fontFamily:fntFamily,"::placeholder":{color:placeholderClr}}};ZFLive.stripeCard=ZFLive.stripeElements.create("card",{style:elementStyles}),ZFLive.stripeCard.mount("#stripe-card-element")},ZFLive.generateStripeTokenAndSubmitData=function(){var paymentProcessingDiv=$("#paymentProcessingDiv");$(paymentProcessingDiv).show(),isAccessibilitySupported()&&$(paymentProcessingDiv).find("span[elname=paymentProcessingSpan]").focus(),setPopUpElemPosition($("#paymentProcessingDivCont"));var paymentLi=$("#PaymentAmount-li"),stripeDiv=$(paymentLi).find("div[elname=stripeMerchantDiv]"),nameOnCard=$(stripeDiv).find("input[elname=stripeCardName]").val(),options={};""!=$.trim(nameOnCard)&&(options={billing_details:{name:nameOnCard}}),ZFLive.stripeObj.createPaymentMethod("card",ZFLive.stripeCard,options).then(function(result){if($("#paymentProcessingDiv").hide(),result.error){ZFLive.enableSubmitBtn(),$(paymentLi).find("div[elname=stripeMerchantDiv]").addClass("error1");var stripeErrElem=isNewHtmlDOM()?$(paymentLi).find("div[name=errDiv]"):$(paymentLi).find("span[elname=stripePaymentError]");if($(stripeErrElem).text(result.error.message),animateErrorMsg(stripeErrElem),isOneFieldForm())jumpToSpecificSlideWithParentFieldElem(paymentLi),showQvError(paymentLi);else showAndHidePage(isStandardForm()?$(paymentLi).closest("div[elname=formBodyULName]").attr("page_no"):paymentLi.parent().attr("page_no"));triggerFormResizeOnTimeOut(),ZFLive.stripeCard.focus(),cancelSubmitOrUpdateFormAction()}else $(paymentLi).find("div[elname=stripeMerchantDiv]").removeClass("error1"),$("#payment-error").hide(),stripeTokenHandler(result)})},ZFLive.handleStripePayIntentAction=function(respJson){respJson[ZFFormPayments.STRIPE.INTENT].requires_action?ZFLive.stripePaymentIntentAction(respJson):ZFLive.showPaymentFailRecordRetryErr(i18n.formPaymentError)},ZFLive.stripePaymentIntentAction=function(respJson){var merchantActionDiv=$("#merchantActionDiv");$(merchantActionDiv).show(),isStandardForm()&&isEmbeddedForm()?setPopupPositionNearRefElem($("#merchantActionDivCont"),$("button[elname=submit]"),-50,!0,!1):setPopUpElemPosition($("#merchantActionDivCont")),isAccessibilitySupported()&&$(merchantActionDiv).find("span[elname=merchantActionSpan]").focus();var stripeActionJson=respJson[ZFFormPayments.STRIPE.INTENT],sameFormUrl="";typeof respJson.same_form_url!==ResponseKey.UNDEFINED&&(sameFormUrl=respJson.same_form_url);var redirectURL=respJson.thankyou_page_URL,openRedirectURLIn=respJson.open_thankyou_page_URL_in,redirType=respJson.redirect_type;ZFLive.stripeObj.handleCardAction(stripeActionJson.payment_intent_client_secret).then(function(result){var stripeIntentJson={referenceid:respJson[ZFFormPayments.KEY.REF_ID]};if(result.error){var errMsg="";typeof result.error.message!==ResponseKey.UNDEFINED?errMsg=result.error.message:typeof result.error.payment_intent!==ResponseKey.UNDEFINED&&typeof result.error.payment_intent.last_payment_error!==ResponseKey.UNDEFINED&&(errMsg=result.error.payment_intent.last_payment_error.message),stripeIntentJson.errormsg=errMsg,stripeIntentJson[ZFFormPayments.KEY.PAYMNT_STATUS_FLG]=2}else stripeIntentJson[ZFFormPayments.STRIPE.INTENT_ID]=result.paymentIntent.id,stripeIntentJson[ZFFormPayments.KEY.PAYMNT_STATUS_FLG]=0;ZFLive.performStripeIntentCapturedRedir(stripeIntentJson,redirectURL,openRedirectURLIn,sameFormUrl,redirType)})},ZFLive.performStripeIntentCapturedRedir=function(stripeIntentJson,redirectURL,openRedirectURLIn,sameFormUrl,redirType){isNewHtmlDOM()&&$("#submitFreezeDiv").show();var formPerma=document.getElementById("formPerma").value;0===formPerma.length?reqUri="/"+this.portalName+"/form/"+this.formLinkName+"/stripeintentcapture":reqUri="/"+this.portalName+"/form/"+this.formLinkName+"/formperma/"+formPerma+"/stripeintentcapture";var ajaxOpts={URI:reqUri,METHOD:"POST",DATATYPE:"json",CONTENTTYPE:"application/json",ACCEPT:"application/json",DATA:JSON.stringify(stripeIntentJson),CALLBACK:function(jsonData,ajaxOpts,jqXhr){$("#merchantActionDiv").hide();var stripeResp=JSON.parse(jqXhr.responseText);if(200==jqXhr.status){if(1==stripeResp.pmntstatusflag)performDefaultRedirection(redirectURL,openRedirectURLIn,sameFormUrl,ZFormType.FORMS,redirType);else if(2==stripeResp.pmntstatusflag){for(var errMsg="",errArr=stripeResp[ZFLiveConstants.RESPONSE.ERRORS],i=0;i0&&(fntSize=clampFntSize);var valTxtClr=convertColorCodeToHex($(".pageWrapper").css("--value-txt-clr"));typeof valTxtClr!=ResponseKey.UNDEFINED&&valTxtClr.length>0&&(fontColour=valTxtClr,placeholderClr=computeOpacityColorVal(valTxtClr));var errTxtClr=$(".pageWrapper").css("--error-bg-clr");typeof errTxtClr!=ResponseKey.UNDEFINED&&errTxtClr.length>0&&(errorTxtClr=errTxtClr);var bodyFntFamily=$(".pageWrapper").css("--body-font");if(typeof bodyFntFamily!=ResponseKey.UNDEFINED&&bodyFntFamily.length>0){var bodyFntFamilyArr=bodyFntFamily.split(",");fntFamily=-1!=["Arial","Courier New","Georgia","Tahoma","Times New Roman","Trebuchet MS","Verdana"].indexOf(bodyFntFamilyArr[0])?bodyFntFamilyArr[0]:"Arial"}else fntFamily="Arial";isStandardForm()&&(backgroundColor=checkNotTransparentAndConvertColorCodeToHex($(".pageWrapper").css("--input-bg-clr"),"inputBgColor").trim(),borderColor=checkNotTransparentAndConvertColorCodeToHex($(".pageWrapper").css("--input-bdr-clr")).trim(),borderWidth=$(".pageWrapper").css("--input-bdr-top-width").trim()+" "+$(".pageWrapper").css("--input-bdr-right-width").trim()+" "+$(".pageWrapper").css("--input-bdr-bottom-width").trim()+" "+$(".pageWrapper").css("--input-bdr-left-width").trim(),focusColor=checkNotTransparentAndConvertColorCodeToHex($(".pageWrapper").css("--input-focus-clr"),"focusColor").trim()),elementStyles={"input::placeholder":{color:placeholderClr},".message-text.is-error":{color:errorTxtClr},"input.is-error::placeholder":{color:placeholderClr},input:{color:fontColour,fontFamily:fntFamily,fontSize:fntSize,backgroundColor:backgroundColor},".input-container":{borderColor:borderColor,borderWidth:borderWidth},".input-container.is-focus":{borderWidth:borderWidth,borderColor:focusColor},".message-text":{color:convertColorCodeToHex($(".pageWrapper").css("--label-txt-clr")).trim()}}}else elementStyles={"input::placeholder":{color:placeholderClr},".message-text.is-error":{color:errorTxtClr},"input.is-error::placeholder":{color:placeholderClr},input:{color:fontColour,fontFamily:fntFamily,fontSize:fntSize},".input-container.is-focus":{borderColor:"#d9d9d9",borderWidth:"1px"}};$("#squareCardLoadingDiv").show(),isStandardForm()&&isEmbeddedForm()?setPopupPositionNearRefElem($("#squareCardLoadingDivCont"),$("div[elname=livefield-elem]:visible:first"),30,!1,!1):setPopUpElemPosition($("#squareCardLoadingDivCont")),ZFLive.square.paymentObj.card({style:elementStyles}).then(function(card){ZFLive.square.card=card,card.attach("#square-card-element").then(function(){$("#squareCardLoadingDiv").hide(),triggerFormResize()})})},ZFLive.generateSquareTokenAndProceedToSubmit=function(){var pymtProcessingDiv=$("#paymentProcessingDiv");$(pymtProcessingDiv).show(),setPopUpElemPosition($(pymtProcessingDiv).find("#paymentProcessingDivCont"));var paymentLi=$("#PaymentAmount-li");ZFLive.square.card.tokenize().then(function(result){if("OK"===result.status)$(paymentLi).find("div[elname=squareMerchantDiv]").removeClass("error1"),$(paymentLi).find("span[elname=squarePaymentError]").hide(),ZFLive.squareVerifyBuyerAndAndProceedToSubmit(result,paymentLi);else{for(var squareErrMsg="",i=0;i')):$(formBodyUL).last().append($('
  • '))),$("#squareToken-li").find("input[elname=squareToken]").val(token);var pymtProcessingDiv=$("#paymentProcessingDiv");if(typeof ZFLive.square.integDetailsJson.billing_addr!=ResponseKey.UNDEFINED){var verificationDetails=squareVerfDetailsFill();typeof verificationDetails.billingContact!=ResponseKey.UNDEFINED?(verificationDetails.amount=pmtAmt,verificationDetails.currencyCode=ZFLive.square.currType,verificationDetails.intent="CHARGE",ZFLive.square.paymentObj.verifyBuyer(token,verificationDetails).then(function(verificationResult){typeof verificationResult.token!=ResponseKey.UNDEFINED&&(0==$("#squareVerfToken-li").length&&(isNewHtmlDOM()?$(formBodyUL).last().append($('
    ')):$(formBodyUL).last().append($('
  • '))),$("#squareVerfToken-li").find("input[elname=squareVerfToken]").val(verificationResult.token)),$(pymtProcessingDiv).hide(),ZFLive.ProceedToSubmit()})["catch"](function(error){var squareErrMsg=error.message;$(pymtProcessingDiv).hide(),squareTokenizeOrVerifyBuyerFail($(paymentLi),squareErrMsg)})):($(pymtProcessingDiv).hide(),ZFLive.ProceedToSubmit())}else $(pymtProcessingDiv).hide(),ZFLive.ProceedToSubmit()},ZFLive.performFocusSettingOnInitialLoading=function(){isOneFieldForm()?this.performFocusSettingOnInitialLoadingForOneFieldForm():isStandardForm()?this.performFocusSettingOnInitialLoadingForNewStandard():this.performFocusSettingOnInitialLoadingForOldStandard()},ZFLive.performFocusSettingOnInitialLoadingForOneFieldForm=function(){ZFLive.isEmbedded||focusFirstFieldOF()},ZFLive.performFocusSettingOnInitialLoadingForOldStandard=function(){ZFLive.isEmbedded||(ZFLive.isAccessibilitySupported?$(".templateWidth").focus():focusFirstLiElemOnLoad())},ZFLive.performFocusSettingOnInitialLoadingForNewStandard=function(){ZFLive.isEmbedded||(ZFLive.isAccessibilitySupported?$("div[elname=formWrapper]").focus():focusFirstLiElemOnLoad())},ZFLive.fetchUserLocation=function(){showGeoLocationLoadingDiv(),navigator.geolocation?navigator.geolocation.getCurrentPosition(fetchUserLocationSuccess,fetchUserLocationErrorFunction,{timeout:5e3}):fetchUserLocationErrorFunction()},ZFLive.SubmitData=function(){isNewHtmlDOM()&&$("#submitFreezeDiv").show();var formPerma=document.getElementById("formPerma").value,verifyPerma="";document.getElementById("otp_en")&&1==document.getElementById("otp_en").value&&(verifyPerma=document.getElementById("verifyPerma").value);var paymentForm=$("#isPaymentForm").val();ZFLive.valueJson={};var formULIterator=isOneFieldForm()?$(ZFSlideNav.slideWindow).find("div[elname=livefield-elem][reltype=parent]"):isStandardForm()?$("#formBodyDiv").find("div[elname=formBodyULName]").children("div[elname=livefield-elem][reltype=parent]"):$("#formBodyDiv").find("ul[elname=formBodyULName]").children("li");$(formULIterator).each(function(index,elem){var id=$(elem).attr("id"),needdata=$(elem).attr("needdata");if(isOneFieldForm())id&&"true"==needdata&&constructFormFieldDataJsonForSubmit(ZFLive.valueJson,elem);else{var needPageData=isStandardForm()?$(elem).closest("div[elname=formBodyULName]").attr("needpagedata"):$(elem).parent("ul").attr("needpagedata");if(id&&"true"==needdata&&"true"==needPageData)if("gridField"===$(elem).attr("elemtype")){var gridChildFieldIterator=$(elem).find("div[elname=livefield-elem][reltype=parent]");$(gridChildFieldIterator).each(function(index,gridFieldElem){var needGridFldData=$(gridFieldElem).attr("needdata");$(gridFieldElem).attr("id")&&"true"==needGridFldData&&constructFormFieldDataJsonForSubmit(ZFLive.valueJson,gridFieldElem)})}else constructFormFieldDataJsonForSubmit(ZFLive.valueJson,elem)}}),ZFLive.mode==Mode.SAVED_RECORD&&(ZFLive.valueJson.record_perma=ZFLive.encodedString);var antiSpamCheckUrl=$("#antispam-url-id").val(),reqUri="",formtype=parseInt($("#formType").val());if(formtype===ZFormType.FORMS){var referrerName=$.trim($("#referrerName").val());""!=referrerName&&"null"!=referrerName&&null!=referrerName||(referrerName=document.referrer),referrerName.indexOf(antiSpamCheckUrl)>-1&&(referrerName=""),""!=referrerName&&(ZFLive.valueJson.REFERRER_NAME=referrerName),1==ZFLive.isGeolocationEnabled&&ZFUtil.validateLatitudeFormat(ZFLive.fetchedLatitude)&&ZFUtil.validateLongitudeFormat(ZFLive.fetchedLongitude)&&(ZFLive.valueJson[SystemGeneratedField.ZF_ADDED_LATITUDE.LINK_NAME]=ZFLive.fetchedLatitude,ZFLive.valueJson[SystemGeneratedField.ZF_ADDED_LONGITUDE.LINK_NAME]=ZFLive.fetchedLongitude);var zc_gad=$.trim($("#zc_gad").val());""!=zc_gad&&zc_gad!=undefined&&(ZFLive.valueJson.GOOGLE_CLICK_ID=zc_gad);var utmParamInpElems=$("#zf_utmTrack").find("input[elname=utmParamInp]");if(utmParamInpElems.length>0){var utmParamValJson={};$(utmParamInpElems).each(function(idx,inpElem){var utmVal=$(inpElem).val();if(typeof utmVal!==ResponseKey.UNDEFINED&&""!=utmVal){var utmPLinkName=$(inpElem).attr("name");utmParamValJson[utmPLinkName]=utmVal}}),ZFLive.valueJson.UTM_PARAM=utmParamValJson}var langCode=$.trim($("#langcode").val());""!=langCode&&langCode!=undefined&&(ZFLive.valueJson[SystemGeneratedField.ADDED_LANGUAGE.LINK_NAME]=langCode),window.top.location!==window.self.location&&(ZFLive.valueJson[ZSRedir.ZS_IF_DOMAIN]=document.referrer),0===formPerma.length?reqUri="/"+this.portalName+"/form/"+this.formLinkName+"/records":(reqUri="/"+this.portalName+"/form/"+this.formLinkName+"/formperma/"+formPerma+"/records",0!=verifyPerma.length&&(ZFLive.valueJson[SystemGeneratedField.VERIFY_PERMA.LINK_NAME]=verifyPerma))}else formtype!==ZFormType.DOCSFORMS&&formtype!==ZFormType.WRITERFORMS||(reqUri="true"===$("#isDocsPublicForm").val()?"/"+this.portalName+"/form/"+this.formLinkName+"/pushdata/public?rid="+$("#formrid").val():"/"+this.portalName+"/form/"+this.formLinkName+"/pushdata");var headerVal="";if(ZFLive.isAdvAnalyticsEnabled){ZFAdvAnalytics.zfAdvAnalytics.sendAnalyticsDataOnSubmit();var analHeader={started_time:ZFAdvAnalytics.zfAdvAnalytics.getStartedTime(),dropoff_field:ZFAdvAnalytics.zfAdvAnalytics.getDropOffFieldToBeRemovedOnSubmit()};headerVal={"Adv-Anal-Header":JSON.stringify(analHeader)}}ZFLive.visitorDetails!=undefined&&(ZFLive.valueJson.visitorDetails=ZFLive.visitorDetails),ZFLive.resthookCookieData!=undefined&&(ZFLive.valueJson.zlp_visitor_detail=ZFLive.resthookCookieData);var ajaxOpts={URI:reqUri,METHOD:"POST",DATATYPE:"json",CONTENTTYPE:"application/json",ACCEPT:"application/zoho.forms-v1+json",DATA:JSON.stringify(ZFLive.valueJson),HEADER:headerVal,CALLBACK:function(jsonData,ajaxOpts,jqXhr){if(xmlString=jqXhr.responseText,200==jqXhr.status){ZFLive.isAdvAnalyticsEnabled&&ZFAdvAnalytics.zfAdvAnalytics.setFormSubmittedTrue();var isValidJson=isValidJSON(xmlString);if(ZFLive.performPageSenseIntegration(),ZFLive.performSalesIQIntegration(),detatchSquarePaymentCard(paymentForm),"true"!==paymentForm||isValidJson){var respJson=JSON.parse(xmlString);"true"===paymentForm&&typeof respJson[ZFFormPayments.STRIPE.INTENT]!==ResponseKey.UNDEFINED?($("#pleaseWait_Div").hide(),isNewHtmlDOM()&&$("#submitFreezeDiv").hide(),ZFLive.handleStripePayIntentAction(respJson)):"true"===paymentForm&&typeof respJson[ZFFormPayments.KEY.PAYMNT_ID_JSON]!==ResponseKey.UNDEFINED&&respJson[ZFFormPayments.KEY.PAYMNT_ID_JSON][ZFFormPayments.KEY.MERCHANT_TYPE]==ZFFormPayments.MERCHANT_TYPE.PAYPAL_CKOUT?($("#pleaseWait_Div").hide(),isNewHtmlDOM()&&$("#submitFreezeDiv").hide(),handlePaypalCkoutAction(respJson)):respJson.hasOwnProperty("splash_message")||checkIfGTMSubmitActionPresent()?(respJson.hasOwnProperty("splash_message")&&($("#pleaseWait_Div").hide(),ZFLive.showSplashMessage(respJson.splash_message)),checkFormActionGTM("submit"),setTimeout(function(){redirectionAfterSubmission(respJson,formtype)},2e3)):($("#pleaseWait_Div").hide(),redirectionAfterSubmission(respJson,formtype))}else{$("#pleaseWait_Div").hide(),isNewHtmlDOM()&&$("#submitFreezeDiv").hide();var paymentRedirectDiv=$("#paymentRedirectDiv");$(paymentRedirectDiv).show(),isStandardForm()&&isEmbeddedForm()?setPopupPositionNearRefElem($("#paymentRedirectDivCont"),$("button[elname=submit]"),-50,!0,!1):setPopUpElemPosition($("#paymentRedirectDivCont")),isAccessibilitySupported()&&$(paymentRedirectDiv).find("span[elname=paymentRedirectSpan]").focus(),$("#paymentDummyDiv").html(xmlString)}}else $("#pleaseWait_Div").hide(),ZFLive.enableSubmitBtn(),ZFLive.modifyAndNoteFilePathValInClient(),cancelSubmitOrUpdateFormAction(),clearSquarePaymentDataInCard(paymentForm),isNewHtmlDOM()&&$("#submitFreezeDiv").hide(),400==jqXhr.status||401==jqXhr.status||403==jqXhr.status||404==jqXhr.status||409==jqXhr.status?(ZFLive.resetCurrentDateRef(),ZFLive.constructLiveErrorMessage(jqXhr,!1),triggerFormResizeOnTimeOut()):500==jqXhr.status||503==jqXhr.status?500===jqXhr.status&&"Email not confirmed"===jqXhr.responseText?(ZFLive.disableSubmitBtn(),showErrorPopUpReSendmail()):showErrorPopUp(i18n.erroroccurred,i18n.internalserver):0==jqXhr.status?showErrorPopUp(i18n.erroroccurred,i18n.network_error):showErrorPopUp(i18n.erroroccurred,i18n.invalidentriesfound),(isIELessThan10()||isWindowSafari())&&clearFilesOnError()}};ZFUtil.sendAjax(ajaxOpts,this,ZFLive.isPublicFormAccess)},ZFLive.performPageSenseIntegration=function(){ZFLive.isPageSenseIntegrationEnabled&&(window.pagesense=window.pagesense||[],window.pagesense.push(["trackEvent","zps-integration-custom-event"]))},ZFLive.performSalesIQIntegration=function(){if(ZFLive.isSalesIQIntegrationEnabled){var visitorinfo={},formLIterator=isOneFieldForm()?$(ZFSlideNav.slideContainer).find("div[elname=livefield-elem]"):isStandardForm()?$("#formBodyDiv").find("div[elname=livefield-elem]"):$("#formBodyDiv").find("li");$(formLIterator).each(function(index,elem){var fieldType=parseInt($(elem).attr("comptype")),fieldLinkName=$(elem).attr("compname");if(fieldType===ZFFieldTypeConstants.SINGLE_LINE||fieldType===ZFFieldTypeConstants.NAME||fieldType===ZFFieldTypeConstants.PHONE||fieldType===ZFFieldTypeConstants.EMAIL)for(var idx=0;idx{if(ZFLive.isMaIntegrationVidCapture&&event!=undefined&&event.data!=undefined&&"visitor_and_visit_id"==event.data.id&&(ZFLive.visitorDetails=event.data.message),ZFLive.isRestHookCaptureEnabled&&event.data!=undefined&&event.data.from!=undefined&&"landingpage"==event.data.from&&event.data.value!=undefined&&event.data.value.zfpVisitorId!=undefined&&event.data.value.zfpVisitId!=undefined&&event.data.value.zfpNewVisitor!=undefined){var resthookCookieDetails={};resthookCookieDetails.zfpVisitorId=event.data.value.zfpVisitorId,resthookCookieDetails.zfpVisitId=event.data.value.zfpVisitId,resthookCookieDetails.zfpNewVisitor=event.data.value.zfpNewVisitor,event.data.value.zfpBucket!=undefined&&(resthookCookieDetails.zfpBucket=event.data.value.zfpBucket),event.data.value.zfpPZBucket!=undefined&&(resthookCookieDetails.zfpPZBucket=event.data.value.zfpPZBucket),event.data.value.zfpType!=undefined&&(resthookCookieDetails.zfpType=event.data.value.zfpType),event.data.value.resourceId!=undefined&&(resthookCookieDetails.resourceId=event.data.value.resourceId),event.data.value.ua!=undefined&&(resthookCookieDetails.ua=event.data.value.ua),ZFLive.resthookCookieData=resthookCookieDetails}}),ZFLive.showSplashMessage=function(splashMsg){if($("#splash_msg_text").text(splashMsg),0==ZFLive.isEmbedded)displaySplashMsg();else if(1==ZFLive.isEmbedded){var event=ZFLive.currEvent,scrollTop=$(window).scrollTop();if(event!=undefined&&(1==event.which||isMSIEbrowser()&&getMSIEversion()<=8&&0==event.which)){var submitBtnElem=isOneFieldForm()?$("#slideContainer,#navFooter:visible").find("button[elname=submit]:visible"):isStandardForm()?$("div[elname=footerWrapper]:visible"):$("#formDiv").find("ul[elname=footer]");if(submitBtnElem!=undefined)setSplashMsg(submitBtnElem.position().top-scrollTop+20);else displaySplashMsg()}else{var currFocusElem=ZFLive.currentFocusElem;if(currFocusElem!=undefined)setSplashMsg(currFocusElem.position().top+currFocusElem.outerHeight()/2-scrollTop);else displaySplashMsg()}}},ZFLive.modifyAndNoteFilePathValInClient=function(){if(ZFLive.mode==Mode.SAVED_RECORD)ZFLive.updateAndRemoveErrorFiles();else for(var key in ZFLive.storedFiles)$(ZFLive.formFormFieldsOuterWrapper).find("input[elname="+key+"]").attr("filepath","")},ZFLive.updateAndRemoveErrorFiles=function(){for(var key in ZFLive.storedFiles){var filePathString=$(ZFLive.formFormFieldsOuterWrapper).find("input[elname="+key+"]").attr("filepath");if(typeof filePathString!=ResponseKey.UNDEFINED&&""!=filePathString){var filePathArray=filePathString.split(","),fileUploadJSON=ZFLive.storedFiles[key];for(var uniqueFilePath in fileUploadJSON){var filepathtobedeleted=$("#"+key+"-div-files").find("a[elname="+uniqueFilePath+"]").attr("filepath");$(ZFLive.formFormFieldsOuterWrapper).find("a[elname="+uniqueFilePath+"]").attr("filepath","");var index=filePathArray.indexOf(filepathtobedeleted);-1!=index&&filePathArray.splice(index,1)}$(ZFLive.formFormFieldsOuterWrapper).find("input[elname="+key+"]").attr("filepath",filePathArray)}}},ZFLive.constructLiveErrorMessage=function(jqXhr,fromPageValidation){ZFLive.preventHidingErrorMsg();try{var onfocus,responseJson=JSON.parse(jqXhr.responseText),errArr=responseJson[ZFLiveConstants.RESPONSE.ERRORS],displayedErr=!1,hiddenFieldError=!1;if($.type(errArr)!==ZFLiveConstants.RESPONSE.UNDEFINED&&errArr.length>0)for(var msg="",pageCount=isStandardForm()?$("#formBodyDiv").find("div[elname=formBodyULName]").length:$("#formBodyDiv").find("ul[elname=formBodyULName]").length,i=0;i0){for(var msg="",i=0;iparseFloat(maxAmnt)&&($(errorIdd).text(ZFUtil.replaceParams(i18n.pymnterrmaxamnt,maxAmnt)),animateErrorMsg(errorIdd),$(elem).find("div[elname=paymentDetailsDiv]").addClass("error1"),this.changeErrArray(compname),addFieldToErrTrackFieldList(elem))}}else $(errorIdd).text(ZFUtil.replaceParams(i18n.paymentdecimallen,2)),animateErrorMsg(errorIdd),$(elem).find("div[elname=paymentDetailsDiv]").addClass("error1"),this.changeErrArray(compname),addFieldToErrTrackFieldList(elem);else $(errorIdd).text(i18n.entervalidamount),animateErrorMsg(errorIdd),$(elem).find("div[elname=paymentDetailsDiv]").addClass("error1"),this.changeErrArray(compname),addFieldToErrTrackFieldList(elem);else $(errorIdd).text(ZFLiveErrorConstants.mandatoryerror),animateErrorMsg(errorIdd),$(elem).find("div[elname=paymentDetailsDiv]").addClass("error1"),this.changeErrArray(compname),addFieldToErrTrackFieldList(elem);else"true"==$(merchDiv).attr("mandatory")&&($(errorIdd).text(ZFLiveErrorConstants.mandatoryerror),animateErrorMsg(errorIdd),$(elem).find("div[elname=paymentDetailsDiv]").addClass("error1"),this.changeErrArray(compname),addFieldToErrTrackFieldList(elem))}ZFLive.performRangeValidation(elem,addRangeErrClass),ZFLive.validationForRegexInSingleLine(elem)}}},ZFLive.configureInputMask=function(elem){if(typeof ZFLive.constraintJson!==ResponseKey.UNDEFINED){var data=ZFLive.constraintJson,target=$(elem),patternJson=data[isNewHtmlDOM()?$(target).closest("div[elname=livefield-elem]").attr("linkname"):target.parents("li").attr("linkname")][DataSpecConst.PATTERN.KEY];if("true"!==target.attr("inputmask")&&!$.isEmptyObject(patternJson)&&0===target.val().length)patternJson[DataSpecConst.PATTERN.PATTERN_TYPE]===PatternTypes.CUSTOM&&ZFLive.bindInputMask(target,patternJson[DataSpecConst.PATTERN.PATTERN_VAL])}},ZFLive.bindInputMask=function(elem,maskValue){new RegExp("^[wWdL*]+$").test(maskValue)||(Inputmask.prototype.defaults.definitions={},Inputmask.prototype.definitions={},maskValue=maskValue.replace(/\(/g,"\\(").replace(/\)/g,"\\)").replace(/\|/g,"\\|"),elem.inputmask({mask:maskValue,definitions:{w:{validator:""},W:{validator:""},L:{validator:""},d:{validator:""},"*":{validator:""}},undoOnEscape:!1,positionCaretOnTab:!1,showMaskOnHover:!1}),elem.attr("inputmask",!0))},ZFLive.setInputMaskForSingleLine=function(maskedSingleLineLinkNameArr){if(typeof ZFLive.constraintJson!==ResponseKey.UNDEFINED)for(var data=ZFLive.constraintJson,i=0;i0&&totalfilesuploadLimit)errorMsg=-1!=ZFLiveErrorConstants.fileuploadlimiterror.indexOf("{0}")?ZFUtil.replaceParams(ZFLiveErrorConstants.fileuploadlimiterror,uploadLimit):ZFLiveErrorConstants.fileuploadlimiterror,$(errorIdd).text(errorMsg),animateErrorMsg(errorIdd),this.changeErrArray(compname),addFieldToErrTrackFieldList(elem),checkAndAddFieldToGridErrTrackFieldList(elem)}else{var errorMsg;if(totalfiles>uploadLimit)errorMsg=-1!=ZFLiveErrorConstants.fileuploadlimiterror.indexOf("{0}")?ZFUtil.replaceParams(ZFLiveErrorConstants.fileuploadlimiterror,uploadLimit):ZFLiveErrorConstants.fileuploadlimiterror,$(errorIdd).text(errorMsg),animateErrorMsg(errorIdd),this.changeErrArray(compname),addFieldToErrTrackFieldList(elem),checkAndAddFieldToGridErrTrackFieldList(elem);else $(elem).find("li.fileUploadError").length>0&&(this.changeErrArray(compname),addFieldToErrTrackFieldList(elem),checkAndAddFieldToGridErrTrackFieldList(elem))}if("true"==ismandatory)if(isIELessThan10()||isWindowSafari()){var previousfile;previousfile=(previousfile=$(addFUDivnew).find("div[elname=filePathSpan]").html()).trim?previousfile.trim():previousfile.replace(/^\s+/,""),1==addFUDivnew.length&&""==previousfile&&($(errorIdd).text(ZFLiveErrorConstants.fileuploadmandatoryerror),animateErrorMsg(errorIdd),ZFLive.addMandatoryError(elem),this.changeErrArray(compname),addFieldToErrTrackFieldList(elem),checkAndAddFieldToGridErrTrackFieldList(elem))}else{var storedfiles=0;ZFLive.storedFiles[compname]!=undefined&&(storedfiles=Object.keys(ZFLive.storedFiles[compname]).length),totalfiles<=0&&storedfiles<=0&&($(errorIdd).text(ZFLiveErrorConstants.fileuploadmandatoryerror),animateErrorMsg(errorIdd),ZFLive.addMandatoryError(elem),this.changeErrArray(compname),addFieldToErrTrackFieldList(elem),checkAndAddFieldToGridErrTrackFieldList(elem))}}else if(comptype===ZFFieldTypeConstants.NAME||comptype===ZFFieldTypeConstants.ADDRESS||comptype===ZFFieldTypeConstants.GEOLOCATION){if("true"==ismandatory&&(checkMandatoryForCompositeElem(elem,comptype,!0)||($(errorIdd).text(ZFLiveErrorConstants.mandatoryerror),animateErrorMsg(errorIdd),this.changeErrArray(compname),addFieldToErrTrackFieldList(elem),checkAndAddFieldToGridErrTrackFieldList(elem))),-1==$.inArray(compname,this.errorArray)&&comptype===ZFFieldTypeConstants.ADDRESS)$(elem).attr("statefldtype")==AddrStateFldInputType.DROPDOWN&&(checkIfPrevValSelectedInAddrStateDd(elem,comptype,!0)||($(errorIdd).text(ZFLiveErrorConstants.invalid_state_value),animateErrorMsg(errorIdd),this.changeErrArray(compname),addFieldToErrTrackFieldList(elem),checkAndAddFieldToGridErrTrackFieldList(elem)));if(-1==$.inArray(compname,this.errorArray)&&comptype===ZFFieldTypeConstants.NAME&&!ZFLive.isSaveReq){var regexType=parseInt($(elem).attr("regex_type"));regexType==FieldRegexTypes.NONE||isRegexValidationSuccess(elem,errorIdd,regexType,!0)||(animateErrorMsg(errorIdd),this.changeErrArray(compname),addFieldToErrTrackFieldList(elem),checkAndAddFieldToGridErrTrackFieldList(elem))}}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||comptype===ZFFieldTypeConstants.PHONE){if("true"==ismandatory&&(checkMandatory(elem,comptype)||(comptype==ZFFieldTypeConstants.DATE?$(errorIdd).text(ZFLiveErrorConstants.datemandatoryerror):comptype==ZFFieldTypeConstants.MONTHYEAR?$(errorIdd).text(ZFLiveErrorConstants.monthyearmandatoryerror):comptype===ZFFieldTypeConstants.DATETIME?$(errorIdd).text(ZFLiveErrorConstants.datemandatoryerror):comptype===ZFFieldTypeConstants.SLIDER?$(errorIdd).text(i18n.chooseval):comptype===ZFFieldTypeConstants.NUMBER||comptype===ZFFieldTypeConstants.CURRENCY||comptype===ZFFieldTypeConstants.DECIMAL?(hideFieldReConfErr(compname),$(errorIdd).text(ZFLiveErrorConstants.mandatoryerrornumber)):comptype===ZFFieldTypeConstants.PHONE?(hideFieldReConfErr(compname),$(errorIdd).text(ZFLiveErrorConstants.mandatoryerrornumber)):comptype===ZFFieldTypeConstants.EMAIL?(hideFieldReConfErr(compname),$(errorIdd).text(ZFLiveErrorConstants.mandatoryerror)):$(errorIdd).text(ZFLiveErrorConstants.mandatoryerror),animateErrorMsg(errorIdd),ZFLive.addMandatoryError(elem),this.changeErrArray(compname),addFieldToErrTrackFieldList(elem),checkAndAddFieldToGridErrTrackFieldList(elem))),comptype==ZFFieldTypeConstants.PHONE)if(validatePhoneField(elem,errorIdd,ismandatory)&&ZFLive.isIncWebhookValidInput(skipIncWebhookValidation,elem,errorIdd))typeof(needReconf=$(elem).attr("need_reconf"))!=ResponseKey.UNDEFINED&&"true"==needReconf&&(ZFLive.checkPhFldIdentical(elem,compname,!0,!1)||(ZFLive.addMandatoryError(elem),this.changeErrArray(compname),addFieldToErrTrackFieldList(elem),checkAndAddFieldToGridErrTrackFieldList(elem)));else animateErrorMsg(errorIdd),hideFieldReConfErr(compname),ZFLive.addMandatoryError(elem),this.changeErrArray(compname),addFieldToErrTrackFieldList(elem),checkAndAddFieldToGridErrTrackFieldList(elem);else if(comptype==ZFFieldTypeConstants.EMAIL){var emailErrArray=new Array;if(validateEmail(elem,compname,emailErrArray))if(ZFLive.isIncWebhookValidInput(skipIncWebhookValidation,elem,errorIdd)){typeof(needReconf=$(elem).attr("need_reconf"))!=ResponseKey.UNDEFINED&&"true"==needReconf&&(ZFLive.checkIfIdentical(elem,compname,!0)||(ZFLive.addMandatoryError(elem),this.changeErrArray(compname),addFieldToErrTrackFieldList(elem),checkAndAddFieldToGridErrTrackFieldList(elem)))}else{reconfCompname=compname+"-reconf",reconfErrorId=ZFLive.errorId(reconfCompname);"none"!=$(reconfErrorId).css("display")&&$(reconfErrorId).hide(),animateErrorMsg(errorIdd),ZFLive.addMandatoryError(elem),this.changeErrArray(compname),addFieldToErrTrackFieldList(elem),checkAndAddFieldToGridErrTrackFieldList(elem)}else{var reconfCompname=compname+"-reconf",reconfErrorId=ZFLive.errorId(reconfCompname);"none"!=$(reconfErrorId).css("display")&&$(reconfErrorId).hide(),$($(errorIdd).text(emailErrArray[0])),animateErrorMsg(errorIdd),ZFLive.addMandatoryError(elem),this.changeErrArray(compname),addFieldToErrTrackFieldList(elem),checkAndAddFieldToGridErrTrackFieldList(elem)}}else if(comptype==ZFFieldTypeConstants.WEBSITE)ZFUtil.validateLiveUrl($(elem).find("input").val())||($(errorIdd).text(ZFLiveErrorConstants.urlerror),animateErrorMsg(errorIdd),ZFLive.addMandatoryError(elem),this.changeErrArray(compname),addFieldToErrTrackFieldList(elem),checkAndAddFieldToGridErrTrackFieldList(elem));else if(comptype==ZFFieldTypeConstants.NUMBER)if(validateNumber(elem))if(ZFLive.isIncWebhookValidInput(skipIncWebhookValidation,elem,errorIdd)){var needReconf;typeof(needReconf=$(elem).attr("need_reconf"))!=ResponseKey.UNDEFINED&&"true"==needReconf&&(ZFLive.checkIfIdentical(elem,compname,!0)||(ZFLive.addMandatoryError(elem),this.changeErrArray(compname),addFieldToErrTrackFieldList(elem),checkAndAddFieldToGridErrTrackFieldList(elem)))}else animateErrorMsg(errorIdd),ZFLive.addMandatoryError(elem),this.changeErrArray(compname),addFieldToErrTrackFieldList(elem),checkAndAddFieldToGridErrTrackFieldList(elem);else $(errorIdd).text(ZFLiveErrorConstants.numbererror),animateErrorMsg(errorIdd),ZFLive.addMandatoryError(elem),this.changeErrArray(compname),addFieldToErrTrackFieldList(elem),checkAndAddFieldToGridErrTrackFieldList(elem);else comptype==ZFFieldTypeConstants.SINGLE_LINE&&(ZFLive.isIncWebhookValidInput(skipIncWebhookValidation,elem,errorIdd)||(animateErrorMsg(errorIdd),ZFLive.addMandatoryError(elem),this.changeErrArray(compname),addFieldToErrTrackFieldList(elem),checkAndAddFieldToGridErrTrackFieldList(elem)));if(comptype==ZFFieldTypeConstants.CURRENCY||comptype==ZFFieldTypeConstants.DECIMAL)if(decimLenFormValidation(elem,errorIdd,comptype))typeof(needReconf=$(elem).attr("need_reconf"))!=ResponseKey.UNDEFINED&&"true"==needReconf&&(ZFLive.checkIfIdentical(elem,compname,!0)||(ZFLive.addMandatoryError(elem),this.changeErrArray(compname),addFieldToErrTrackFieldList(elem),checkAndAddFieldToGridErrTrackFieldList(elem)));else animateErrorMsg(errorIdd),ZFLive.addMandatoryError(elem),this.changeErrArray(compname),addFieldToErrTrackFieldList(elem),checkAndAddFieldToGridErrTrackFieldList(elem)}else if(comptype==ZFFieldTypeConstants.TIME)"true"==ismandatory?checkMandatoryTime(elem)||($(errorIdd).text(ZFLiveErrorConstants.timemandatoryerror),animateErrorMsg(errorIdd),ZFLive.addMandatoryError(elem),this.changeErrArray(compname),addFieldToErrTrackFieldList(elem),checkAndAddFieldToGridErrTrackFieldList(elem)):validateTime(elem)||("1"==$(elem).attr("timeformat")?$(errorIdd).text(ZFLiveErrorConstants.incompletetimeerror):$(errorIdd).text(ZFLiveErrorConstants.incompleteinputtimetwentyfour),animateErrorMsg(errorIdd),ZFLive.addMandatoryError(elem),this.changeErrArray(compname),addFieldToErrTrackFieldList(elem),checkAndAddFieldToGridErrTrackFieldList(elem));else if(comptype==ZFFieldTypeConstants.MULTI_LINE)"true"==ismandatory&&(checkMandatoryTextArea(elem)||($(errorIdd).text(ZFLiveErrorConstants.mandatoryerror),animateErrorMsg(errorIdd),ZFLive.addMandatoryError(elem),this.changeErrArray(compname),addFieldToErrTrackFieldList(elem),checkAndAddFieldToGridErrTrackFieldList(elem)));else if(comptype==ZFFieldTypeConstants.DROPDOWN)"true"==ismandatory&&(checkMandatoryDropDown(elem,compname)||($(errorIdd).text(ZFLiveErrorConstants.choicemandatoryerror),animateErrorMsg(errorIdd),ZFLive.addMandatoryError(elem),this.changeErrArray(compname),addFieldToErrTrackFieldList(elem),checkAndAddFieldToGridErrTrackFieldList(elem))),ZFLive.isIncWebhookValidInput(skipIncWebhookValidation,elem,errorIdd)||(animateErrorMsg(errorIdd),ZFLive.addMandatoryError(elem),this.changeErrArray(compname),addFieldToErrTrackFieldList(elem),checkAndAddFieldToGridErrTrackFieldList(elem));else if(comptype==ZFFieldTypeConstants.RATING)"true"==ismandatory&&(checkMandatoryRating(elem)||($(errorIdd).text(ZFLiveErrorConstants.ratingmandatoryerror),animateErrorMsg(errorIdd),ZFLive.addMandatoryError(elem),this.changeErrArray(compname),addFieldToErrTrackFieldList(elem),checkAndAddFieldToGridErrTrackFieldList(elem)));else if(comptype==ZFFieldTypeConstants.RADIO)"true"==ismandatory&&(checkMandatoryRadio(elem)||($(errorIdd).text(ZFLiveErrorConstants.choicemandatoryerror),animateErrorMsg(errorIdd),ZFLive.addMandatoryError(elem),this.changeErrArray(compname),addFieldToErrTrackFieldList(elem),checkAndAddFieldToGridErrTrackFieldList(elem))),ZFLive.isIncWebhookValidInput(skipIncWebhookValidation,elem,errorIdd)||(animateErrorMsg(errorIdd),ZFLive.addMandatoryError(elem),this.changeErrArray(compname),addFieldToErrTrackFieldList(elem),checkAndAddFieldToGridErrTrackFieldList(elem));else if(comptype==ZFFieldTypeConstants.MATRIX_CHOICE){var rowMandatoryType=$(elem).attr("row_mandatory_type"),columnMandatoryType=$(elem).attr("column_mandatory_type"),choiceType=$(elem).attr("choicetype");"true"!=ismandatory||checkMandatoryMatrixChoice(elem,!0)?choiceType==MatrixChoicesType.NUMBER.CODE||choiceType==MatrixChoicesType.CURRENCY.CODE?checkValidMatrixChoiceNumberCurr(elem)||($(errorIdd).addClass("rangeError").text(ZFLiveErrorConstants.matrixchoiceerrormessage),$(elem).attr("isErrorOnSubmission",!0),animateErrorMsg(errorIdd),this.changeErrArray(compname),addFieldToErrTrackFieldList(elem)):choiceType==MatrixChoicesType.RADIO.CODE&&1==$(elem).attr("limitRespPerCol")&&(checkLimitResponsePerColumn(elem)||($(errorIdd).text(ZFLiveErrorConstants.matrixlimitresponsepercol),animateErrorMsg(errorIdd),this.changeErrArray(compname),addFieldToErrTrackFieldList(elem))):(choiceType==MatrixChoicesType.TEXTBOX.CODE||choiceType==MatrixChoicesType.NUMBER.CODE||choiceType==MatrixChoicesType.CURRENCY.CODE?($(elem).attr("isErrorOnSubmission",!0),isNewHtmlDOM()?$(elem).find("div[name=errDiv]").addClass("rangeError"):$(elem).find("p[elname=error]").addClass("rangeError"),rowMandatoryType==MatrixMandatoryType.ALL_MANDATORY&&columnMandatoryType==MatrixMandatoryType.NO_MANDATORY?$(errorIdd).text(ZFLiveErrorConstants.matrixchoicetextboxmandatory):rowMandatoryType!=MatrixMandatoryType.NO_MANDATORY&&$(errorIdd).text(ZFLiveErrorConstants.matrixchoicecustomtextboxmandatory)):rowMandatoryType==MatrixMandatoryType.ALL_MANDATORY&&columnMandatoryType==MatrixMandatoryType.NO_MANDATORY?$(errorIdd).text(ZFLiveErrorConstants.matrixchoicemandatoryerror):rowMandatoryType!=MatrixMandatoryType.NO_MANDATORY&&$(errorIdd).text(ZFLiveErrorConstants.matrixchoicecustommandatory),animateErrorMsg(errorIdd),this.changeErrArray(compname),addFieldToErrTrackFieldList(elem))}else if(comptype==ZFFieldTypeConstants.CHECKBOX||comptype==ZFFieldTypeConstants.DECISION_BOX)"true"==ismandatory&&(checkMandatoryCheckBox(elem)||(comptype==ZFFieldTypeConstants.CHECKBOX?$(errorIdd).text(ZFLiveErrorConstants.optionmandatoryerror):$(errorIdd).text(ZFLiveErrorConstants.decisionmandatoryerror),animateErrorMsg(errorIdd),ZFLive.addMandatoryError(elem),this.changeErrArray(compname),addFieldToErrTrackFieldList(elem),checkAndAddFieldToGridErrTrackFieldList(elem))),comptype==ZFFieldTypeConstants.CHECKBOX&&(ZFLive.isSaveReq||ZFLive.validateChoiceLimit(elem),checkSizeForOtherOption(elem));else if(comptype==ZFFieldTypeConstants.MULTIPLE_CHOICE)"true"==ismandatory&&(checkMandatoryMultiSelect(elem)||($(errorIdd).text(ZFLiveErrorConstants.optionmandatoryerror),animateErrorMsg(errorIdd),ZFLive.addMandatoryError(elem),this.changeErrArray(compname),addFieldToErrTrackFieldList(elem),checkAndAddFieldToGridErrTrackFieldList(elem))),ZFLive.isSaveReq||ZFLive.validateChoiceLimit(elem);else if(comptype==ZFFieldTypeConstants.IMAGE_CHOICE)"true"==ismandatory&&(checkMandatoryImageChoice(elem)||($(errorIdd).text(ZFLiveErrorConstants.optionmandatoryerror),animateErrorMsg(errorIdd),ZFLive.addMandatoryError(elem),this.changeErrArray(compname),addFieldToErrTrackFieldList(elem),checkAndAddFieldToGridErrTrackFieldList(elem))),ZFLive.isSaveReq||ZFLive.validateChoiceLimit(elem);else if(compname==ZFLiveConstants.VERIFICATIONCODE.KEY){if(!checkMandatory(elem,comptype))$(errorIdd).text(ZFLiveErrorConstants.mandatoryerrorcaptcha),animateErrorMsg(errorIdd),$("#"+compname+"-li").addClass("error"),this.changeErrArray(compname),addFieldToErrTrackFieldList(elem)}else comptype==ZFFieldTypeConstants.TERMS_CONDITIONS?"true"==ismandatory&&(checkMandatoryCheckBox(elem)||($(errorIdd).text(ZFLiveErrorConstants.checktcfield),animateErrorMsg(errorIdd),ZFLive.addMandatoryError(elem),this.changeErrArray(compname),addFieldToErrTrackFieldList(elem),checkAndAddFieldToGridErrTrackFieldList(elem))):compname!=ZFLiveConstants.RECAPTCHA.CHECKBOX||getMSIEversion()<8||checkMandatoryReCaptcha()||($(errorIdd).text(ZFLiveErrorConstants.mandatoryerrorrecaptcha),animateErrorMsg(errorIdd),this.changeErrArray(compname),addFieldToErrTrackFieldList(elem))},ZFLive.addMandatoryError=function(elem){"recordowner"==$(elem).attr("compname")||ZFUtil.isFieldVisible(elem)||(ZFLive.isFormAdmin?showErrorPopUp(i18n.invalidentriesfound,i18n.checkfieldconfiguration):showErrorPopUp(i18n.invalidentriesfound,i18n.contactadmin)),$(elem).addClass("error")},ZFLive.errorId=function(compname){return"#error-"+compname},ZFLive.quickViewErrorElem=function(compname){return $("#quickViewFieldsList").find("li[elemname="+compname+"]")},ZFLive.changeErrArray=function(compname){this.errorArray[this.errCnt]=compname,this.errCnt++},ZFLive.getFileName=function(fileName){return fileName.replace(/^.*[\\\/]/,"")},ZFLive.convertBytes=function(bytes){if(0!=bytes){var kb=Math.round(bytes/1024);return kb>1024?(kb/1024).toFixed(2)+"MB":kb+"KB"}},ZFLive.addFileUploadFields=function(linkName,element){var elname=$(element).closest("div[name=fileElementDiv]").attr("elname"),addFileUploadDiv=$(element).closest("div[elname="+elname+"]"),fileDiv=addFileUploadDiv.find("div[name=filePreviewDiv]"),singleFileDiv=addFileUploadDiv.find("div[elname=fileInputDiv]"),filePathSpan=addFileUploadDiv.find("div[elname=filePathSpan]"),path=$(element).val();fileName=ZFLive.getFileName(path),$(ZFLive.formFormFieldsOuterWrapper).find("#error-"+linkName).hide(),filePathSpan.text(trimFileName(fileName)),singleFileDiv.hide(),fileDiv.show(),addFileUploadDiv.addClass("uploadList_IE")},ZFLive.submitFormDataForLive=function(formPermaUrl){var action,isFileExist=!1,data=new FormData;if(data.append("mode","live"),""!=formPermaUrl)action="/"+this.portalName+"/form/"+this.formLinkName+"/formperma/"+formPermaUrl+"/uploadFile";else{action="/"+this.portalName+"/form/"+this.formLinkName+"/uploadFile";var csrf=ZFUtil.getCSRF();$.trim(csrf).length>0&&data.append("zfcpn",csrf)}for(var key in ZFLive.storedFiles){$("#"+key+"-id").attr("value",""),$(ZFLive.formFormFieldsOuterWrapper).find("#error-"+key).val("");var fileUploadJSON=ZFLive.storedFiles[key];for(var uniqueFileLinkName in fileUploadJSON)fileUploadJSON.hasOwnProperty(uniqueFileLinkName)&&(isFileExist=!0,data.append(uniqueFileLinkName,fileUploadJSON[uniqueFileLinkName]))}if(isFileExist){var xhr=new XMLHttpRequest;xhr.open("POST",action,!0),xhr.setRequestHeader("Accept","application/json"),xhr.onload=function(e){var xmlString=xhr.responseText,respJson=JSON.parse(xmlString);if(200==this.status){for(var key in respJson){var val=respJson[key];ZFLive.setFieldValue(key,val)}ZFLive.SubmitData()}else{if(resetCaptcha(),resetReCaptcha(),typeof respJson[ZFLiveConstants.RESPONSE.ERROR]!=ResponseKey.UNDEFINED&&typeof respJson[ZFLiveConstants.RESPONSE.ERROR][ZFLiveConstants.RESPONSE.FORM_STATUS]!=ResponseKey.UNDEFINED){var formStatusErr=respJson[ZFLiveConstants.RESPONSE.ERROR][ZFLiveConstants.RESPONSE.FORM_STATUS];$("#pleaseWait_Div").hide(),showErrorPopUp(formStatusErr,i18n.contactadmin)}else for(var key in respJson){val=respJson[key];ZFLive.setErrorMsg(key,val)}ZFLive.enableSubmitBtn()}},xhr.send(data)}else ZFLive.SubmitData()},ZFLive.submitFormDataForSave=function(formPermaUrl){var action,isFileExist=!1,data=new FormData;if(data.append("mode","live"),""!=formPermaUrl)action="/"+this.portalName+"/form/"+this.formLinkName+"/formperma/"+formPermaUrl+"/uploadFile";else{action="/"+this.portalName+"/form/"+this.formLinkName+"/uploadFile";var csrf=ZFUtil.getCSRF();$.trim(csrf).length>0&&data.append("zfcpn",csrf)}for(var key in ZFLive.storedFiles){$("#"+key+"-id").attr("value",""),$(ZFLive.formFormFieldsOuterWrapper).find("#error-"+key).val("");var fileUploadJSON=ZFLive.storedFiles[key];for(var uniqueFileLinkName in fileUploadJSON)fileUploadJSON.hasOwnProperty(uniqueFileLinkName)&&(isFileExist=!0,data.append(uniqueFileLinkName,fileUploadJSON[uniqueFileLinkName]))}if(isFileExist){var xhr=new XMLHttpRequest;xhr.open("POST",action,!0),xhr.setRequestHeader("Accept","application/json"),xhr.onload=function(e){var xmlString=xhr.responseText,respJson=JSON.parse(xmlString);if(200==this.status){for(var key in respJson){var val=respJson[key];ZFLive.setFieldValue(key,val)}ZFLive.SaveData()}else{if(resetCaptcha(),resetReCaptcha(),closeCaptchaPopUp(),typeof respJson[ZFLiveConstants.RESPONSE.ERROR]!=ResponseKey.UNDEFINED&&typeof respJson[ZFLiveConstants.RESPONSE.ERROR][ZFLiveConstants.RESPONSE.FORM_STATUS]!=ResponseKey.UNDEFINED){var formStatusErr=respJson[ZFLiveConstants.RESPONSE.ERROR][ZFLiveConstants.RESPONSE.FORM_STATUS];$("#savingDiv").hide(),showErrorPopUp(formStatusErr,i18n.contactadmin)}else for(var key in respJson){val=respJson[key];ZFLive.setErrorMsg(key,val)}ZFLive.enableSaveBtn()}},xhr.send(data)}else ZFLive.SaveData()},ZFLive.submitFormDataForEdit=function(formPermaUrl,recordLinkId){var action,isFileExist=!1,data=new FormData;if(data.append("mode","edit"),""!=recordLinkId)if(""!=formPermaUrl)action="/"+this.portalName+"/form/"+this.formLinkName+"/formperma/"+formPermaUrl+"/uploadFile";else{action="/"+this.portalName+"/form/"+this.formLinkName+"/record/"+recordLinkId+"/uploadFile";var csrf=ZFUtil.getCSRF();$.trim(csrf).length>0&&data.append("zfcpn",csrf)}for(var key in ZFLive.storedFiles){$("#"+key+"-id").attr("value",""),$(ZFLive.formFormFieldsOuterWrapper).find("#error-"+key).val("");var fileUploadJSON=ZFLive.storedFiles[key];for(var uniqueFileLinkName in fileUploadJSON)fileUploadJSON.hasOwnProperty(uniqueFileLinkName)&&(isFileExist=!0,data.append(uniqueFileLinkName,fileUploadJSON[uniqueFileLinkName]))}if(isFileExist){var xhr=new XMLHttpRequest;xhr.open("POST",action,!0),xhr.setRequestHeader("Accept","application/json"),xhr.onload=function(e){var xmlString=xhr.responseText,respJson=JSON.parse(xmlString);if(200==this.status){for(var key in respJson){var val=respJson[key];ZFLive.setFieldValue(key,val)}ZFLive.updateData()}else{if(resetCaptcha(),resetReCaptcha(),typeof respJson[ZFLiveConstants.RESPONSE.ERROR]!=ResponseKey.UNDEFINED&&typeof respJson[ZFLiveConstants.RESPONSE.ERROR][ZFLiveConstants.RESPONSE.FORM_STATUS]!=ResponseKey.UNDEFINED)showErrorPopUp(respJson[ZFLiveConstants.RESPONSE.ERROR][ZFLiveConstants.RESPONSE.FORM_STATUS],i18n.contactadmin);else for(var key in respJson){val=respJson[key];ZFLive.setErrorMsg(key,val)}ZFLive.enableUpdateBtn()}},xhr.send(data)}else ZFLive.updateData()},ZFLive.addMultipleFileUploadFields=function(files,linkName,uploadlimit,isCompressionEnabledForField){ZFLive.isOldUploadType?ZFLive.addMultipleFileUploadFields_Old(files,linkName,uploadlimit):ZFLive.addMultipleFileUploadFields_New(files,linkName,uploadlimit,isCompressionEnabledForField)},ZFLive.addMultipleFileUploadFields_Old=function(files,linkName,uploadlimit){$("#error-"+linkName).hide(),$("#error-"+linkName).text("");var inputFileElemLen=files.length;$("li[compname="+linkName+"]").attr("allowedType").split(",");if(inputFileElemLen>0){var totalfiles=0,fileDiv=$("#"+linkName+"-div-files"),selectedFileCount=$(fileDiv).find("ul[elname=fileElementUL]").find("li[name=singleFileElement][isdelsfpopup!=true]").length;if(selectedFileCount>=0&&(totalfiles=inputFileElemLen+selectedFileCount),totalfiles<=uploadlimit){var count=0,selectedfiles=$(fileDiv).find("ul[elname=fileElementUL]").find("li[elname=newlyAddedFUElement]");selectedfiles.length>0&&(count=selectedfiles.length);var reader=new FileReader;!function readFile(index){if(index>=files.length)triggerFormResize();else{var fileUploadLi=fileDiv.find("ul[elname=fileElementUL]").find("li[elname=templateFileElement]").first().clone(),fileObj=files[index],fileName=fileObj.name,fileExtension=fileName.substr(fileName.lastIndexOf(".")+1),fileNamewithoutExt=fileName.slice(0,-fileExtension.length),fileType=fileObj.type;if(fileObj.size>2e7){var errorMsg=ZFUtil.replaceParams(ZFLiveErrorConstants.uploadsize,20),fuErrTg=$(ZFLive.formFormFieldsOuterWrapper).find("#error-"+linkName);return fuErrTg.text(errorMsg),animateErrorMsg(fuErrTg),!1}var fileUploadUniqueName=linkName+"_fu"+ ++count;if(ZFLive.storedFiles.hasOwnProperty(linkName))ZFLive.storedFiles[linkName][fileUploadUniqueName]=fileObj;else{var fileUploadJSON=[];fileUploadJSON[fileUploadUniqueName]=fileObj,ZFLive.storedFiles[linkName]=fileUploadJSON}reader.onload=function(e){fileUploadLi.find("img[elname=fileImage]").attr("src",e.target.result),fileUploadLi.attr("elname","newlyAddedFUElement"),fileUploadLi.attr("name","singleFileElement"),fileUploadLi.attr("title",fileName),fileUploadLi.attr("Linkname",fileUploadUniqueName),fileUploadLi.find("em[elname=fileName]").text(fileNamewithoutExt),fileUploadLi.find("b[elname=fileExtension]").text(fileExtension),fileUploadLi.find("p[elname=fileSize]").text(ZFLive.convertBytes(fileObj.size)),fileUploadLi.find("a[name=removeFileElement]").attr("elname",fileUploadUniqueName),fileType.match("image.*")?fileUploadLi.find("div[elname=fileNonImage]").hide():(fileUploadLi.find("a[elname=zoomIcon]").hide(),fileUploadLi.find("img[elname=fileImage]").hide()),ZFSubFormLive.zfSubFormLive!=undefined&&ZFSubFormLive.zfSubFormLive.isPopUpEdit&&fileUploadLi.attr("isNewlyAdded",!0),fileUploadLi.show(),fileDiv.find("ul[elname=fileElementUL]").append(fileUploadLi),readFile(index+1)},reader.readAsDataURL(fileObj),fileDiv.show()}}(0)}else{var errorMsg;errorMsg=-1!=ZFLiveErrorConstants.fileuploadlimiterror.indexOf("{0}")?ZFUtil.replaceParams(ZFLiveErrorConstants.fileuploadlimiterror,uploadlimit):ZFLiveErrorConstants.fileuploadlimiterror;var fuErrTg=$("#error-"+linkName);fuErrTg.text(errorMsg),animateErrorMsg(fuErrTg)}}},ZFLive.addMultipleFileUploadFields_New=function(files,linkName,uploadlimit,isCompressionEnabledForField){var elemLi=$("#"+linkName+"-li"),fieldType=$(elemLi).attr("comptype");$("#error-"+linkName).hide(),$("#error-"+linkName).text("");var inputFileElemLen=files.length;if(inputFileElemLen>0){var totalfiles=0,fileDiv=$("#"+linkName+"-div-files"),selectedFileCount=$(fileDiv).find("ul[elname=fileElementUL]").find("li[name=singleFileElement][isdelsfpopup!=true]").length;if(selectedFileCount>=0&&(totalfiles=inputFileElemLen+selectedFileCount),totalfiles<=uploadlimit){var i,count=0,selectedfiles=$(fileDiv).find("ul[elname=fileElementUL]").find("li[elname=newlyAddedFUElement]");for(selectedfiles.length>0&&(count=selectedfiles.length),i=0;i{var newFileUploadLi=fileDiv.find("ul[elname=fileElementUL]").find("li[elname=templateFileElement]").first().clone();ZFSubFormLive.zfSubFormLive!=undefined&&ZFSubFormLive.zfSubFormLive.isPopUpEdit&&$(newFileUploadLi).attr("isNewlyAdded",!0),$(fileDiv).find("ul[elname=fileElementUL]").append(newFileUploadLi),readFile_New(files[i],newFileUploadLi,linkName,fieldType,count,isCompressionEnabledForField,readComplete,readError)}).then(({fileObj:fileObj,newFileUploadLi:newFileUploadLi,imgProcessId:imgProcessId})=>{ZFLive.uploadFile(linkName,fileObj,newFileUploadLi,imgProcessId)})["catch"](({error:error,imgProcessId:imgProcessId})=>{})}$(fileDiv).find("ul[elname=fileElementUL]").find("li[name=singleFileElement][isdelsfpopup!=true]").length==uploadlimit&&$("#"+linkName+"-id").attr("onclick","showUploadLimitErr('"+linkName+"','"+uploadlimit+"');event.preventDefault();"),i>0&&(fileDiv.show(),triggerFormResize())}else showUploadLimitErr(linkName,uploadlimit)}},ZFLive.submitFiles=function(fromPage){var formPerma=document.getElementById("formPerma").value,fileElem=$("#ZF-UploadFileForm"),fileElArr=$(ZFLive.formFormFieldsOuterWrapper).find(":input[type=file]");if($.each(fileElArr,function(index,el){$(el).after($(el).clone()[0]),$(fileElem).append(el)}),0!==formPerma.length)fileElem.find(":input[name=zfcpn]").remove();else{var csrf=ZFUtil.getCSRF();$.trim(csrf).length>0?fileElem.find(":input[name=zfcpn]").val(csrf):fileElem.find(":input[name=zfcpn]").remove()}return $(fileElem).submit(),!0},ZFLive.ValidateAndUpdateDataForLiveEdit=function(){$("#disableDiv").show(),ZFLive.preventHidingErrorMsg();var errorObj=ZFLive.validateForm(!0);removeErrorClass(),0==errorObj.length?(ZFLive.disableUpdateBtn(),!document.getElementById("recaptcha_invisible")||getMSIEversion()<8?ZFLive.ProceedToUpdate():grecaptcha.execute()):(cancelSubmitOrUpdateFormAction(),addEachErrorForAccessibility(errorObj),showError(errorObj),resetCaptcha()),ZFLive.resetHidingErrorMsg()},ZFLive.ProceedToUpdate=function(){$("#pleaseWait_Div").show(),isStandardForm()&&isEmbeddedForm()?setPopupPositionNearRefElem($("#pleaseWait_DivCont"),$("button[elname=update]"),-50,!0,!1):setPopUpElemPosition($("#pleaseWait_DivCont"));var recordLinkId=$(ZFLive.formFormFieldsOuterWrapper).find("button[id=updateBtn]").attr("recordLinkID");if($(ZFLive.formFormFieldsOuterWrapper).find("input:file").length>0)if(isIELessThan10()||isWindowSafari())ZFLive.submitFiles();else if(ZFLive.isOldUploadType){var formPerma=document.getElementById("formPerma").value;ZFLive.submitFormDataForEdit(formPerma,recordLinkId)}else this.updateData();else this.updateData()},ZFLive.closePopUp=function(elname){$("body").removeClass("hideWindowScroll"),$("#"+elname).hide(),isAccessibilitySupported()&&typeof elname!==ResponseKey.UNDEFINED&&"savePopUpDiv"===elname&&(isStandardForm()?$("#mainWrapper").find("button[elname=save]").focus():$("#formDiv").find("button[elname=save]").focus(),$(document).off("keydown.savepopup"))},ZFLive.closeReviewPopUp=function(closeDivId){$("body").removeClass("hideWindowScroll"),$("#"+closeDivId).fadeOut(500,function(){triggerFormResize()}),ZFLive.enableReviewBtn(),isAccessibilitySupported()&&(isStandardForm()?$("#mainWrapper").find("button[elname=review]").focus():$("#formRedirectURL").find("button[elname=review]").focus(),$(document).off("keydown.reviewpopup"))},ZFLive.ValidateAndSaveData=function(){ZFLive.isSaveReq=!0,$("#plainLoading").hide(),ZFLive.preventHidingErrorMsg();var errorObj=ZFLive.validateForm(!1);removeErrorClass(),0==errorObj.length?(ZFLive.disableSaveBtn(),!document.getElementById("recaptcha_invisible")||getMSIEversion()<8?ZFLive.ProceedToSave(!1):grecaptcha.execute()):isPopupCaptchaNeeded(errorObj)?(ZFLive.submitButtonClicked=!1,showPopupCaptcha()):(cancelSubmitOrUpdateFormAction(),addEachErrorForAccessibility(errorObj),showError(errorObj),resetCaptcha()),ZFLive.resetHidingErrorMsg()},ZFLive.ProceedToSave=function(isFromPopup){if(!isFromPopup){var savingDiv=$("#savingDiv");$(savingDiv).show(),isStandardForm()&&isEmbeddedForm()?setPopupPositionNearRefElem($("#savingDivCont"),$("div[elname=footer]:visible"),-50,!1,!1):setPopUpElemPosition($("#savingDivCont")),isAccessibilitySupported()&&$(savingDiv).find("span[elname=savingSpan]").focus()}isOneFieldForm()?$(ZFSlideNav.slideContainer).find("a[elname=save]").attr("recordLinkID"):$("#formBodyDiv").find("button[elname=save]").attr("recordLinkID");if((isNewHtmlDOM()?$(ZFLive.formFormFieldsOuterWrapper).find("div[elname=formBodyULName]").find("input:file").length:$(ZFLive.formFormFieldsOuterWrapper).find("ul[elname=formBodyULName]").find("input:file").length)>0){var formPerma=document.getElementById("formPerma").value;isIELessThan10()||isWindowSafari()?ZFLive.submitFiles():ZFLive.isOldUploadType?ZFLive.submitFormDataForSave(formPerma):this.SaveData()}else this.SaveData()},ZFLive.SaveData=function(){isNewHtmlDOM()&&$("#submitFreezeDiv").show();var formPerma=document.getElementById("formPerma").value;ZFLive.valueJson={};var formULIterator=isOneFieldForm()?$(ZFSlideNav.slideWindow).find("div[elname=livefield-elem][reltype=parent]"):isStandardForm()?$("#formBodyDiv").find("div[elname=formBodyULName]").children("div[elname=livefield-elem][reltype=parent]"):$("#formBodyDiv").find("ul[elname=formBodyULName]").children("li");$(formULIterator).each(function(index,elem){var id=$(elem).attr("id"),needdata=$(elem).attr("needdata");if(isOneFieldForm())id&&"true"==needdata&&constructFormFieldDataJsonForSave(ZFLive.valueJson,elem);else{var needPageData=isStandardForm()?$(elem).closest("div[elname=formBodyULName]").attr("needpagedata"):$(elem).parent("ul").attr("needpagedata");if(id&&"true"==needdata&&"true"==needPageData)if("gridField"===$(elem).attr("elemtype")){var gridChildFieldIterator=$(elem).find("div[elname=livefield-elem][reltype=parent]");$(gridChildFieldIterator).each(function(index,gridFieldElem){var needGridFldData=$(gridFieldElem).attr("needdata");$(gridFieldElem).attr("id")&&"true"==needGridFldData&&constructFormFieldDataJsonForSave(ZFLive.valueJson,gridFieldElem)})}else constructFormFieldDataJsonForSave(ZFLive.valueJson,elem)}}),ZFLive.valueJson.RECORD_STATUS=ZFConstants.SAVE_RECORD_STATUS,1==ZFLive.isGeolocationEnabled&&ZFUtil.validateLatitudeFormat(ZFLive.fetchedLatitude)&&ZFUtil.validateLongitudeFormat(ZFLive.fetchedLongitude)&&(ZFLive.valueJson[SystemGeneratedField.ZF_ADDED_LATITUDE.LINK_NAME]=ZFLive.fetchedLatitude,ZFLive.valueJson[SystemGeneratedField.ZF_ADDED_LONGITUDE.LINK_NAME]=ZFLive.fetchedLongitude);var antiSpamCheckUrl=$("#antispam-url-id").val(),reqUri="",saveUrl="",method="POST",formtype=parseInt($("#formType").val()),verifyPerma="";if(document.getElementById("otp_en")&&1==document.getElementById("otp_en").value&&(verifyPerma=document.getElementById("verifyPerma").value),formtype===ZFormType.FORMS){if(""==ZFLive.encodedString){var referrerName=$.trim($("#referrerName").val());""!=referrerName&&"null"!=referrerName&&null!=referrerName||(referrerName=document.referrer),referrerName.indexOf(antiSpamCheckUrl)>-1&&(referrerName=""),ZFLive.valueJson.REFERRER_NAME=referrerName;var zc_gad=$.trim($("#zc_gad").val());""!=zc_gad&&zc_gad!=undefined&&(ZFLive.valueJson.GOOGLE_CLICK_ID=zc_gad);var utmParamInpElems=$("#zf_utmTrack").find("input[elname=utmParamInp]");if(utmParamInpElems.length>0){var utmParamValJson={};$(utmParamInpElems).each(function(idx,inpElem){var utmVal=$(inpElem).val();if(typeof utmVal!==ResponseKey.UNDEFINED&&""!=utmVal){var utmPLinkName=$(inpElem).attr("name");utmParamValJson[utmPLinkName]=utmVal}}),ZFLive.valueJson.UTM_PARAM=utmParamValJson}var langCode=$.trim($("#langcode").val());""!=langCode&&langCode!=undefined&&(ZFLive.valueJson[SystemGeneratedField.ADDED_LANGUAGE.LINK_NAME]=langCode)}0!=verifyPerma.length&&(ZFLive.valueJson[SystemGeneratedField.VERIFY_PERMA.LINK_NAME]=verifyPerma),0===formPerma.length?(ZFLive.mode==Mode.LIVE?reqUri="/"+this.portalName+"/form/"+this.formLinkName+"/records":(reqUri="/"+this.portalName+"/form/"+this.formLinkName+"/record/"+ZFLive.encodedString+"/save",method="PUT"),saveUrl=location.protocol+"//"+location.hostname+(location.port?":"+location.port:"")+"/"+this.portalName+"/form/"+this.formLinkName+"/record/"):(ZFLive.mode==Mode.LIVE?reqUri="/"+this.portalName+"/form/"+this.formLinkName+"/formperma/"+formPerma+"/records":(reqUri="/"+this.portalName+"/form/"+this.formLinkName+"/publicrecord/"+ZFLive.encodedString+"/save",method="PUT"),saveUrl=location.protocol+"//"+location.hostname+(location.port?":"+location.port:"")+"/"+this.portalName+"/form/"+this.formLinkName+"/publicrecord/")}var ajaxOpts={URI:reqUri,METHOD:method,DATATYPE:"json",CONTENTTYPE:"application/json",ACCEPT:"application/zoho.forms-v1+json",DATA:JSON.stringify(ZFLive.valueJson),CALLBACK:function(jsonData,ajaxOpts,jqXhr){if($("#pleaseWait_Div").hide(),xmlString=jqXhr.responseText,ZFLive.submitButtonClicked=!1,200==jqXhr.status){closeCaptchaPopUp(),ZFLive.storedFiles={};var respJson=JSON.parse(xmlString),encryptedText=respJson.encoded_string;if(ZFLive.mode!=Mode.SAVED_RECORD&&(ZFLive.mode=Mode.SAVED_RECORD,ZFLive.encodedString=encryptedText),showSavePopUp(saveUrl=typeof respJson.VERIFY_PERMA!=ResponseKey.UNDEFINED?location.protocol+"//"+location.hostname+(location.port?":"+location.port:"")+"/"+ZFLive.portalName+"/form/"+ZFLive.formLinkName+"/formperma/"+formPerma+"/verify/"+respJson.VERIFY_PERMA:saveUrl+encryptedText+"/save",respJson),isAccessibilitySupported()){var savePopUpDiv=$("#savePopUpDiv"),elements=[],isElemFocused=!1;$(savePopUpDiv).find("input[elname=emailID]").is(":visible")&&(elements.push($(savePopUpDiv).find("input[elname=emailID]")),elements.push($(savePopUpDiv).find("button[elname=sendEmailBtn]")),isElemFocused=!0),elements.push($(savePopUpDiv).find("textarea")),isStandardForm()?elements.push($(savePopUpDiv).find("div[elname=savePopUpCloseBtn]")):elements.push($(savePopUpDiv).find("a[elname=savePopUpCloseBtn]")),isElemFocused||$(savePopUpDiv).find("textarea").focus().click(),ZFLive.handleTabKeyNavForCommonPopupCase($(savePopUpDiv),elements,0,"keydown.savepopup")}$(document).on("keyup",function(event){27===event.keyCode&&ZFLive.closePopUp("savePopUpDiv")}),setFileClear(),resetCaptcha(),resetReCaptcha(),checkFormActionGTM("save"),isNewHtmlDOM()&&$("#submitFreezeDiv").hide()}else{if(isNewHtmlDOM()&&$("#submitFreezeDiv").hide(),ZFLive.mode==Mode.LIVE)for(var key in ZFLive.storedFiles){$(ZFLive.formFormFieldsOuterWrapper).find("input[elname="+key+"]").attr("filepath","");var fileUploadJSON=ZFLive.storedFiles[key];for(var uniqueFilePath in fileUploadJSON)$(ZFLive.formFormFieldsOuterWrapper).find("a[elname="+uniqueFilePath+"]").attr("filepath","")}else ZFLive.updateAndRemoveErrorFiles();if(400==jqXhr.status||401==jqXhr.status||403==jqXhr.status||404==jqXhr.status||409==jqXhr.status)try{$("#popupCaptchaSave").find("em[elem=loadingImgElem]").hide(),$("#screenFreezeDiv").hide(),ZFLive.showRecordUpdateErrorResp(jqXhr),triggerFormResizeOnTimeOut(),resetCaptcha(),resetReCaptcha(),ZFLive.resetCurrentDateRef()}catch(error){var msgElm=$("#settingsErr-div");if($(msgElm).css("position","fixed"),$(msgElm).show(),isStandardForm()&&isEmbeddedForm()){var popupHeight=$("#settingsErr-div-cont").outerHeight(!0);setPopupPositionNearRefElem($("#settingsErr-div-cont"),$("div[elname=footer]:visible"),-1*popupHeight,!0,!0)}else setPopUpElemPosition($("#settingsErr-div-cont"));$(msgElm).find("#popHeader").text(i18n.saveerror),$(msgElm).find("#msgBody").text(xmlString),keyNavForshowErrorPopUp(),showInvalidEntriesMsg(xmlString),closeCaptchaPopUp(),resetCaptcha(),resetReCaptcha()}else 500==jqXhr.status||503==jqXhr.status?(closeCaptchaPopUp(),1==$("#formType").val()&&503==jqXhr.status?showInvalidEntriesMsg(i18n.unabletoconnecttosheetserver):500===jqXhr.status&&"Email not confirmed"===jqXhr.responseText?showErrorPopUpReSendmail():showErrorPopUp(i18n.erroroccurred,i18n.internalserver)):0==jqXhr.status?showErrorPopUp(i18n.erroroccurred,i18n.network_error):(closeCaptchaPopUp(),showErrorPopUp(i18n.erroroccurred,i18n.invalidentriesfound));(isIELessThan10()||isWindowSafari())&&clearFilesOnError()}$("#savingDiv").hide(),ZFLive.enableSaveBtn()}};ZFUtil.sendAjax(ajaxOpts,this,ZFLive.isPublicFormAccess)},ZFLive.generatePaymentTokenAndProceedToSubmit=function(){var paymentLi=$("#PaymentAmount-li");if(typeof paymentLi!=ResponseKey.UNDEFINED){var merchantType=$(paymentLi).find("div[elname=merchantDiv]").attr("merchantType");if(null!=merchantType){var parentUl=isStandardForm()?$(paymentLi).closest("div[elname=formBodyULName]"):paymentLi.parent("ul[elname=formBodyULName]");("true"===paymentLi.attr("needdata")&&isOneFieldForm()||"true"===paymentLi.attr("needdata")&&"true"==parentUl.attr("needpagedata"))&&merchantType==ZFFormPayments.MERCHANT_TYPE.SQUARE?ZFLive.generateSquareTokenAndProceedToSubmit():ZFLive.ProceedToSubmit()}else ZFLive.ProceedToSubmit()}else ZFLive.ProceedToSubmit()},ZFLive.ValidateAndSubmitData=function(){ZFLive.isSaveReq=!1,ZFLive.preventHidingErrorMsg();var errorObj=ZFLive.validateForm(!0);removeErrorClass(),0==errorObj.length?(ZFLive.disableSubmitBtn(),!document.getElementById("recaptcha_invisible")||getMSIEversion()<8?ZFLive.generatePaymentTokenAndProceedToSubmit():grecaptcha.execute()):(cancelSubmitOrUpdateFormAction(),addEachErrorForAccessibility(errorObj),showError(errorObj),resetCaptcha()),ZFLive.resetHidingErrorMsg()},ZFLive.ProceedToSubmit=function(){var pleaseWaitDiv=$("#pleaseWait_Div");$(pleaseWaitDiv).show(),isStandardForm()&&isEmbeddedForm()?setPopupPositionNearRefElem($("#pleaseWait_DivCont"),$("button[elname=submit]"),-50,!0,!1):setPopUpElemPosition($("#pleaseWait_DivCont")),isAccessibilitySupported()&&$(pleaseWaitDiv).find("span[elname=pleaseWaitSpan]").focus();var formBodyULName=isStandardForm()?"div[elname=formBodyULName]":"ul[elname=formBodyULName]";if($(ZFLive.formFormFieldsOuterWrapper).find(formBodyULName).find("input:file").length>0){var formPerma=document.getElementById("formPerma").value;isIELessThan10()||isWindowSafari()?ZFLive.submitFiles():ZFLive.isOldUploadType?ZFLive.submitFormDataForLive(formPerma):this.SubmitData()}else this.SubmitData()},Array.isArrayCheck=function(obj){return"[object Array]"===Object.prototype.toString.call(obj)},ZFLive.setErrorMsg=function(linkName,value){var liElem=$("#"+linkName+"-li");if(linkName==ZFLiveConstants.RESPONSE.ERRORS){for(var errMsg=i18n.contactadmin,i=0;i1){var ul=document.createElement("ol");ul.className="uploadFieldError";for(var index=0;index1?($(removeEle).closest('div[name="fileElementDiv"]').remove(),triggerFormResize()):ZFLive.deleteMultiplyAddedFiles(linkName,removeEle,filepathtobedeleted);var fileElementDiv=$(ZFLive.formFormFieldsOuterWrapper).find("li[compname="+linkName+"]").find('div[name="fileElementDiv"]');for(index=0;index0&&(queryParams=window.location.href.slice(window.location.href.indexOf("?"))),formUrl=0===formPerma.length?"/"+this.portalName+"/form/"+this.formLinkName+queryParams:"/"+this.portalName+"/form/"+this.formLinkName+"/formperma/"+formPerma+queryParams,window.open(formUrl,"_self")},ZFLive.evalExpression=function(elem){if(typeof ZFLive.mode!=ResponseKey.UNDEFINED&&isAdvancedRule())zf_rule.evalAdvRulesOnFieldStateChange(zf_rule.on_form_load_ruleorder,elem,undefined,undefined),isOneFieldForm()&&updateSlides(),triggerFormResize();else{var thisFieldLi=isNewHtmlDOM()?$(elem).closest("div[elname=livefield-elem]"):$(elem).closest("li"),compname=$(thisFieldLi).attr("compname"),actualCompName=$(thisFieldLi).attr("linkname");if(compname==undefined&&(compname=elem),null!=ZFLive.formulaJson)for(var formulaJsonArr=JSON.parse(ZFLive.formulaJson),formulaInd=0;formulaInd1?iterateSFUlAndBindForumula($(liElem),linkName,compType):bindEventsOnFieldsForFormula(compType,linkName)}else if(compType==ZFFieldTypeConstants.MATRIX_CHOICE){var rules=formula.formula_rules;for(var j in rules){var conditions=rules[j].conditions;for(var k in conditions){var condition=conditions[k];if(condition.field_link_name==linkName)if(-1==$.inArray(condition.row,matrixRowArr))(liElem=getFieldElemWithFldLinkNameAttrLivefieldElem(linkName)).on("click","input[name="+condition.row+"]",function(){ZFLive.evalExpression(this)}),matrixRowArr.push(condition.row)}}}}})}}}if(null!=ZFLive.formulaFieldsList)for(var fieldsArr=JSON.parse(ZFLive.formulaFieldsList),fldInd=0;fldInd1?iterateSFUlAndBindForumula($(liElem),linkName,compType):bindEventsOnFieldsForFormula(compType,linkName)}}}},ZFLive.bindFormulaEventForSfFldElem=function(fldLinkName,newComponentName){var bindedFields=[];if(typeof ZFLive.formulaJson!=ResponseKey.UNDEFINED){var formulaJson=JSON.parse(ZFLive.formulaJson);for(var i in formulaJson){var formula=formulaJson[i];if(formula.formula_type==ZFFormulaTypeConstants.CONDITIONAL){var fldsInvolvedArr=formula.fields_in_formula_rule_expressions;if(-1!=$.inArray(fldLinkName,fldsInvolvedArr)&&-1==$.inArray(fldLinkName,bindedFields))bindedFields.push(fldLinkName),bindEventsOnFieldsForFormula(getFormFieldType(fldLinkName),newComponentName)}}}if(null!=ZFLive.formulaFieldsList){var fieldsArr=JSON.parse(ZFLive.formulaFieldsList);if(-1!=$.inArray(fldLinkName,fieldsArr)&&-1==$.inArray(fldLinkName,bindedFields))bindedFields.push(fldLinkName),bindEventsOnFieldsForFormula(getFormFieldType(fldLinkName),newComponentName)}},ZFLive.zoomImage=function(elem){var popupDiv=isStandardForm()&&isEmbeddedForm()?$("#iframe-media-popupdiv"):$("#popupdiv"),src=$(elem).parent().find("img").attr("src"),imgEle=$(popupDiv).find("img");$(imgEle).show();var originalSrc=$(elem).attr("originalsrc");if($(imgEle).attr("src",""),void 0!==originalSrc?(src=originalSrc+"&imageViewType=preview",$(imgEle).attr("src",src)):$(imgEle).attr("src",src),isStandardForm()&&isEmbeddedForm()){var refElem=event.target,popupCont=$(popupDiv).find("div[elname=popupCont]");setPopupPositionNearRefElem(popupCont,refElem,30,!0),$(popupDiv).show(),$(document).on("keyup.zoomimage",function(event){27==event.keyCode&&ZFLive.hideZoomedImage_iframe()})}else{var popUpContDiv=$(imgEle).parent();if($(popupDiv).show(),!isStandardForm()){setZoomPopUpElemPosition($("#imageChoiceDiv-cont"));var maxHt=$("#imageChoiceDiv-cont").height(),maxWt=$("#imageChoiceDiv-cont").width();$(popUpContDiv).height(maxHt-Math.max(0,$(window).height()/8)-72),$(popUpContDiv).width(maxWt-65),$(imgEle).css("max-width",maxWt-65),$(imgEle).css("max-height",maxHt-Math.max(0,$(window).height()/8)-85)}$(document).keyup(function(event){27==event.keyCode&&ZFLive.hideZoomedImage()})}$("body").addClass("hideWindowScroll")},ZFLive.zoomReviewImage=function(elem){var src=$(elem).parent().find("img").attr("src"),imgPopupDiv=$("#reviewImgpopupdiv"),imgEle=$(imgPopupDiv).find("img");$(imgEle).show();var originalSrc=$(elem).attr("originalsrc");void 0!==originalSrc&&(src=originalSrc+"&imageViewType=preview"),$(imgEle).attr("src",src);var popUpContDiv=$(imgEle).parent(),imgContDiv=$("#imageContDiv");if(!isStandardForm()){setZoomPopUpElemPosition(imgContDiv);var maxHt=$(imgContDiv).height(),maxWt=$(imgContDiv).width();$(popUpContDiv).height(maxHt-Math.max(0,$(window).height()/8)-72),$(popUpContDiv).width(maxWt-65),$(imgEle).css("max-width",maxWt-65),$(imgEle).css("max-height",maxHt-Math.max(0,$(window).height()/8)-85)}$(imgPopupDiv).show(),$("body").addClass("hideWindowScroll"),$(document).keyup(function(event){27===event.keyCode&&ZFLive.hideZoomedReviewImage()})},ZFLive.zoomTempImage=function(elem){var src=$(elem).parent().find("img").attr("src"),imgEle=$("#popupdiv").find("img");$(imgEle).show();$(elem).attr("originalsrc");if($(imgEle).attr("src",src),!isStandardForm()){var popUpContDiv=$(imgEle).parent();setZoomPopUpElemPosition($("#imageChoiceDiv-cont"));var maxHt=$("#imageChoiceDiv-cont").height(),maxWt=$("#imageChoiceDiv-cont").width();$(popUpContDiv).height(maxHt-Math.max(0,$(window).height()/8)-72),$(popUpContDiv).width(maxWt-65),$(imgEle).css("max-width",maxWt-65),$(imgEle).css("max-height",maxHt-Math.max(0,$(window).height()/8)-85)}$("#popupdiv").show(),$("body").addClass("hideWindowScroll"),$(document).keyup(function(event){27==event.keyCode&&ZFLive.hideZoomedImage()})},ZFLive.hideZoomedImage=function(linkName){var popupDiv=$("#popupdiv");$(popupDiv).fadeOut(),$(popupDiv).find("audio").attr("src","").hide(),$(popupDiv).find("video").attr("src","").hide(),$(popupDiv).find("img").attr("src","").hide(),$(popupDiv).find("p[elname=mediaPlayerError]").hide(),$("body").removeClass("hideWindowScroll\t"),isAccessibilitySupported()&&typeof linkName!==ResponseKey.UNDEFINED&&""!==linkName&&($("li[linkname="+linkName+"]").find("#previewMedia").focus(),$(document).off("keydown.previewmedia"))},ZFLive.hideZoomedImage_iframe=function(linkName){var popupDiv=$("#iframe-media-popupdiv");$(popupDiv).fadeOut(),$(popupDiv).find("audio").attr("src","").fadeOut(),$(popupDiv).find("video").attr("src","").fadeOut(),$(popupDiv).find("img").attr("src","").fadeOut(),$(popupDiv).find("p[elname=mediaPlayerError]").hide(),$("body").removeClass("hideWindowScroll\t"),isAccessibilitySupported()&&typeof linkName!==ResponseKey.UNDEFINED&&""!==linkName&&($("li[linkname="+linkName+"]").find("#previewMedia").focus(),$(document).off("keydown.previewmedia")),$(document).off("keyup.zoomimage")},ZFLive.hideZoomedReviewImage=function(elem){var reviewPopupDiv=$("#reviewImgpopupdiv");$(reviewPopupDiv).fadeOut(),$(reviewPopupDiv).find("audio").attr("src","").hide(),$(reviewPopupDiv).find("video").attr("src","").hide(),$(reviewPopupDiv).find("img").attr("src","").hide(),$(reviewPopupDiv).find("p[elname=mediaPlayerError]").hide(),$("body").removeClass("hideWindowScroll"),isAccessibilitySupported()&&typeof elem!==ResponseKey.UNDEFINED&&$(elem).focus()},ZFLive.selectImage=function(elem){if(isNewHtmlDOM()){var target=event.target;if($(target).closest('a[elname="zoom"]').length>0)return}ZFLive.hideClosestFieldElemErrorDiv(elem);var choiceContDiv=$(elem).closest('div[elname="choiceContDiv"]');if(!$(choiceContDiv).hasClass("disabled")){var inp=$(choiceContDiv).find("input");if(0!=$(inp).length){var type=$(inp).attr("type"),isChecked=$(inp).attr("prevVal");if("radio"==type){var parentli=isNewHtmlDOM()?$(elem).closest("div[elname=livefield-elem]"):$(elem).closest("li"),inputs=$(parentli).find("input");$(inputs).each(function(){$(this).attr("prevVal",!1),$(this).closest("div[elname=choiceContDiv]").removeClass("selected")})}"true"==isChecked?($(inp).prop("checked",!1),$(inp).attr("prevVal",!1),$(choiceContDiv).removeClass("selected")):($(inp).prop("checked",!0),$(inp).attr("prevVal",!0),$(choiceContDiv).addClass("selected"))}else{var imgChoiceElemDiv=$(choiceContDiv).closest('div[elname="imageChoiceEle"]'),isSingleSelect=$(imgChoiceElemDiv).attr("isSingleSelect"),imageSelectDiv=$(choiceContDiv).find("div[name=selectDiv]"),isSelected=$(imageSelectDiv).attr("selected");if("true"==isSingleSelect&&$(imgChoiceElemDiv).find('div[elname="choiceContDiv"]').each(function(index,el){$(el).removeClass("selected"),isAccessibilitySupported()&&$(el).find("div[name=selectDiv]").attr("aria-checked",!1),$(el).find("div[name=selectDiv]").removeAttr("selected")}),"selected"==isSelected){if($(imageSelectDiv).removeAttr("selected"),$(choiceContDiv).removeClass("selected"),isAccessibilitySupported()&&$(choiceContDiv).find("div[name=selectDiv]").attr("aria-checked",!1),!isNewHtmlDOM()){var emTag=$(choiceContDiv).find("em");$(emTag).hide()}}else{if(!isNewHtmlDOM()){emTag=$(choiceContDiv).find("em");$(emTag).show()}$(imageSelectDiv).attr("selected","selected"),$(choiceContDiv).addClass("selected"),isAccessibilitySupported()&&$(choiceContDiv).find("div[name=selectDiv]").attr("aria-checked",!0)}}if(null!=ZFLive.paymentMerchantList){var merchantsArr=JSON.parse(ZFLive.paymentMerchantList),compname=getClosestFieldElemLi(choiceContDiv).attr("compname");for(var key in merchantsArr){var linkName=merchantsArr[key].field_link_name;compname===linkName&&ZFLive.setValueInPayment(linkName)}}}},ZFLive.validatePage=function(pageNum,clearError,addRangeErrClass,fromElm,nextPageNo){emptyErrActionObj(),this.errorArray=new Array,this.errCnt=0,handleAccessibilityPageNav(pageNum);var currentPage=isStandardForm()?"div[elname=formBodyULName][page_no="+pageNum+"]":"ul[elname=formBodyULName][page_no="+pageNum+"]";if($(ZFLive.formFormFieldsOuterWrapper).find(currentPage).children('[elname="livefield-elem"]').each(function(index,elem){if("gridField"===$(elem).attr("elemtype")){if("true"==$(elem).attr("needdata")){var gridChildFieldIterator=$(elem).find("div[elname=livefield-elem][reltype=parent]");$(gridChildFieldIterator).each(function(index,gridFieldElem){clearError?($(gridFieldElem).hasClass("error")||$(gridFieldElem).find("span").hasClass("error1"))&&(ZFLive.validateField(gridFieldElem,addRangeErrClass,!1),checkErrTrackFieldListAndRemoveErrorFromLiElem(gridFieldElem)):(ZFLive.validateField(gridFieldElem,addRangeErrClass,!1),checkErrTrackFieldListAndRemoveErrorFromLiElem(gridFieldElem))}),showErrForCollapsedGrid(elem)}}else clearError?($(elem).hasClass("error")||$(elem).find("span").hasClass("error1"))&&(ZFLive.validateField(elem,addRangeErrClass,!1),checkErrTrackFieldListAndRemoveErrorFromLiElem(elem)):(ZFLive.validateField(elem,addRangeErrClass,!1),checkErrTrackFieldListAndRemoveErrorFromLiElem(elem))}),this.errorArray.length&&(triggerFormResizeOnTimeOut(),addEachErrorForAccessibility(this.errorArray,!0)),null!=fromElm){var validateJson={},errorObj=[];clearError||($.isEmptyObject(this.errorArray)?validateJson=constructValidateJson(pageNum):errorObj=this.errorArray),$.isEmptyObject(validateJson)?nextPageErrorHandling(pageNum,errorObj,fromElm,nextPageNo):ZFLive.recordValidation(validateJson,pageNum,fromElm,nextPageNo)}},ZFLive.recordValidation=function(validateJson,pageNum,fromElm,nextPageNo){$("#bgFreezeDiv").show(),$("#validateLoading").show(),setPopUpElemPosition($("#validateLoadingCont"));var formPerma=document.getElementById("formPerma").value,ajaxOpts={URI:ZFLive.mode==Mode.LIVE?0===formPerma.length?"/"+ZFLive.portalName+"/form_id/"+ZFLive.formID+"/records/validate":"/"+ZFLive.portalName+"/form_id/"+ZFLive.formID+"/formperma/"+formPerma+"/records/validate":0===formPerma.length?"/"+ZFLive.portalName+"/form_id/"+ZFLive.formID+"/record/"+ZFLive.encodedString+"/validate":"/"+ZFLive.portalName+"/form_id/"+ZFLive.formID+"/publicrecord/"+ZFLive.encodedString+"/validate",METHOD:"POST",DATATYPE:"json",CONTENTTYPE:"application/json",DATA:JSON.stringify(validateJson),CALLBACK:function(jsonData,ajaxOpts,jqXhr){var errorObj;($("#bgFreezeDiv").hide(),$("#validateLoading").hide(),200===jqXhr.status)?nextPageErrorHandling(pageNum,errorObj=[],fromElm,nextPageNo):400===jqXhr.status?0==(errorObj=JSON.parse(jqXhr.responseText).errors).length?nextPageErrorHandling(pageNum,errorObj,fromElm,nextPageNo):(ZFLive.constructLiveErrorMessage(jqXhr,!0),triggerFormResizeOnTimeOut()):403===jqXhr.status?ZFLive.isFormAdmin?showErrorPopUp(i18n.oopserrmsg,i18n.erroroccurred):showErrorPopUp(i18n.oopserrmsg,i18n.contactadmin):(ZFLive.constructLiveErrorMessage(jqXhr,!0),triggerFormResizeOnTimeOut())}};ZFUtil.sendAjax(ajaxOpts,this,ZFLive.isPublicFormAccess)},ZFLive.modifyMerchantType=function(elem){var merchantElem=$(elem).parents("div[elname=merchantDiv]"),newMerchantType=$(elem).attr("merchantType"),oldMerchantType=$(merchantElem).attr("merchantType"),isMandatory=$(merchantElem).attr("mandatory"),pymntLi=$("#PaymentAmount-li");addErrorForAccessibility(SystemGeneratedField.PAYMENT_AMOUNT.LINK_NAME,!1),isAccessibilitySupported()&&($(merchantElem).find("a[merchantType="+newMerchantType+"]").attr("aria-selected","true"),$(merchantElem).find("a[merchantType="+oldMerchantType+"]").attr("aria-selected","false")),oldMerchantType!==ResponseKey.UNDEFINED&&""!=oldMerchantType&&newMerchantType!=oldMerchantType?(oldMerchantType==ZFFormPayments.MERCHANT_TYPE.STRIPE?($(pymntLi).find("div[elname=stripeMerchantDiv]").hide(),$("#payment-error").hide()):oldMerchantType==ZFFormPayments.MERCHANT_TYPE.AUTHORIZE_NET?($(pymntLi).find("div[elname=authNetMerchantDiv]").hide(),$(pymntLi).find("span[elname=authNetPaymentError]").hide()):oldMerchantType==ZFFormPayments.MERCHANT_TYPE.SQUARE&&($(pymntLi).find("div[elname=squareMerchantDiv]").hide(),$(pymntLi).find("span[elname=squarePaymentError]").hide()),$(merchantElem).find("a[merchantType="+oldMerchantType+"]").removeClass("selected"),ZFLive.setPaymentAmountDetail(elem,merchantElem,newMerchantType)):"false"==isMandatory&&($(elem).hasClass("selected")?($(elem).removeClass("selected"),$(pymntLi).find("div[elname=paymentDetailsDiv]").hide(),newMerchantType==ZFFormPayments.MERCHANT_TYPE.STRIPE?($(pymntLi).find("div[elname=stripeMerchantDiv]").hide(),$("#payment-error").hide()):newMerchantType==ZFFormPayments.MERCHANT_TYPE.AUTHORIZE_NET?($(pymntLi).find("div[elname=authNetMerchantDiv]").hide(),$("#formBodyDiv").find(".pmnt").find("span[elname=authNetPaymentError]").hide()):newMerchantType==ZFFormPayments.MERCHANT_TYPE.SQUARE&&($(pymntLi).find("div[elname=squareMerchantDiv]").hide(),$(pymntLi).find("span[elname=squarePaymentError]").hide()),$(merchantElem).attr("merchantType","")):ZFLive.setPaymentAmountDetail(elem,merchantElem,newMerchantType)),isAccessibilitySupported()&&($(pymntLi).find("a").attr("tabindex",-1),$(pymntLi).find("a.selected").attr("tabindex",0)),isOneFieldForm()&&$(elem).blur()},ZFLive.setPaymentAmountDetail=function(elem,merchantElem,newMerchantType){var pymntLi=$("#PaymentAmount-li");isAccessibilitySupported()&&$(pymntLi).find("input[name=PaymentAmount]").attr("aria-labelledby","PaymentAmount-currtype-"+$(elem).attr("merchanttype")),$(merchantElem).attr("merchantType",newMerchantType),$(elem).addClass("selected"),$(pymntLi).find("div[elname=paymentDetailsDiv]").show(),newMerchantType==ZFFormPayments.MERCHANT_TYPE.STRIPE?($(pymntLi).find("div[elname=stripeMerchantDiv]").show(),$(pymntLi).find("div[elname=stripeMerchantDiv]").hasClass("error1")&&$("#payment-error").show()):newMerchantType==ZFFormPayments.MERCHANT_TYPE.AUTHORIZE_NET?($(pymntLi).find("div[elname=authNetMerchantDiv]").show(),$(pymntLi).find("div[elname=authNetMerchantDiv]").hasClass("error1")&&$(pymntLi).find("span[elname=authNetPaymentError]").show()):newMerchantType==ZFFormPayments.MERCHANT_TYPE.SQUARE&&($(pymntLi).find("div[elname=squareMerchantDiv]").show(),$(pymntLi).find("div[elname=squareMerchantDiv]").hasClass("error1")&&$(pymntLi).find("span[elname=squarePaymentError]").show()),isStandardForm()&&($(pymntLi).find("div[elname=paymentDetailsDiv]").removeClass("authNetCardContainer squareCardContainer"),newMerchantType==ZFFormPayments.MERCHANT_TYPE.AUTHORIZE_NET?$(pymntLi).find("div[elname=paymentDetailsDiv]").addClass("authNetCardContainer"):newMerchantType==ZFFormPayments.MERCHANT_TYPE.SQUARE&&$(pymntLi).find("div[elname=paymentDetailsDiv]").addClass("squareCardContainer")),isOneFieldForm()?multiSelectValChange():triggerFormResize();var currencyPosition=$(elem).attr("currencyPos"),currencyCode=$(elem).attr("currencyCode"),currencyValue="";$.each(currencyHashcode,function(key,value){if(key==currencyCode){var currSymSpanBefore=$(pymntLi).find("div[elname=paymentDetailsDiv]").find("span[name=currencysymbol1]"),currSymSpanAfter=$(pymntLi).find("div[elname=paymentDetailsDiv]").find("span[name=currencysymbol2]");"1"==currencyPosition?(currSymSpanBefore.html(value),currSymSpanBefore.show(),currSymSpanAfter.hide()):(currSymSpanAfter.html(value),currSymSpanAfter.show(),currSymSpanBefore.hide()),currencyValue=value}});var paymentType=$(merchantElem).attr("paymentType"),amountType=$.trim($(elem).attr("amountType"));if($(pymntLi).find("div[elname=paymentDetailsDiv]").removeClass("error1"),$("#error-PaymentAmount").hide(),paymentType==ZFFormPayments.PAYMENT_TYPE.REGISTRATION)if(2==amountType)ZFLive.changeValueInPayment(newMerchantType,paymentType);else{var amount=$(elem).attr("amount");null!=amount&&""!=amount&&$(pymntLi).find("div[elname=paymentDetailsDiv]").find("input[name=PaymentAmount]").val(amount)}else if(paymentType==ZFFormPayments.PAYMENT_TYPE.DONATION){var dispAmnt=$.trim($(elem).attr("dispamnt")),minAmnt=$.trim($(elem).attr("minamnt")),maxAmnt=$.trim($(elem).attr("maxamnt"));""!=dispAmnt?$(pymntLi).find("div[elname=paymentDetailsDiv]").find("input[name=PaymentAmount]").val(dispAmnt):$(pymntLi).find("div[elname=paymentDetailsDiv]").find("input[name=PaymentAmount]").val(""),""!=minAmnt&&""!=maxAmnt?$(pymntLi).find("div[elname=paymentDetailsDiv]").find("p[elemType=instruction]").text("( "+ZFUtil.replaceParamsArr(i18n.donationhintmsgminmax,[minAmnt,maxAmnt])+" )").show():""!=minAmnt&&""==maxAmnt?($(pymntLi).find("div[elname=paymentDetailsDiv]").find("p[elemType=instruction]").text("( "+i18n.donationhintmsgmin).show(),$(pymntLi).find("div[elname=paymentDetailsDiv]").find("p[elemType=instruction]").append(" "+currencyValue+minAmnt+" )")):""==minAmnt&&""!=maxAmnt?($(pymntLi).find("div[elname=paymentDetailsDiv]").find("p[elemType=instruction]").text("( "+i18n.donationhintmsgmax).show(),$(pymntLi).find("div[elname=paymentDetailsDiv]").find("p[elemType=instruction]").append(" "+currencyValue+maxAmnt+" )")):$(pymntLi).find("div[elname=paymentDetailsDiv]").find("p[elemType=instruction]").hide(),2==amountType&&(""!=dispAmnt?ZFLive.changeValueInPayment(newMerchantType,paymentType,dispAmnt):ZFLive.changeValueInPayment(newMerchantType,paymentType))}},ZFLive.setValueInPayment=function(fieldLinkName){var paymentLi=$("#PaymentAmount-li"),paymentDiv=$(paymentLi).find("div[elname=merchantDiv]"),selectedMerchantType=$(paymentDiv).attr("merchantType"),pymntType=$(paymentDiv).attr("paymenttype");if(null!=selectedMerchantType&&""!=selectedMerchantType&&null!=ZFLive.paymentMerchantList){var merchantsArr=JSON.parse(ZFLive.paymentMerchantList);for(var key in merchantsArr){var merchantJson=merchantsArr[key],merchantType=merchantJson.merchant_type,linkName=merchantJson.field_link_name;if(selectedMerchantType==merchantType&&linkName==fieldLinkName){var validVal=getValidPaymentValue(getValue(fieldLinkName),pymntType);if(2==pymntType){var dispAmnt=$(paymentDiv).find("a").attr("dispamnt"),fldLiElem=getFieldElem(fieldLinkName);parseInt($(fldLiElem).attr("comptype"))!=ZFFieldTypeConstants.FORMULA?ZFUtil.isDataNeeded(fldLiElem)?$(paymentLi).find("div[elname=paymentDetailsDiv]").find("input[name=PaymentAmount]").val(validVal):""==validVal&&dispAmnt!=undefined&&""!=dispAmnt&&$(paymentLi).find("div[elname=paymentDetailsDiv]").find("input[name=PaymentAmount]").val(dispAmnt):$(paymentLi).find("div[elname=paymentDetailsDiv]").find("input[name=PaymentAmount]").val(validVal)}else $(paymentLi).find("div[elname=paymentDetailsDiv]").find("input[name=PaymentAmount]").val(validVal)}}}},ZFLive.changeValueInPayment=function(selectedMerchantType,pymntType,initDispAmnt){var merchantsArr=JSON.parse(ZFLive.paymentMerchantList);for(var key in merchantsArr){var merchantJson=merchantsArr[key];if(selectedMerchantType==merchantJson.merchant_type){var validVal=getValidPaymentValue(getValue(merchantJson.field_link_name),pymntType);initDispAmnt&&""===validVal&&(validVal=initDispAmnt),$("#PaymentAmount-li").find("div[elname=paymentDetailsDiv]").find("input[name=PaymentAmount]").val(validVal)}}},ZFLive.bindEventForPaymentAutoFill=function(){var merchantsArr=JSON.parse(ZFLive.paymentMerchantList);for(var key in merchantsArr){var linkName=merchantsArr[key].field_link_name,compType=getFormFieldType(linkName),liElem=getFieldElem(linkName);if(compType==ZFFieldTypeConstants.NUMBER||compType==ZFFieldTypeConstants.CURRENCY||compType==ZFFieldTypeConstants.DECIMAL)$(liElem).on("blur","input",autoFillPayment(linkName));else if(compType==ZFFieldTypeConstants.RATING)$(liElem).on("click","a,span",autoFillPayment(linkName));else if(compType==ZFFieldTypeConstants.SLIDER){var sliderElems=$(liElem).find("a");for(index=0;index0?(ZFLive.checkIfIdentical(elem,compname,!0),addErrorForAccessibility(compname+"-reconf",!0)):(ZFLive.checkIfIdentical(elem,compname,!1),addErrorForAccessibility(compname+"-reconf",!0))}}}typeof ZFLive.mode==ResponseKey.UNDEFINED||ZFLive.mode!=Mode.LIVE&&ZFLive.mode!=Mode.SAVED_RECORD&&ZFLive.mode!=Mode.EDIT||this.prefillFieldLabel(input),setSfTotalVal(elem)},ZFLive.validateFieldConstraintAndGetRes=function(elem,input){var compname=$(elem).attr("compname"),errorIdd=ZFLive.errorId(compname),comptype=parseInt($(elem).attr("comptype")),validationLiResult=!1;return ZFLive.formatFldValBeforeValidation(comptype,elem,input,compname),isIELessThan9()||typeof ZFLive.constraintJson===ResponseKey.UNDEFINED||(validationLiResult=validateConstrLiElem(elem,compname,errorIdd,input)),validationLiResult},ZFLive.formatFldValBeforeValidation=function(comptype,elem,input,compname){if(comptype===ZFFieldTypeConstants.NUMBER)removeLeadingZeros(elem);else if(comptype===ZFFieldTypeConstants.CURRENCY||comptype===ZFFieldTypeConstants.DECIMAL)removeLeadingZeros(elem),formatDecimalValue(elem,comptype,compname);else if(comptype===ZFFieldTypeConstants.PHONE){var fldDiv=$(elem).find("div[elname=phoneFormatElem]");$(fldDiv).attr("phoneFormat")===ZFPhoneFormatConstants.INTERNATIONAL&&removeMultiSpaceAndSave(elem)}else comptype===ZFFieldTypeConstants.MATRIX_CHOICE&&formatMatrixNumbCurrValue(input)},ZFLive.prefillFieldLabelFromLiElem=function(liElem,isFromOnLoad,compLinkName){var val="___",comptype=parseInt($(liElem).attr("comptype"));if(isAllowedFldTypeForPrefillLabel(comptype)){var compname=$(liElem).attr("compname");if(ZFLive.fldsInvolvedInAdvDispName.indexOf(compname)>-1){var fieldJson={};comptype===ZFFieldTypeConstants.FORMULA?constructNormalField(fieldJson,liElem):constructFormFieldDataJsonCommon(fieldJson,liElem,!0);var needData=isDataNeededForThisElem(liElem);if(comptype==ZFFieldTypeConstants.NAME||comptype==ZFFieldTypeConstants.ADDRESS){var componentJson=fieldJson[compname];compLinkName!=undefined?(val=componentJson[compLinkName],setValueInFldLabel(compLinkName,val,isFromOnLoad,comptype,needData)):$(liElem).find("input, select").each(function(){compLinkName=$(this).attr("complink"),val=componentJson[compLinkName],setValueInFldLabel(compLinkName,val,isFromOnLoad,comptype,needData)})}else{if(val=fieldJson[compname],comptype==ZFFieldTypeConstants.DROPDOWN){var groupname=compname+"_group_name";if(fieldJson.hasOwnProperty(groupname)){var optGrpName=fieldJson[groupname];null!==optGrpName&&""!==optGrpName&&(val=$.trim(optGrpName)+" - "+$.trim(val))}}else if(comptype==ZFFieldTypeConstants.PHONE){var countryCode=fieldJson[compname+"_country_code"];countryCode!==undefined&&(val=countryCode+val)}setValueInFldLabel(compname,val,isFromOnLoad,comptype,needData)}}}},ZFLive.prefillFieldLabel=function(elem){var compLinkName,fldElem=getClosestFieldElemLi(elem),compType=$(fldElem).attr("comptype");compType!=ZFFieldTypeConstants.NAME&&compType!=ZFFieldTypeConstants.ADDRESS||(compLinkName=$(elem).attr("complink")),ZFLive.prefillFieldLabelFromLiElem(fldElem,!1,compLinkName)},ZFLive.preevalPrefillFldLabelOnLoad=function(){ZFLive.fldsInvolvedInAdvDispName.forEach(function(fldLinkName){var fldElem=getFieldElemWithFldLinkNameAttrLivefieldElem(fldLinkName);ZFLive.preevalPrefillFldLabel(fldElem)})},ZFLive.checkAndPrefillFldLabelAfterRule=function(ruleResultObj,groupActionVisibleHiddenJsonObj){if(ZFLive.fldsInvolvedInAdvDispName.length>0){var fieldsObjInvolvedShowInGroupAction=groupActionVisibleHiddenJsonObj[ZFRuleConstants.SHOW_GROUP];for(var fldLinkName in fieldsObjInvolvedShowInGroupAction)ZFLive.validateFldLinkNameAndPrefillFldLabel(fldLinkName);var fieldsObjInvolvedInHideGroupAction=groupActionVisibleHiddenJsonObj[ZFRuleConstants.HIDE_GROUP];for(var fldLinkName in fieldsObjInvolvedInHideGroupAction)ZFLive.validateFldLinkNameAndPrefillFldLabel(fldLinkName);ruleResultObj.fieldVisibilityChangeList.forEach(function(fldLinkName){ZFLive.validateFldLinkNameAndPrefillFldLabel(fldLinkName)})}},ZFLive.validateFldLinkNameAndPrefillFldLabel=function(fldLinkName){if(ZFLive.fldsInvolvedInAdvDispName.indexOf(fldLinkName)>-1){var fldElem=getFieldElemWithFldLinkNameAttrLivefieldElem(fldLinkName);ZFLive.preevalPrefillFldLabel(fldElem)}},ZFLive.preevalPrefillFldLabel=function(fldElem){var comptype=$(fldElem).attr("comptype"),sfParent=isStandardForm()?$(fldElem).closest("div[elname=subFormFieldsUl]"):$(fldElem).closest("ul");if(isAllowedFldTypeForPrefillLabel(comptype)&&(isOneFieldForm()||!isOneFieldForm()&&"subFormFieldsUl"!==$(sfParent).attr("elname"))){var fldLiElem=getClosestFieldElemLi(fldElem);ZFLive.prefillFieldLabelFromLiElem(fldLiElem,!0)}},ZFLive.validateFieldEquality=function(elem,setError){var parentLiElem=isNewHtmlDOM()?$(elem).closest("div[elname=livefield-elem]"):$(elem).closest("li[elname=livefield-elem]"),comptype=parseInt($(parentLiElem).attr("comptype")),parentCompname=$(parentLiElem).attr("compname");isStandardForm()&&setError?(comptype===ZFFieldTypeConstants.PHONE?ZFLive.validateFieldConstraint($(parentLiElem).find("input[elname=countrycode]")):ZFLive.validateFieldConstraint($(parentLiElem).find("input[name="+parentCompname+"]")),setTimeout(function(){ZFLive.validateFieldEqualityCommon(elem,parentLiElem,setError)})):ZFLive.validateFieldEqualityCommon(elem,parentLiElem,setError)},ZFLive.validateFieldEqualityCommon=function(elem,parentLiElem,setError){var isValid,comptype=parseInt($(parentLiElem).attr("comptype")),parentCompname=$(parentLiElem).attr("compname");if(comptype===ZFFieldTypeConstants.PHONE){var phoneFormat=$(parentLiElem).find("div[elname=phoneFormatElem]").attr("phoneFormat");if(phoneFormat===ZFPhoneFormatConstants.USAFORMAT&&ZFUtil.focusNext(elem,event),phoneFormat===ZFPhoneFormatConstants.INTERNATIONAL&&setError){var confInputElem=$(parentLiElem).find("input[elname=countrycodeConf]"),confVal=confInputElem.val();confInputElem.val(ZFLive.removeMultiSpace(confVal))}addErrorForAccessibility(parentCompname+"-reconf",!(isValid=ZFLive.checkPhFldIdentical(parentLiElem,parentCompname,setError,!0)))}else addErrorForAccessibility(parentCompname+"-reconf",!(isValid=ZFLive.checkIfIdentical(parentLiElem,parentCompname,setError)));isSfChild(parentLiElem)&&validateSFUniqueOnReConf(parentLiElem,isValid)},ZFLive.checkIfIdentical=function(parentLiElem,parentCompname,setError){var reconfCompname=parentCompname+"-reconf",inp1=$(parentLiElem).find("input[name="+parentCompname+"]").val(),inp2=$(parentLiElem).find("input[name="+reconfCompname+"]").val(),parentErrorId=ZFLive.errorId(parentCompname),reconfErrorId=ZFLive.errorId(reconfCompname);if(checkAndRemoveReconfError(inp1,inp2,parentLiElem))return!0;if(typeof setError!=ResponseKey.UNDEFINED&&1==setError){var idAttr=$(parentLiElem).attr("id");if(!ZFLive.currentActionErrFieldsList.includes(idAttr)){var comptype=parseInt($(parentLiElem).attr("comptype"));setErrorForConfirm(parentErrorId,reconfErrorId,this.getConfirmationErrorMsg(comptype))}}return!1},ZFLive.getConfirmationErrorMsg=function(comptype){return comptype===ZFFieldTypeConstants.EMAIL?ZFLiveErrorConstants.emailsdonotmatch:comptype===ZFFieldTypeConstants.NUMBER?ZFLiveErrorConstants.numbersdonotmatch:comptype===ZFFieldTypeConstants.DECIMAL?ZFLiveErrorConstants.decimaldonotmatch:comptype===ZFFieldTypeConstants.CURRENCY?ZFLiveErrorConstants.currencydonotmatch:void 0},ZFLive.checkPhFldIdentical=function(parentLiElem,parentCompname,setError,isKeyUpValidation){var reconfCompname=parentCompname+"-reconf",phoneFormat=$(parentLiElem).find("div[elname=phoneFormatElem]").attr("phoneFormat"),parentErrorId=ZFLive.errorId(parentCompname),reconfErrorId=ZFLive.errorId(reconfCompname),inp1="",inp2="";if(phoneFormat===ZFPhoneFormatConstants.USAFORMAT)$(parentLiElem).find("div[elname=phoneFld]").find("input").each(function(indexelem,elemnew){var val=$.trim($(elemnew).val());inp1+=val}),$(parentLiElem).find("div[elname=confPhoneFld]").find("input").each(function(indexelem,elemnew){var val=$.trim($(elemnew).val());inp2+=val});else if(inp1=$(parentLiElem).find("input[elname=countrycode]").val(),inp2=$(parentLiElem).find("input[elname=countrycodeConf]").val(),"true"==$(parentLiElem).find("input[elname=countrycode]").attr("iscodeEnabled")){var linkName=$(parentLiElem).attr("compname");""!=inp1&&(inp1=getPhoneValWithCountryCode(parentLiElem,linkName)+inp1),""!=inp2&&(inp2=getPhoneValWithCountryCode(parentLiElem,linkName+"-reconf")+inp2)}if(checkAndRemoveReconfError(inp1,inp2,parentLiElem))return!0;if(typeof setError!=ResponseKey.UNDEFINED&&1==setError)if(isKeyUpValidation&&phoneFormat===ZFPhoneFormatConstants.USAFORMAT)setTimeout(function(){getDocumentActiveLiElementCompName();if(needToValidatePhone(parentCompname,"phoneFld")){var idAttr=$(parentLiElem).attr("id");ZFLive.currentActionErrFieldsList.includes(idAttr)||setErrorForConfirm(parentErrorId,reconfErrorId,ZFLiveErrorConstants.phonenosdonotmatch)}},0);else{var idAttr=$(parentLiElem).attr("id");ZFLive.currentActionErrFieldsList.includes(idAttr)||setErrorForConfirm(parentErrorId,reconfErrorId,ZFLiveErrorConstants.phonenosdonotmatch)}return!1},ZFLive.handleKeyNavigationsForDatePicker=function(elem,event,isMonthDateChange){if(isAccessibilitySupported()&&(isMonthDateChange||!isMonthDateChange&&40==event.keyCode)){var setFocuedElem=$("#ui-datepicker-div").find(".ui-state-active");0===$(setFocuedElem).length&&(setFocuedElem=$("#ui-datepicker-div").find(".ui-state-highlight")),0===$(setFocuedElem).length&&(setFocuedElem=$("#ui-datepicker-div").find("table.ui-datepicker-calendar").find("a.ui-state-default:visible:first")),setTimeout(function(){$(elem).select(),$(setFocuedElem).focus()},0)}},ZFLive.handleTabKeyNavForCommonPopupCase=function(elem,elements,currentElementIndex,eventName,needAccessibilityCheck){(isAccessibilitySupported()||void 0!==needAccessibilityCheck&&!needAccessibilityCheck)&&$(elem).off(eventName).on(eventName,function(event){if(event.shiftKey&&9===event.keyCode){event.preventDefault();var prevElementIndex=(currentElementIndex-1+elements.length)%elements.length;$(elements[prevElementIndex]).focus(),currentElementIndex=prevElementIndex}else if(9===event.keyCode){event.preventDefault();var nextElementIndex=(currentElementIndex+1)%elements.length;$(elements[nextElementIndex]).focus(),currentElementIndex=nextElementIndex}})},ZFLive.handleTabKeyNavigationDatePicker=function(isDateTimePicker,dateDiv){if(isAccessibilitySupported()){var datePicker=$("#ui-datepicker-div");$(datePicker).find(".ui-state-disabled").attr({tabindex:-1,"aria-disabled":"true"});var element1=$(datePicker).find("a.ui-datepicker-prev"),element2=$(datePicker).find("select.ui-datepicker-month").next().find("span.select2-selection"),element3=$(datePicker).find("select.ui-datepicker-year").next().find("span.select2-selection"),element4=$(datePicker).find("a.ui-datepicker-next"),setFocuedElem=$("#ui-datepicker-div").find(".ui-state-active");0==setFocuedElem.length&&(setFocuedElem=$("#ui-datepicker-div").find(".ui-state-highlight")),0==setFocuedElem.length&&(setFocuedElem=$("#ui-datepicker-div").find("table.ui-datepicker-calendar").find("a.ui-state-default:visible:first"));var element5=setFocuedElem;$(datePicker).find("[data-handler=selectDay]").find("a").attr({tabindex:-1,role:"button"}),$(element1).attr({tabindex:0,role:"button","aria-label":i18n.prevmonth}),$(element2).attr("tabindex",0),$(element3).attr("tabindex",0),handleDateTimeAriaAttr(dateDiv,$(element2),"month"),handleDateTimeAriaAttr(dateDiv,$(element3),"year"),$(element4).attr({tabindex:0,role:"button","aria-label":i18n.nextmonth}),$(element5).attr("tabindex",0);var elements=[element1,element2,element3,element4,element5];if(isDateTimePicker)if(0!==$("#ui-datepicker-div").find("[name=slots]").length){var element6=$("#ui-datepicker-div").find("[name=slots]").next().find("span.select2-selection");handleDateTimeAriaAttr(dateDiv,$(element6),"slots"),$(element6).attr("tabindex",0),elements=[element6,element1,element2,element3,element4,element5]}else{element6=$("#ui-datepicker-div").find("select[name=hours]").next().find("span.select2-selection");var element7=$("#ui-datepicker-div").find("select[name=minutes]").next().find("span.select2-selection"),element8=$("#ui-datepicker-div").find("select[name=Meridiem]").next().find("span.select2-selection");handleDateTimeAriaAttr(dateDiv,$(element6),"hours"),handleDateTimeAriaAttr(dateDiv,$(element7),"minutes"),handleDateTimeAriaAttr(dateDiv,$(element8),"meridiem"),$(element6).attr("tabindex",0),$(element7).attr("tabindex",0),$(element8).attr("tabindex",0),elements=[element6,element7,element8,element1,element2,element3,element4,element5]}var currentElementIndex=-1;$("#ui-datepicker-div").off("keydown.custom").on("keydown.custom",function(event){if($("#ui-datepicker-div").focus(),event.shiftKey&&9===event.keyCode){event.preventDefault();var prevElementIndex=(currentElementIndex-1+elements.length)%elements.length;$(elements[prevElementIndex]).focus(),currentElementIndex=prevElementIndex}else if(9===event.keyCode){event.preventDefault();var nextElementIndex=(currentElementIndex+1)%elements.length;0===nextElementIndex?setTimeout(function(){$(elements[nextElementIndex]).focus()},100):$(elements[nextElementIndex]).focus(),currentElementIndex=nextElementIndex}})}},ZFLive.handleKeyNavigationForPaymentFocus=function(elem,event){if(isAccessibilitySupported()){for(var focusedElem="",paymentElem=$(elem).find("a"),i=0;i0)ZFLive.updateStateChoicesListForAddrStateDd(countryFld);else if(-1!==$.inArray(countryCodeVal,countriesToGetStatesList)){compname=$(subformChild).attr("compname");ZFLive.StateFldComplinkNames[compname]=countryCodeVal}}return countriesToGetStatesList},ZFLive.bindChangeToAddrFldAndCheckStatesListExistOnLoad=function(){var countriesToGetStatesList=[],isOneFieldform=!!isOneFieldForm();isNewHtmlDOM()?(getFormBodyDiv().find("div[elname=livefield-elem][reltype=parent][comptype="+ZFFieldTypeConstants.ADDRESS+"]").each(function(index,fldElem){countriesToGetStatesList=ZFLive.bindChangeToAddrFldAndCheckStatesListExist(fldElem,countriesToGetStatesList,isOneFieldform)}),getFormBodyDiv().find("div[elname=livefield-elem][reltype=parent][elemtype=subFormField]").each(function(index,subformElem){$(subformElem).find("div[elname=subFormFieldsUl]").find("div[elname=livefield-elem][reltype=child][comptype="+ZFFieldTypeConstants.ADDRESS+"]").each(function(index,subformChild){countriesToGetStatesList=ZFLive.bindChangeToAddrFldAndCheckStatesListExistInSf(subformChild,countriesToGetStatesList,isOneFieldform,!1)})})):(getFormBodyDiv().find("ul[elname=formBodyULName]").children("li[elname=livefield-elem][comptype="+ZFFieldTypeConstants.ADDRESS+"]").each(function(index,fldElem){countriesToGetStatesList=ZFLive.bindChangeToAddrFldAndCheckStatesListExist(fldElem,countriesToGetStatesList,isOneFieldform)}),getFormBodyDiv().find("ul[elname=formBodyULName]").children("li[elname=livefield-elem][elemtype=subFormField]").each(function(index,subformElem){$(subformElem).find("ul[elname=subFormFieldsUl]").find("li[elname=livefield-elem][comptype="+ZFFieldTypeConstants.ADDRESS+"]").each(function(index,subformChild){countriesToGetStatesList=ZFLive.bindChangeToAddrFldAndCheckStatesListExistInSf(subformChild,countriesToGetStatesList,isOneFieldform,!1)})})),countriesToGetStatesList.length>0&&ZFLive.getStatesListForAddrStateDd(countriesToGetStatesList,isOneFieldform)},ZFLive.getStatesListForAddrStateDd=function(countriesToGetStatesList,isOneFieldform){countriesToGetStatesList=JSON.stringify(countriesToGetStatesList);var langCode=$("#langcode").val(),reqUri="/"+ZFLive.portalName+"/getStates?countryList="+encodeURIComponent(countriesToGetStatesList);typeof langCode!=ResponseKey.UNDEFINED&&(reqUri+="&zf_lang="+langCode);var ajaxOpts={URI:reqUri,METHOD:ZFHttp.GET,ACCEPT:ZFMimeType.APPLICATION_JSON,CALLBACK:function(jsonData,ajaxOpts,jqXhr){if(200==jqXhr.status){var stateList=JSON.parse(jqXhr.responseText);$.each(stateList,function(key,value){ZFLive.addressStateList[key]=value})}else $.each(countriesToGetStatesList,function(key,value){ZFLive.addressStateList[value]=[]});$.each(ZFLive.StateFldComplinkNames,function(key,value){var stateDropdown;if(-1==key.indexOf("_")){var addrFldLi;addrFldLi=isNewHtmlDOM()?$("div[id="+key+"-li]"):$("li[id="+key+"-li]"),stateDropdown=$(addrFldLi).find("select[complink="+key+ZFFormField.ADDRESS.STATE.KEY+"]")}else{var elem;elem=isNewHtmlDOM()?$("div[id="+key+"-li]"):$("li[id="+key+"-li]");var linkname=key.split("_")[0];stateDropdown=$(elem).find("select[complink="+linkname+ZFFormField.ADDRESS.STATE.KEY+"]")}updateStateDdInAddrStateDd(value,stateDropdown)}),ZFLive.StateFldComplinkNames={}}};ZFUtil.sendAjax(ajaxOpts,this,ZFLive.isPublicFormAccess)},ZFLive.getStatesListForAddrStateDdAndValidateFieldConstraint=function(inputElem,isOneFieldForm,isSfchild){var countryCodeVal=$(inputElem).find("option:selected").attr("ctrycode");if(typeof countryCodeVal!=ResponseKey.UNDEFINED)if(typeof ZFLive.addressStateList[countryCodeVal]==ResponseKey.UNDEFINED){var countriesToGetStatesList=[];countriesToGetStatesList.push(countryCodeVal),countriesToGetStatesList=JSON.stringify(countriesToGetStatesList);var langCode=$("#langcode").val(),reqUri="/"+ZFLive.portalName+"/getStates?countryList="+encodeURIComponent(countriesToGetStatesList);typeof langCode!=ResponseKey.UNDEFINED&&(reqUri+="&zf_lang="+langCode);var ajaxOpts={URI:reqUri,METHOD:ZFHttp.GET,ACCEPT:ZFMimeType.APPLICATION_JSON,CALLBACK:function(jsonData,ajaxOpts,jqXhr){if(200==jqXhr.status){var stateList=JSON.parse(jqXhr.responseText);$.each(stateList,function(key,value){ZFLive.addressStateList[key]=value})}else ZFLive.addressStateList[countryCodeVal]=[];ZFLive.updateStateChoicesListForAddrStateDd(inputElem),isOneFieldForm?isSfchild?ZFLive.validateFieldConstraintOF_SF(inputElem):ZFLive.validateFieldConstraintOF(inputElem):ZFLive.validateFieldConstraint(inputElem)}};ZFUtil.sendAjax(ajaxOpts,this,ZFLive.isPublicFormAccess)}else ZFLive.updateStateChoicesListForAddrStateDd(inputElem),isOneFieldForm?isSfchild?ZFLive.validateFieldConstraintOF_SF(inputElem):ZFLive.validateFieldConstraintOF(inputElem):ZFLive.validateFieldConstraint(inputElem);else clearAddrStateDropdown(inputElem)},ZFLive.updateStateChoicesListForAddrStateDd=function(inputElem){var elem=$(inputElem).closest('[elname="livefield-elem"]'),linkname=$(elem).attr("linkname"),stateDropdown=$(elem).find("select[complink="+linkname+ZFFormField.ADDRESS.STATE.KEY+"]");updateStateDdInAddrStateDd($(inputElem).find("option:selected").attr("ctrycode"),stateDropdown)},ZFLive.checkUniqueChoiceFld=function(inpElem){var fldLi=$(inpElem).closest('[elname="livefield-elem"]');isSfChild(fldLi)&&validateSFUniqueness($(fldLi))},ZFLive.checkUniqueTimeFld=function(inpElem){var fldLi=$(inpElem).closest('[elname="livefield-elem"]');isSfChild(fldLi)&&validateSFUniqueness($(fldLi))},ZFLive.submitButtonClicked=!1,ZFLive.isSFPopUpEnterTriggered=!1,ZFLive.uploadFile=function(fieldLinkName,file,fileUploadLi,imgProcessId){var reqURL,linkName=fieldLinkName,uploadID=ZFLive.portalName+"_"+ZFLive.formID+"_"+(new Date).getTime();if(-1!==fieldLinkName.indexOf("_")){var index=fieldLinkName.indexOf("_");fieldLinkName=fieldLinkName.substr(0,index)}reqURL=0==document.getElementById("formPerma").value.length?uploadServerEndpoint+"/"+uploadServerServicekey+"/v2/stream/upload":uploadServerEndpoint+"/"+uploadServerServicekey+"/v2/stream/publicupload";var progressbar_line=$(fileUploadLi).find("div[elname=progressbar_line]");$.ajax({url:reqURL,type:"POST",async:!0,data:file,contentType:!1,processData:!1,xhrFields:{withCredentials:!0},xhr:function(){var xhr=jQuery.ajaxSettings.xhr();return xhr.upload.addEventListener("progress",function(evt){if(evt.lengthComputable){var percentComplete=evt.loaded/evt.total*100;progress(percentComplete=Math.ceil(percentComplete),progressbar_line)}},!1),xhr.onerror=function(){fileUploadError(uploadID,fileUploadLi,linkName)},xhr},beforeSend:function(request){request.setRequestHeader("x-service",uploadServerServicekey),request.setRequestHeader("x-streammode","1"),request.setRequestHeader("upload-id",uploadID),request.setRequestHeader("x-portalname",ZFLive.portalName),request.setRequestHeader("x-formlinkname",ZFLive.formLinkName),request.setRequestHeader("x-fieldlinkname",fieldLinkName),request.setRequestHeader("x-filename",encodeURIComponent(file.name)),request.setRequestHeader("x-assured-response",!0),typeof ZFLive.mode==ResponseKey.UNDEFINED||ZFLive.mode!=Mode.LIVE&&ZFLive.mode!=Mode.SAVED_RECORD&&ZFLive.mode!=Mode.EDIT||request.setRequestHeader("x-live_form_upload",!0),typeof ZFLive.isClientPortalPrivateForm!=ResponseKey.UNDEFINED&&ZFLive.isClientPortalPrivateForm&&request.setRequestHeader("x-cli-zaid",ZFLive.clientPortalID);var langCode=$.trim($("#langcode").val());""!=langCode&&langCode!=undefined&&request.setRequestHeader("x-addedlang",langCode),request.setRequestHeader("x-fclient-version",2),uploadCounter(1,uploadID),typeof imgProcessId!=ResponseKey.UNDEFINED&&""!=imgProcessId&&uploadCounter(-1,imgProcessId)},success:function(xhr,status,resp){if(typeof resp.responseText!=ResponseKey.UNDEFINED&&resp.responseText.length>0){var responseJson=JSON.parse(resp.responseText);if(typeof responseJson.error!=ResponseKey.UNDEFINED){var errMsg=responseJson.error;fileUploadError(uploadID,fileUploadLi,linkName,errMsg)}else if(typeof responseJson.filepath!=ResponseKey.UNDEFINED){var fileUploadPath=responseJson.filepath;!ZFLive.isLargeFileUploadForm||typeof ZFLive.mode==ResponseKey.UNDEFINED||ZFLive.mode!=Mode.LIVE&&ZFLive.mode!=Mode.SAVED_RECORD&&ZFLive.mode!=Mode.EDIT?fileUploadSuccess(uploadID,fileUploadLi,fileUploadPath):makeProgressAPIcall(fileUploadLi,uploadID,fileUploadPath,linkName,1)}}else{null==(fileUploadPath=resp.getResponseHeader("x-msg"))?fileUploadError(uploadID,fileUploadLi,linkName):(fileUploadPath=decodeURIComponent(fileUploadPath),!ZFLive.isLargeFileUploadForm||typeof ZFLive.mode==ResponseKey.UNDEFINED||ZFLive.mode!=Mode.LIVE&&ZFLive.mode!=Mode.SAVED_RECORD&&ZFLive.mode!=Mode.EDIT?fileUploadSuccess(uploadID,fileUploadLi,fileUploadPath):makeProgressAPIcall(fileUploadLi,uploadID,fileUploadPath,linkName,1))}},error:function(xhr,status,resp){if(typeof resp.error!=ResponseKey.UNDEFINED&&resp.error.length>0){var errMsg=resp.error;fileUploadError(uploadID,fileUploadLi,linkName,errMsg)}else{errMsg=xhr.getResponseHeader("x-error");fileUploadError(uploadID,fileUploadLi,linkName,errMsg)}}})},ZFLive.reAddMultipleFileUploadFields=function(files,linkName){$(ZFLive.formFormFieldsOuterWrapper).find("#error-"+linkName).hide(),$(ZFLive.formFormFieldsOuterWrapper).find("#error-"+linkName).text("");var fileDiv=$("#"+linkName+"-div-files"),i=0;for(var key in files){var newFileUploadLi=fileDiv.find("ul[elname=fileElementUL]").find("li[elname=templateFileElement]").first().clone();if(readFileAgain(files[key],newFileUploadLi,linkName,key)){var fileObj1=files[key];ZFLive.uploadFile(linkName,fileObj1,newFileUploadLi)}fileDiv.find("ul[elname=fileElementUL]").append(newFileUploadLi),i++}i>0&&(fileDiv.show(),triggerFormResize())};var uploadObjects=[];function uploadCounter(counter,uploadID){if(1==counter)-1==uploadObjects.indexOf(uploadID)&&uploadObjects.push(uploadID);else{var index=uploadObjects.indexOf(uploadID);index>-1&&(uploadObjects.splice(index,1),1==ZFLive.submitButtonClicked&&0==uploadObjects.length&&$(ZFLive.actionBtn).trigger("click"),1==ZFLive.isSFPopUpEnterTriggered&&0==uploadObjects.length&&(ZFLive.isSFPopUpEnterTriggered=!1,addThisSFEntryFromPopUp()))}}function progress(value,progressbar_line){$(progressbar_line).css("width",value+"%")}function cancelSubmitOrUpdateFormAction(){hideSavingElem(),$("#disableDiv").hide(),$("#pleaseWait_Div").hide(),$("#savingDiv").hide(),ZFLive.submitButtonClicked=!1}function isActionRestricted(jqXhr){return!1}function hideCrmErrPopup(){$("#crmFldErrPopup").fadeOut("slow","linear")}function hideRestrictionPopup(){$("#restrictionPopup").fadeOut("slow","linear")}function showRestrictionPopup(){$("#restrictionPopup").fadeToggle("slow","linear"),setPopUpElemPosition($("#restrictionPopup-cont"))}function constructReviewJson(){var reviewFormIter,reviewPageJson={},reviewPage=[];return reviewFormIter=isOneFieldForm()?$(ZFSlideNav.slideContainer):isStandardForm()?$("#formBodyDiv").find("div[elname=formBodyULName][needpagedata=true]"):$("#formBodyDiv").find("ul[elname=formBodyULName][needpagedata=true]"),$(reviewFormIter).each(function(index,elem){reviewPage.push(constructFieldJsonforReview(elem))}),reviewPageJson.pages=reviewPage,reviewPageJson}function constructFieldJsonforReview(ulelem){var reviewLIIterator,pageJson={},fieldvalue=[];if(isOneFieldForm())pageJson.page_title="",reviewLIIterator=$(ulelem).find("div[elname=livefield-elem][reltype=parent][page_no=1][isvisible!=false][needdata=true]");else{var pageNum=$(ulelem).attr("page_no");pageJson.page_title=getPageTitle(pageNum),reviewLIIterator=isStandardForm()?$(ulelem).children("div[page_no="+pageNum+"][isvisible!=false][needdata=true]"):$(ulelem).children("li[page_no="+pageNum+"][isvisible!=false][needdata=true]")}return $(reviewLIIterator).each(function(index,elem){var fieldjson={},elemtype=$(elem).attr("elemtype");if("gridField"===elemtype){var gridColumnIterator=$(elem).find("div[elname=columnDiv]"),compname=$.trim($(elem).attr("compname"));fieldjson.compname=compname,fieldjson.elemtype=elemtype,"true"===$(elem).attr("showhdr")&&(fieldjson.display_name=$.trim($(elem).find("label:first").children("span").text()));var gridColumnsArr=[];$(gridColumnIterator).each(function(index,gridColumn){var gridColumnJson={},gridFieldsArr=[],gridChildFieldIterator=$(gridColumn).find("div[elname=livefield-elem][isvisible!=false][needdata=true]");$(gridChildFieldIterator).each(function(index,gridFieldElem){var gridFldJson={};constructEachFieldJsonForReview(gridFieldElem,gridFldJson),gridFieldsArr.push(gridFldJson)}),gridColumnJson.fields=gridFieldsArr,gridColumnsArr.push(gridColumnJson)}),fieldjson.grid_columns=gridColumnsArr}else constructEachFieldJsonForReview(elem,fieldjson);fieldvalue.push(fieldjson)}),pageJson.fields=fieldvalue,pageJson}function constructEachFieldJsonForReview(elem,fieldjson){var compname=$.trim($(elem).attr("compname"));fieldjson.compname=compname;var comptype=parseInt($(elem).attr("comptype"));fieldjson.comptype=comptype,fieldjson.ismandatory=$(elem).attr("mandatory");var showFldLabel=$(elem).attr("showlabel");if("true"===showFldLabel||showFldLabel===undefined)fieldjson.display_name=isNewHtmlDOM()?$.trim($(elem).find("label:first").children("span:first").text()):$.trim($(elem).children("label").children("span").text()),comptype===ZFFieldTypeConstants.PHONE&&(fieldjson.phoneFormat=$.trim($(elem).find("div[elname=phoneFormatElem]").attr("phoneformat")));else if(comptype!==ZFFieldTypeConstants.NAME&&comptype!==ZFFieldTypeConstants.ADDRESS)if(comptype===ZFFieldTypeConstants.MULTI_LINE)fieldjson.display_name=$.trim($(elem).find("textarea").attr("placeholder"));else if(comptype===ZFFieldTypeConstants.PHONE)fieldjson.display_name=$.trim($(elem).find("div[elname=phoneFld]").find("input").attr("placeholder")),fieldjson.phoneFormat=$.trim($(elem).find("div[elname=phoneFormatElem]").attr("phoneformat"));else if(comptype===ZFFieldTypeConstants.EMAIL)fieldjson.display_name=$.trim($(elem).find("span[elname=livefield-email-elem]").find("input").attr("placeholder"));else if(comptype===ZFFieldTypeConstants.DROPDOWN)if(isNewHtmlDOM()){var selectElem=$(elem).find("select");""!=(placeholderText=$(selectElem).attr("zfs2_placeholder"))&&(fieldjson.display_name=$.trim(placeholderText))}else{var placeholderText;selectElem=$(elem).find("select option[value=-Select-]");(placeholderText=$(selectElem).attr("isplaceholder"))!==undefined&&placeholderText&&(fieldjson.display_name=$.trim($(selectElem).text()))}else fieldjson.display_name=$.trim($(elem).find("input").attr("placeholder"));var elemtype=$(elem).attr("elemtype");"subFormField"===elemtype?(checkForEmptyRows(elem),ZFSubFormLive.zfSubFormLive=new ZFSubFormLive,ZFSubFormLive.zfSubFormLive.constructSubFormDataJsonReview(fieldjson,elem),fieldjson.elemtype=elemtype):comptype===ZFFieldTypeConstants.ZOHO_CRM?ZFLive.mode===Mode.LIVE?ZFCrmLive.zfCrmLive.constructZohoCrmFldDataJson(fieldjson,elem,!1):ZFLive.mode===Mode.SAVED_RECORD&&ZFCrmLive.zfCrmLive.constructZohoCrmFldDataJson(fieldjson,elem,!0):compname===SystemGeneratedField.PAYMENT_AMOUNT.LINK_NAME?constructPaymentField(fieldjson,elem):(constructFormFieldDataJsonCommon(fieldjson,elem,!0),comptype===ZFFieldTypeConstants.FORMULA&&constructNormalField(fieldjson,elem))}function getPageTitle(pageNum){var pageTitle="";if(ZFLive.ShowPageTitle===PageTitleOptions.NAVIGATION_BAR&&$("#navigBar").is(":visible"))pageTitle=isStandardForm()?$("div#navigBar").find("div[pageNum="+pageNum+"]").find("p.pageTitleDiv").text():$($($("#navigBar").find("tr")[1]).find("td")[pageNum-1]).text();else if(ZFLive.ShowPageTitle===PageTitleOptions.PAGE){var pgElem=isStandardForm()?$("div[elname=formBodyULName][page_no="+pageNum+"]").find("div[elname=formPageHeader]:first"):$("ul[elname=formBodyULName][page_no="+pageNum+"]").find("li").first();pageTitle=$(pgElem).find("h2").text()}return pageTitle}function constructFileImageValForReview(fieldjson,elem){var fileDetailArr=[];$(elem).find("ul[elname=fileElementUL]").find("li[elname!=templateFileElement]").each(function(imgIndex,imgElem){var detailJson={},nametag=$(imgElem).find("em");detailJson.fileSrc=$(imgElem).find("img").attr("src"),detailJson.fileSrc==undefined&&(detailJson.fileSrc=$(imgElem).find("div[id=previewMedia]").attr("src")),detailJson.fileName=nametag.text()+""+nametag.next("b").text(),ZFLive.mode===Mode.SAVED_RECORD&&(detailJson.originalsrc=$(imgElem).find("a[elname=zoomIcon]").attr("originalsrc")),fileDetailArr.push(detailJson)}),fieldjson[$(elem).attr("compname")]=fileDetailArr}function checkForEmptyRows(elem){var subformRowIter=isNewHtmlDOM()?$(elem).find('div[elname="subFormFieldsUl"]'):$(elem).find('ul[elname="subFormFieldsUl"]');$(subformRowIter).each(function(rowIndex,subFormRow){var isRowEmpty=!0,subformChildIter=isNewHtmlDOM()?$(subFormRow).find('div[elname="livefield-elem"]'):$(subFormRow).children('li[elname="livefield-elem"]');$(subformChildIter).each(function(subFormChildIndex,subFormChildFieldElem){isRowEmpty&&($(subFormChildFieldElem).attr("isvisible")!==BooleanConstants.TRUE||"true"!=$(subFormChildFieldElem).attr("needdata")||ZFLive.doesSFChildHasEmptyVal(subFormChildFieldElem)||(isRowEmpty=!1))}),isRowEmpty?$(subFormRow).attr("isempty",!0):$(subFormRow).attr("isempty",!1)})}function getAncTagForWebSite(webUrl){var webUrlHref=webUrl;ZFUtil.checkUrlStartWithProtocol(webUrlHref)||(webUrlHref=LocationProtocols.HTTP+"://"+webUrlHref);var ancElem=document.createElement("a");return ancElem.href=webUrlHref,ancElem.target="_blank",ancElem.rel="noopener noreferrer",$(ancElem).text(webUrl),$(ancElem).attr("onclick","ZFLive.stopOnclickEvent(event)"),ancElem}function getCompositeFldValFromJson(valueJson,delimiter){var value="";for(var key in valueJson)-1===key.indexOf(ZFFormField.ADDRESS.MAP_INFO)&&(""!==value&&""!==valueJson[key]?value=value+delimiter+valueJson[key]:""!==valueJson[key]&&(value=valueJson[key]));return value}function appendCompositeFldValFromJsonWithNewLineDelimiter(valueJson,elem){var containsNonEmptyValues=!1;for(var key in valueJson)-1===key.indexOf(ZFFormField.ADDRESS.MAP_INFO)&&(containsNonEmptyValues&&""!==valueJson[key]?(elem.append("
    "),elem.append(document.createTextNode(valueJson[key]))):""!==valueJson[key]&&(containsNonEmptyValues=!0,elem.append(document.createTextNode(valueJson[key]))))}function getImgTag(imgSrc){var imgElem=document.createElement("img");return imgElem.src=imgSrc,imgElem.width=100,imgElem.height=50,imgElem}function setMatrixinReview(fieldsJson,value,td_elem){if(!jQuery.isEmptyObject(value)){var divEle,divEleOuter;$(td_elem).append($("#matrixEntriesTempNew").clone().show().removeAttr("id").attr("elname","matrixNewView"));var rowsVal=fieldsJson.rows,choiceType=fieldsJson.choice_type;for(var key in rowsVal){var rowValue=value[rowsVal[key].row_link_name];if(rowValue!==undefined){divEleOuter=$("#matrixInnerDiv").clone(),$(divEleOuter).show().removeAttr("id"),$(divEleOuter).find("h5").text(rowsVal[key].qstn_name);var ansDiv=$("#matrixAnswerDiv");if(choiceType==MatrixChoicesType.DROPDOWN.CODE||choiceType==MatrixChoicesType.TEXTBOX.CODE||choiceType==MatrixChoicesType.NUMBER.CODE||choiceType==MatrixChoicesType.CURRENCY.CODE){var columValueArray=rowValue;for(var colKey in columValueArray)createMatrixVal(divEle=$(ansDiv).clone(),divEleOuter,columValueArray[colKey].value),$(divEle).find("p").text(columValueArray[colKey].columnname)}else createMatrixVal(divEle=$(ansDiv).clone(),divEleOuter,rowValue),$(divEle).find("p").remove();$(td_elem).find("div[elname=matrixNewView]").append($(divEleOuter))}}}}function createMatrixVal(divEle,divEleOuter,value){$(divEle).show().removeAttr("id"),$(divEle).find("span").text(value),$(divEleOuter).append($(divEle))}function getAncTagForFU(fileJson,tdElem){var ancElem=document.createElement("a"),fileName=fileJson.fileName;void 0===fileName&&fileJson.hasOwnProperty("name")&&(fileName=fileJson.name);var fileExtension,fileNamewithoutExt,fileSrc=fileJson.fileSrc;void 0===fileSrc&&fileJson.hasOwnProperty("link")&&(fileSrc=fileJson.link);var indexOfExtn=fileName.lastIndexOf(".");-1!=indexOfExtn?(fileExtension=fileName.substr(indexOfExtn+1).toLowerCase(),fileNamewithoutExt=fileName.slice(0,-fileExtension.length)):(fileNamewithoutExt=fileName,fileExtension="");var outerDiv=document.createElement("div"),innerDiv=document.createElement("div");if($(tdElem).append(outerDiv),$(outerDiv).attr("elname","imgDivElm").addClass("imgfileUpload"),-1!==$.inArray(fileExtension,ZFLive.allImageType)){var imgEle=document.createElement("img");$(imgEle).attr({onclick:"ZFLive.stopOnclickEvent(event)",width:"100px",height:"100px"}),isStandardForm()||$(innerDiv).append('
    '),ZFLive.mode===Mode.SAVED_RECORD&&fileJson.hasOwnProperty("originalsrc")&&$(innerDiv).find("span").attr("originalsrc",fileJson.originalsrc),$(innerDiv).append(imgEle),$(imgEle).attr("src",fileSrc),$(innerDiv).addClass("imageFile"),addAccessibilityAttributesForFu(innerDiv)}else-1!==$.inArray(fileExtension,ZFLive.allAudioType)?($(outerDiv).addClass("uploadsReview"),isStandardForm()?$(innerDiv).attr("onclick","ZFLive.stopOnclickEvent(event);"):($(innerDiv).attr("onclick","ZFLive.playMediaInReview(this,2);"),$(innerDiv).attr("onkeyup","invokeClickOnPressOfEnter(this)")),$(innerDiv).attr("tabindex",0),$(innerDiv).attr("src",fileSrc),addAccessibilityAttributesForFu(innerDiv),$(innerDiv).append('')):-1!==$.inArray(fileExtension,ZFLive.allVideoType)?($(outerDiv).addClass("uploadsReview"),isStandardForm()?$(innerDiv).attr("onclick","ZFLive.stopOnclickEvent(event);"):($(innerDiv).attr("onclick","ZFLive.playMediaInReview(this,3);"),$(innerDiv).attr("onkeyup","invokeClickOnPressOfEnter(this)")),$(innerDiv).attr("tabindex",0),$(innerDiv).attr("src",fileSrc),addAccessibilityAttributesForFu(innerDiv),$(innerDiv).append('')):($(innerDiv).addClass("fileTypeIcon"),$(innerDiv).attr("aria-hidden","true"),$(innerDiv).append(''));return $(outerDiv).append(innerDiv),isStandardForm()?($(ancElem).attr({tabindex:"0"}),$(ancElem).append('
    '+fileNamewithoutExt+'
    ")):($(ancElem).attr({tabindex:"0",role:"cell"}),$(ancElem).append('
    '+fileNamewithoutExt+'
    ")),$(outerDiv).append('
    '),$(outerDiv).append(ancElem),tdElem}function addAccessibilityAttributesForFu(innerDiv){isAccessibilitySupported()&&(isStandardForm()?$(innerDiv).attr("aria-hidden","true"):$(innerDiv).attr({role:"cell","aria-hidden":"true"}))}function constructReviewFieldRow(reviewFldJson,fieldRow){var comptype=parseInt(reviewFldJson.comptype),fieldDispName=reviewFldJson.display_name,linkname=reviewFldJson.compname;if(0==comptype&&!reviewFldJson.hasOwnProperty(linkname))return!1;var fieldValue=reviewFldJson[linkname],displayNameElem=$(fieldRow).find("td[elname=fieldDispName]");"true"===reviewFldJson.ismandatory?displayNameElem.append(escapeSpecialCharacters(fieldDispName)+' '+i18n.asterisksymbol+" "):fieldDispName!==undefined?displayNameElem.text(fieldDispName):displayNameElem.text(""),$(fieldRow).attr("linkName",reviewFldJson.compname),$(fieldRow).attr("elname","reviewRow");var tdElem=fieldRow.find("td[elname=fieldVal]");if(comptype===ZFFieldTypeConstants.WEBSITE&&""!==$.trim(fieldValue)){var anc_link_elem=getAncTagForWebSite(fieldValue);$(anc_link_elem).appendTo(tdElem)}else if(comptype===ZFFieldTypeConstants.MULTI_LINE)fieldValue=(fieldValue=escapeSpecialCharacters(fieldValue)).replace(/\n/g,"
    "),$(tdElem).html(fieldValue);else if(comptype===ZFFieldTypeConstants.NAME)"\n"===ZFLive.nameDelimiter?appendCompositeFldValFromJsonWithNewLineDelimiter(fieldValue,$(tdElem)):(fieldValue=getCompositeFldValFromJson(fieldValue,ZFLive.nameDelimiter),tdElem.text(fieldValue));else if(comptype===ZFFieldTypeConstants.ADDRESS)"\n"===ZFLive.addrDelimiter?appendCompositeFldValFromJsonWithNewLineDelimiter(fieldValue,$(tdElem)):(fieldValue=getCompositeFldValFromJson(fieldValue,ZFLive.addrDelimiter),tdElem.text(fieldValue));else if(comptype===ZFFieldTypeConstants.SIGNATURE&&""!==$.trim(fieldValue)){var img_elem=getImgTag(fieldValue);$(img_elem).appendTo(tdElem)}else if(comptype===ZFFieldTypeConstants.MATRIX_CHOICE)setMatrixinReview(reviewFldJson,fieldValue,tdElem);else if(comptype===ZFFieldTypeConstants.FILE_UPLOAD||comptype===ZFFieldTypeConstants.IMAGE_UPLOAD||comptype===ZFFieldTypeConstants.MEDIA_UPLOAD){for(var file_key in fieldValue)var td_elem=getAncTagForFU(fieldValue[file_key],tdElem);$(td_elem).addClass("imgPreview WrapBig")}else if(comptype===ZFFieldTypeConstants.DROPDOWN){var groupname=linkname+"_group_name";if(reviewFldJson.hasOwnProperty(groupname)){var optGrpName=reviewFldJson[groupname];null!==optGrpName&&""!==optGrpName&&(fieldValue=$.trim(optGrpName)+" - "+$.trim(fieldValue))}$(tdElem).text($.trim(fieldValue))}else if(comptype===ZFFieldTypeConstants.ZOHO_CRM)fieldValue.hasOwnProperty(ZohoCrmFieldLiveConstants.CRM_PROPS.NAME)&&typeof fieldValue[ZohoCrmFieldLiveConstants.CRM_PROPS.NAME]!==ResponseKey.UNDEFINED&&$(tdElem).text(fieldValue[ZohoCrmFieldLiveConstants.CRM_PROPS.NAME]);else if(comptype===ZFFieldTypeConstants.PHONE){var phoneFormat=reviewFldJson.phoneFormat;10==fieldValue.length&&"USA-FORMAT"==phoneFormat&&(fieldValue="("+fieldValue.substring(0,3)+") "+fieldValue.substring(3,6)+"-"+fieldValue.substring(6));var countryCode=reviewFldJson[linkname+"_country_code"];countryCode!==undefined&&(fieldValue=countryCode+fieldValue),tdElem.text(fieldValue)}else tdElem.text(fieldValue);fieldRow.show()}function rangeValidationForMatrixChoiceFields(elem,errorIdd,dataSpecJson,inputElem,addRangeErrClass){if(inputElem!=undefined)return validateMatrixInputVal(dataSpecJson,inputElem,errorIdd,elem)?(removeMatrixError(inputElem,!0),$(inputElem).removeAttr("isLastError"),isMatrixChoiceRangeErrAvailableAfterClientValidation(errorIdd)?checkAllMatrixInputElem(elem,dataSpecJson,errorIdd)&&($(errorIdd).removeClass("rangeError"),removeErrorFromLiElem(elem)):$(elem).find("input[isLastError=true]").length>0?$(errorIdd).is(":visible")||showWarningErrorMsg(elem,errorIdd,$(elem).attr("compname")):removeErrorFromLiElem(elem)):($(elem).find("input").removeAttr("isLastError"),isMatrixChoiceRangeErrAvailableAfterClientValidation(errorIdd)||(removeMatrixError($(elem).find("input"),!1),$(inputElem).attr("isLastError",!0),$(errorIdd).is(":visible")||showWarningErrorMsg(elem,errorIdd,$(elem).attr("compname"))),highlightMatrixIptError(inputElem),addErrorForAccessibility($(elem).attr("compname"),!0,$(inputElem))),undefined;var isRangeErrorAvailable=!1;if($(errorIdd).removeClass("warningMessage"),removeMatrixError($(elem).find("input"),!1),$(elem).find("input").removeAttr("isLastError"),addRangeErrClass==undefined||addRangeErrClass||isMatrixChoiceRangeErrAvailableAfterClientValidation(errorIdd)){var choiceType=$(elem).attr("choicetype");if(choiceType==MatrixChoicesType.TEXTBOX.CODE)$(elem).find("input").each(function(index,matrixInputElem){validateMatrixTxtboxInputVal(dataSpecJson,matrixInputElem,errorIdd)||(highlightMatrixIptError(matrixInputElem),addErrorForAccessibility($(elem).attr("compname"),!0,$(matrixInputElem)),isRangeErrorAvailable=!0)});else if((choiceType==MatrixChoicesType.CURRENCY.CODE||choiceType==MatrixChoicesType.NUMBER.CODE)&&($(elem).find("input").each(function(index,matrixInputElem){removeMatrixError(matrixInputElem,!0),validateMatrixCurrencyNumericInputVal(matrixInputElem,choiceType,errorIdd)||(addErrorForAccessibility($(elem).attr("compname"),!0,$(matrixInputElem)),isRangeErrorAvailable=!0)}),isRangeErrorAvailable)){var errMsg=ZFLiveErrorConstants.matrixchoiceerrormessage;$(errorIdd).text(errMsg)}}return!isRangeErrorAvailable}function validateMatrixInputVal(dataSpecJson,inputElem,errorIdd,elem){var choiceType=$(elem).attr("choicetype");if(choiceType==MatrixChoicesType.TEXTBOX.CODE)return validateMatrixTxtboxInputVal(dataSpecJson,inputElem,errorIdd);if((choiceType==MatrixChoicesType.CURRENCY.CODE||choiceType==MatrixChoicesType.NUMBER.CODE)&&!validateMatrixCurrencyNumericInputVal(inputElem,choiceType,errorIdd)){var errMsg=ZFLiveErrorConstants.matrixchoiceerrormessage;return $(errorIdd).text(errMsg),!1}return!0}function validateMatrixTxtboxInputVal(dataSpecJson,inputElem,errorIdd){var minLen=dataSpecJson[DataSpecConst.MIN_LEN],maxLen=dataSpecJson[DataSpecConst.MAX_LEN],inputLength=$.trim($(inputElem).val()).length;if(inputLength>0){if(inputLengthmaxLen){var errMsg=ZFLiveErrorConstants.matrixtextinputlimit.replace("{0}",minLen.toString()).replace("{1}",maxLen.toString());return $(errorIdd).text(errMsg),!1}if(inputLength>maxLen){errMsg=ZFLiveErrorConstants.matrixtextinputlimit.replace("{0}",minLen.toString()).replace("{1}",maxLen.toString());return $(errorIdd).text(errMsg),!1}}return!0}function validateMatrixCurrencyNumericInputVal(matrixInputElem,errorIdd,choiceType){var matrixElemValue=$.trim($(matrixInputElem).val());if(removeMatrixError(matrixInputElem,!0),""!=matrixElemValue){var matrixInputElemParent=$(matrixInputElem).parent(),decimallength=$(matrixInputElemParent).attr("decimallength"),decimalFormat=$(matrixInputElemParent).attr("decimalformat"),inputVal=$.trim(ZFUtil.getReformattedDecimal(matrixElemValue,decimalFormat)),inputType=$(matrixInputElem).attr("inputType");if(inputType==ZFFieldTypeConstants.CURRENCY||inputType==ZFFieldTypeConstants.DECIMAL)return validateDecimalLength(matrixInputElemParent,decimallength,inputType)?validateCurrencyWithFormat(matrixInputElemParent)?validateMatrixMinMaxRange(matrixInputElem,inputVal):(addErrorToolTip(matrixInputElem,ZFLiveErrorConstants.decimalerror),!1):(addErrorToolTip(matrixInputElem,ZFUtil.replaceParams(ZFLiveErrorConstants.decimallengtherror,decimallength)),!1);if(inputType==ZFFieldTypeConstants.NUMBER)return validateNumber(matrixInputElemParent)?validateMatrixMinMaxRange(matrixInputElem,inputVal):(addErrorToolTip(matrixInputElem,ZFLiveErrorConstants.numbererror),!1)}return!0}function validateMatrixMinMaxRange(matrixInputElem,inputVal){var minVal=parseFloat($(matrixInputElem).attr("min")),maxVal=parseFloat($(matrixInputElem).attr("max"));return minVal!=undefined&&check_Lessthan(inputVal,minVal,ZFFieldTypeConstants.MATRIX_CHOICE)?(addErrorToolTip(matrixInputElem,ZFLiveErrorConstants.minvalerror.replace("{0}",minVal.toString())),!1):maxVal==undefined||!check_Greaterthan(inputVal,maxVal,ZFFieldTypeConstants.MATRIX_CHOICE)||(addErrorToolTip(matrixInputElem,ZFLiveErrorConstants.maxvalerror.replace("{0}",maxVal.toString())),!1)}function checkAllMatrixInputElem(elem,dataSpecJson,errorIdd){var isRangeErrorAvailable=!1;return $(elem).find("input").each(function(index,matrixInputElem){if(!validateMatrixInputVal(dataSpecJson,matrixInputElem,errorIdd,elem))return isRangeErrorAvailable=!0,!1}),!isRangeErrorAvailable}function isMatrixChoiceRangeErrAvailableAfterClientValidation(errorId){return!!$(errorId).hasClass("rangeError")}function needMatrixRangeValidation(elem,compname,matrixMandatory){if("true"==$(elem).attr("mandatory")){if(getDocumentActiveLiElementCompName()!==compname&&matrixMandatory)return!1;if($(elem).attr("isErrorOnSubmission")!=undefined)return!matrixMandatory&&($(elem).removeAttr("isErrorOnSubmission"),!0)}return!0}function addMatrixTextBoxErrorJson(errorRowJson,parentElem){for(var rowKey in errorRowJson){var columnJsonArr=errorRowJson[rowKey];$(parentElem).find("input[name="+rowKey+"]").each(function(index,columnElem){addMatrixErrorMessgaeToTextBox(columnJsonArr,columnElem)})}}function addMatrixErrorMessgaeToTextBox(columnJsonArr,columnElem){for(var columnName=$(columnElem).attr("columnvalue"),columnIndex=0;columnIndex0)unBindKeyUpEvent(),$("#screenFreezeDiv").show(),$("#popupCaptchaSave").find("em[elem=loadingImgElem]").show(),ZFLive.ProceedToSave(!0);else if("2"==ZFLive.captchaType){var ppRecapErrorTg=$("#pop_recaptchacbox-li").find("#error-recaptchacbox-pop");ppRecapErrorTg.text(i18n.entervaluerecaptcha),animateErrorMsg(ppRecapErrorTg)}else{var popCaptchaLiElem=$("#pop_captcha_li");$(popCaptchaLiElem).find("#error-verificationcode-pop").text(i18n.entervaluecaptcha),animateErrorMsg($(popCaptchaLiElem).find("#error-verificationcode-pop")),$(popCaptchaLiElem).find("input[id=pop_captcha_input_id]").focus()}}function resetPopupCaptchaError(){"2"==ZFLive.captchaType?($("#error-recaptchacbox-pop").hide(),$("#pop_recaptchacbox-li").removeClass("error")):($("#error-verificationcode-pop").hide(),$("#pop_captcha_li").removeClass("error"))}function renderPopupRecaptcha(){ZFLive.popupReCaptcha=grecaptcha.render("recaptcha_checkbox_pop",{sitekey:ZFLive.gsiteKey,theme:ZFLive.gtheme})}function resetPopupRecaptcha(){typeof ZFLive!=ResponseKey.UNDEFINED&&typeof ZFLive.popupReCaptcha!=ResponseKey.UNDEFINED&&grecaptcha.reset(ZFLive.popupReCaptcha)}function setPopupPositionNearFooter(popupElem,isForCaptcha){if(isOneFieldForm())ZFUtil.setElemPosition(popupElem);else{var popupTop,popupLeft=Math.max(0,($(window).width()-$(popupElem).outerWidth())/2),popUpHeight=$(popupElem).outerHeight(),footerOffsetTop=isStandardForm()?$("div[elname=footer]:visible").offset().top:$("ul[elname=footer]:visible").offset().top;footerOffsetTop>popUpHeight?popupTop=footerOffsetTop-popUpHeight:(popupTop=Math.max(10,footerOffsetTop/3),isForCaptcha&&(popupTop+=30)),isStandardForm()?$(popupElem).css({top:popupTop}):$(popupElem).css({top:popupTop,left:popupLeft})}}function setShowCaptchaPopup(width){isStandardForm()&&$("body").addClass("hideWindowScroll");var captchaPopCont=$("#captcha-popup-cont");if($("#captcha-popup-div").show(),$(captchaPopCont).fadeIn(500),isStandardForm()||$(captchaPopCont).width(width),isStandardForm()&&isEmbeddedForm()?setPopupPositionNearFooter($(captchaPopCont),!0):isNewHtmlDOM()?ZFUtil.setElemPosition(captchaPopCont):setPopupPositionNearFooter($(captchaPopCont),!0),isAccessibilitySupported()&&isStandardForm()){var captchInput=$(captchaPopCont).find("input[elname=pop_captcha_input]");$(captchInput).focus();var elements=[$(captchInput),$("#pop_captcha_reset_div"),$("#zf-captcha-pop"),$("#popupCaptchaSave"),$(captchaPopCont).find("div[elname=closeCaptchaPopUp]")];ZFLive.handleTabKeyNavForCommonPopupCase($(captchaPopCont),elements,0,"keydown.commonErrorPopUp")}}function isCaptchaErrorNeeded(){if(uploadObjects.length>0&&ZFLive.isUploadSaveValidate){if("1"==ZFLive.captchaType&&!$("#verificationcode-li").is(":visible"))return!1;if("2"==ZFLive.captchaType&&!$("#recaptchacbox-li").is(":visible"))return!1}return!0}function bindKeyUpEventForCaptchaPopup(){$(document).on("keyup",function(event){27===event.keyCode&&closeCaptchaPopUp()})}function numRegexMatchHandler(match,offset,inpString){return new RegExp("^[+|-]?0+$").test(inpString)?"0":0==match.indexOf("-")?"-":""}function decRegexMatchHandler(match,offset,inpString){var decimalSeparator=match.slice(-1);return 0==match.indexOf("-")?"-0"+decimalSeparator:"0"+decimalSeparator}function removeLeadingZeros(elem){if(typeof elem!=ResponseKey.UNDEFINED){var compType=parseInt($(elem).attr("comptype")),compName=$(elem).attr("compname"),inpVal=$.trim($(elem).find("input").val()),inputElem=$(elem).find("input");compType!=ZFFieldTypeConstants.NUMBER&&compType!=ZFFieldTypeConstants.DECIMAL&&compType!=ZFFieldTypeConstants.CURRENCY||(inpVal=$.trim($(elem).find("input[name="+compName+"]").val()),inputElem=$(elem).find("input[name="+compName+"]")),decimalFormatLeadingZeros(elem,inputElem,inpVal,compType)}}function decimalFormatLeadingZeros(elem,inputElem,inpVal,compType){if(inpVal.length>0){var numberRegexStr="^[+|-]?0+",decimalRegexStr="^[+|-]?0+[.]",onlyZerosRegexStr="^[+|-]?0+[.]0+$";if(compType==ZFFieldTypeConstants.DECIMAL||compType==ZFFieldTypeConstants.CURRENCY){var decimalFormat=$(elem).attr("decimalformat");2==decimalFormat?(decimalRegexStr="^[+|-]?[0|,]+[.]",onlyZerosRegexStr="^[+|-]?[0|,]+[.]0+$",numberRegexStr="^[+|-]?[0|,]+"):3==decimalFormat?(decimalRegexStr="^[+|-]?[0|.]+[,]",onlyZerosRegexStr="^[+|-]?[0|.]+[,]0+$",numberRegexStr="^[+|-]?[0|.]+"):4==decimalFormat&&(decimalRegexStr="^[+|-]?[0| ]+[,]",onlyZerosRegexStr="^[+|-]?[0| ]+[,]0+$",numberRegexStr="^[+|-]?[0| ]+")}var decRegex=new RegExp(decimalRegexStr),numRegex=new RegExp(numberRegexStr);if(decRegex.test(inpVal))inpVal=$.trim(inpVal.replace(decRegex,decRegexMatchHandler)),new RegExp(onlyZerosRegexStr).test(inpVal)&&(inpVal="0"),$(inputElem).val(inpVal);else numRegex.test(inpVal)&&((0==(inpVal=$.trim(inpVal.replace(numRegex,numRegexMatchHandler))).length||1==inpVal.length&&"-"==inpVal)&&(inpVal="0"),$(inputElem).val(inpVal))}}function removeLeadingZerosInReconf(inpElem){var elem=isNewHtmlDOM()?$(inpElem).closest("div[elname=livefield-elem]"):$(inpElem).closest("li[elname=livefield-elem]");if(typeof elem!=ResponseKey.UNDEFINED){isNewHtmlDOM()&&removeNumberInvalidKeys(inpElem);var compType=parseInt($(elem).attr("comptype"));if(decimalFormatLeadingZeros(elem,inpElem,$.trim($(inpElem).val()),compType),compType==ZFFieldTypeConstants.DECIMAL||compType==ZFFieldTypeConstants.CURRENCY){var decimalFormat=$(elem).attr("decimalformat"),reFormattedVal=$.trim(ZFUtil.getReformattedDecimal($(inpElem).val(),decimalFormat)),formattedVal=ZFUtil.getFormattedDecimal(reFormattedVal,decimalFormat);$(inpElem).val(formattedVal)}}}function removeErrorFromLiElemForSlider(compName){removeErrorFromLiElem(isNewHtmlDOM()?$('div[elname=livefield-elem][compname="'+compName+'"]'):$('li[elname=livefield-elem][compname="'+compName+'"]'))}function editSignature(editElem,signElem){if($("#"+editElem).hide(),$("#"+signElem).attr("style","display:block;"),isOneFieldForm())setCanvasElemWidthAndHeight($("#"+signElem).closest("div[elname=livefield-elem]").attr("compname"));else{var signElemDiv=isStandardForm()?$("#"+signElem).closest("div[elname=livefield-elem]"):$("#"+signElem).closest("li[elname=livefield-elem]");setCanvasElemWidth($(signElemDiv).attr("compname"))}}function clearSignature(signElemID){var signatureElem=document.getElementById(signElemID);signatureElem.getContext("2d").clearRect(0,0,signatureElem.width,signatureElem.height),isNewHtmlDOM()?$(signatureElem).closest("div[elname=livefield-elem][fldtype="+ZFFieldTypeConstants.SIGNATURE+"]").attr("is_signed","false"):$(signatureElem).closest("li[elname=livefield-elem][comptype="+ZFFieldTypeConstants.SIGNATURE+"]").attr("is_signed","false")}function getXYCoords(event,signatureElem,isTouchEvent){var xCoordinate,yCoordinate,xPosition,yPosition,signElemLeftPos=$(signatureElem).offset().left,signElemTopPos=$(signatureElem).offset().top;return isTouchEvent?(xPosition=event.changedTouches[0].clientX,yPosition=event.changedTouches[0].clientY):(xPosition=event.clientX,yPosition=event.clientY),isTouchEvent||!event.pageX&&!event.pageY?isTouchEvent&&(event.changedTouches[0].pageX||event.changedTouches[0].pageY)?(xCoordinate=event.changedTouches[0].pageX,yCoordinate=event.changedTouches[0].pageY):(xCoordinate=xPosition+document.body.scrollLeft+document.documentElement.scrollLeft,yCoordinate=yPosition+document.body.scrollTop+document.documentElement.scrollTop):(xCoordinate=event.pageX,yCoordinate=event.pageY),{X:xCoordinate-signElemLeftPos,Y:yCoordinate-signElemTopPos}}function startScribbling(event,canvasElem,context,isTouchEvent,fontColor){var position=getXYCoords(event,canvasElem,isTouchEvent);context.lineTo(position.X,position.Y),context.stroke(),context.strokeStyle=fontColor}function endScribbling(event,canvasElem,context,fontColor){startScribbling(event,canvasElem,context,!1,fontColor),context.closePath(),$(canvasElem).off("mousemove").off("mouseup").off("mouseout")}function treatAsUTC(date){var result=new Date(date);return result.getTime()-60*result.getTimezoneOffset()*1e3}function checkPageGTM(newPageLi){"function"==typeof pushPageViewToGTM&&pushPageViewToGTM(newPageLi)}function checkIfGTMSubmitActionPresent(){return"function"==typeof hasGTMSubmitEvent&&hasGTMSubmitEvent()}function checkFormActionGTM(action){"function"==typeof pushFormActionToGTM&&pushFormActionToGTM(action)}function checkGTMFieldClick(linkname){"function"==typeof pushToGTMOnClickWithFieldLinkName&&pushToGTMOnClickWithFieldLinkName(linkname)}function setCustomDropdown(){var selectBinded=!1;"modelone"==ZFLive.dpdTemplate&&(bindSelect2form(),selectBinded=!0),"modelone"==ZFLive.sfdpdTemplate&&(bindSelect2subform(),selectBinded=!0),selectBinded&&preventSelect2Opening()}function getSelect2Direction(){return $("body").hasClass("rtlWrapper")?"rtl":"ltr"}function getSelect2Matcher(params,data){return"zfs-others-zfs"===data.id?data:$.fn.select2.defaults.defaults.matcher.apply(this,arguments)}function getTemplateResultHtml(data){if("zfs-others-zfs"===data.id)return $(''+escapeSpecialCharacters(data.text)+"");if("-Select-"===data.id)return $(''+escapeSpecialCharacters(data.text)+"");if(data.element&&data.element&&jQuery(data.element).attr("available_val")){var availableVal=jQuery(data.element).attr("available_val"),remaining_text=jQuery(data.element).closest("select").attr("remaining_text");return $(""+escapeSpecialCharacters(data.text)+"( "+availableVal+" "+escapeSpecialCharacters(remaining_text)+")")}return data.text}function getTemplateSelectionHtml(selection){var divTag;return divTag="-Select-"===selection.id?'
    '+escapeSpecialCharacters(selection.text)+"
    ":"
    "+escapeSpecialCharacters(selection.text)+"
    ",$(divTag)}function bindSelect2FuncForAccessibility(elems){if(isAccessibilitySupported()&&typeof elems!==ResponseKey.UNDEFINED&&0!==elems.length){for(var currElems=$(elems).closest("[elname=livefield-elem]"),i=0;i .tempFrmWrapper > .tempContDiv span.select2FormCont").find("span:nth-child(2)").addClass("select2FormArrow"),$("#formBodyDiv").find(".formFieldWrapper > .dropdown, .formFieldWrapper > .address, .formFieldWrapper > .time, .formFieldWrapper > .name, .formFieldWrapper > .matrix_choice[choicetype=3]").addClass("zfSelect2CustomCont");var sboxClass=$("#formBodyDiv").find(".formFieldWrapper > .tempFrmWrapper > .tempContDiv .form_sBox");$(sboxClass).find(".customArrow").addClass("selectArrow").removeClass("customArrow"),$(sboxClass).removeClass("form_sBox").addClass("form_selectBox"),$(".zfSelect2CustomCont .matrixTable").on("scroll",function(index,element){$(".zfSelect2CustomCont .matrixTable").find("select").select2("close")})}function bindSelect2subform(){var subformUL=$("li[elemtype=subFormField][viewtype=1] .tempSubfrmWrapper ul[elname=subFormFieldsUl]"),selectDiv=$(subformUL).find(".tempContDiv .form_sBox select"),direction=getSelect2Direction();$("#formBodyDiv").find(selectDiv).select2({dropdownCssClass:"select2SformList ",containerCssClass:"select2FormCont",dir:direction,templateSelection:getTemplateSelectionHtml,matcher:getSelect2Matcher,templateResult:getTemplateResultHtml,language:{noResults:function(){return ZFLive.noresultsfound}}}),bindSelect2FuncForAccessibility($("#formBodyDiv").find(selectDiv)),$(subformUL).find(".time, .name, .address, .dropdown").addClass("zfSubformSelect2"),$(subformUL).find(".tempContDiv span.select2FormCont").find("span:nth-child(2)").addClass("select2FormArrow");var sboxClass=$("#formBodyDiv").find(subformUL).find(".tempContDiv .form_sBox");$(sboxClass).find(".customArrow").addClass("selectArrow").removeClass("customArrow"),$(sboxClass).removeClass("form_sBox").addClass("form_selectBox"),$("li[elemtype=subFormField][viewtype=1] .tempSubfrmWrapper").on("scroll",function(){$("li[elemtype=subFormField][viewtype=1] .tempSubfrmWrapper ul[elname=subFormFieldsUl] .tempContDiv>div:first-child").find("select").select2("close")})}function preventSelect2Opening(){$(document).on("select2:opening",function(event){$(event.target).prop("disabled")&&event.preventDefault()})}function isFillSelect2(){return ZFLive.isDefaultTheme!=undefined&&1==ZFLive.isDefaultTheme||ZFLive.dpdTemplate!=undefined&&"modelone"==ZFLive.dpdTemplate}function textTransformValue(elem,event){if(void 0!==event){var target=event.target,position=target.selectionStart,endspos=target.selectionEnd;if((39==event.keyCode||37==event.keyCode)&&event.shiftKey){var elems=$(elem)[0],direction="None";return 39==event.keyCode?direction="forward":37==event.keyCode&&(direction="backward"),void elems.setSelectionRange(position,endspos,direction)}textTransformValueInital(elem),target.selectionEnd=position}}function textTransformValueInital(elem){var li=isNewHtmlDOM()?$(elem).closest("div[elname=livefield-elem]"):$(elem).closest("li"),casetype=$(li).attr("casetype"),value=$(elem).val();2==casetype?$(elem).val(value.toUpperCase()):1==casetype?$(elem).val(value.toLowerCase()):3==casetype&&$(elem).val(changeCapitalizeCase(value))}function textTransformValuePlaceholder(elem){var placeHolderValue=$(elem).attr("placeholder");$(elem).attr("placeholder",changeCapitalizeCase(placeHolderValue))}function bindTextTransformEvent(liElem,textTransformType,fieldType){if(1==textTransformType?$(liElem).addClass("lowercase"):2==textTransformType&&$(liElem).addClass("uppercase"),$(liElem).attr("casetype",textTransformType),2==fieldType){$(liElem).on("change input","textarea",function(e){textTransformValue(this,e)});var textAreaElem=$(liElem).find("textarea");textTransformValueInital(textAreaElem),3==textTransformType&&textTransformValuePlaceholder(textAreaElem)}else 1!=fieldType&&9!=fieldType&&8!=fieldType&&7!=fieldType||($(liElem).on("change input","input",function(e){textTransformValue(this,e)}),$(liElem).find("input").each(function(index,elem){textTransformValueInital(elem),3==textTransformType&&textTransformValuePlaceholder(elem)}),8==fieldType&&$(liElem).find("Select").find("option").each(function(index,elem){var option=$(elem).val();if("-Select-"!=option){var displaycountry=$(elem).text();$(elem).attr("lwrvalue",option.toLowerCase()),1==textTransformType?($(elem).val(option.toLowerCase()),$(elem).text(displaycountry.toLowerCase())):2==textTransformType?($(elem).val(option.toUpperCase()),$(elem).text(displaycountry.toUpperCase())):3==textTransformType&&($(elem).val(changeCapitalizeCase(option)),$(elem).text(changeCapitalizeCase(displaycountry)))}}))}function changeCapitalizeCase(value){return value.toLowerCase().replace(/(([\s<>,.\/?;:"\\|\[\]\{\}+=\(\)*&^%$#@!`~-]+(\w|\W))|(^(\w|\W)))/g,function(c){return c.toUpperCase()})}function liveCameraopen(linkname,uploadLimit,isCompressionEnabledForField){try{document.activeElement.blur(),$("#CameraErrorPopup").parent().hide();var fileDiv=$("#"+linkname+"-div-files");if($(fileDiv).find("ul[elname=fileElementUL]").find("li[name=singleFileElement][isdelsfpopup!=true]").length>=uploadLimit){var errorMsg;errorMsg=-1!=ZFLiveErrorConstants.fileuploadlimiterror.indexOf("{0}")?ZFUtil.replaceParams(ZFLiveErrorConstants.fileuploadlimiterror,uploadLimit):ZFLiveErrorConstants.fileuploadlimiterror;var fuErrTg=$("#error-"+linkname);return fuErrTg.text(errorMsg),animateErrorMsg(fuErrTg),void addErrorForAccessibility(linkname,!0)}addErrorForAccessibility(linkname,!1);var videoContainer=$("#videocontainer");isAccessibilitySupported()&&$(videoContainer).attr("linkname",linkname);var video=document.querySelector("#videoElement"),okdone=$(videoContainer).find("a[elname=okdone]"),retake_photo=$(videoContainer).find("a[elname=retake_photo]");$(videoContainer).find("a[elname=take_photo]").hide(),retake_photo.hide(),okdone.hide();var videoDevicesCount=0;video.style.display="block";var chooseCamera=$("#videocontainer").find("select[elname=chooseCamera]");chooseCamera.empty(),navigator.getUserMedia=navigator.getUserMedia||navigator.webkitGetUserMedia||navigator.mozGetUserMedia||navigator.msGetUserMedia,navigator.mediaDevices.enumerateDevices().then(function(mediaDevices){for(var i=0;i").attr("value",mediaDevices[i].deviceId).text(label))):$(chooseCamera).append($("").attr("value",mediaDevices[i].deviceId).text(label)),videoDevicesCount++}$("body").addClass("hideWindowScroll"),videoDevicesCount>1?isNewHtmlDOM()?($("#videocontainer").find("select[elname=chooseCamera]").off("change").on("change",function(){turnOnVideo($(this).val())}).select2({dropdownCssClass:"ofCameraDropDownCont",minimumResultsForSearch:-1}),$("#videocontainer").find("div[elname=cameraPopupHeader]").show()):$("#videocontainer").find("div[elname=cameraPopupHeader]").show():0==videoDevicesCount?errorHandlingforNonCameraAcess(linkname):1==videoDevicesCount&&$("#videocontainer").find("div[elname=cameraPopupHeader]").hide(),$(document).keyup(function(event){27===event.keyCode&&closeVideoTaker()})}),turnOnVideo(undefined,linkname),okdone.unbind(),okdone.on("click",function(){var videoContainer=$("#videocontainer"),imagespreview=$(videoContainer).find("img[elname=videoImgpreview]"),imagesrc=$(imagespreview).attr("src");ZFLive.addMultipleFileUploadFields(dataURLtoFile(imagesrc,"Image.png"),linkname,uploadLimit,isCompressionEnabledForField),$(imagespreview).attr("src",""),checkGTMFieldClick(linkname),closeVideoTaker()})}catch(error){return void errorHandlingforNonCameraAcess(linkname)}}function clickToRetakePhoto(){var video=document.querySelector("#videoElement"),imagespreview=$("#videocontainer").find("img[elname=videoImgpreview]");imagespreview.attr("src",""),imagespreview.hide();var videoContainer=$("#videocontainer");$(videoContainer).find("a[elname=take_photo]").show(),$(videoContainer).find("a[elname=retake_photo]").hide(),$(videoContainer).find("a[elname=okdone]").hide(),$(videoContainer).find("video[elname=videoElement]").show(),video.style.display="block",turnOnVideo($("#videocontainer").find("select[elname=chooseCamera]").val(),undefined)}function handleTabKeyNavForCamera(elem,event){if(isAccessibilitySupported()){var videoContainer=$("#videocontainer");if(event.shiftKey&&9===event.keyCode){if("closeVideo"===$(elem).attr("elname")){event.preventDefault();var retakePhoto=$(videoContainer).find("a[elname=retake_photo]"),takePhoto=$(videoContainer).find("a[elname=take_photo]");$(retakePhoto).is(":visible")?$(retakePhoto).focus():$(takePhoto).is(":visible")?$(takePhoto).focus():$(videoContainer).find("a[elname=okdone]").focus()}}else 9===event.keyCode&&("take_photo"!==$(elem).attr("elname")&&"retake_photo"!==$(elem).attr("elname")||(event.preventDefault(),$(videoContainer).find("a[elname=closeVideo]").focus()))}}function clickToTakePhoto(){var video=document.querySelector("#videoElement"),canvas=document.querySelector("#canvas_Video");canvas.width=video.videoWidth,canvas.height=video.videoHeight,video.style.display="none",canvas.getContext("2d").drawImage(video,0,0,canvas.width,canvas.height);var image_data_url=canvas.toDataURL("image/png"),videoContainer=$("#videocontainer");$(videoContainer).find("video[elname=videoElement]").hide(),$(videoContainer).find("a[elname=retake_photo]").show(),$(videoContainer).find("video[elname=videoElement]");var imagespreview=$(videoContainer).find("img[elname=videoImgpreview]");imagespreview.attr("src",image_data_url),imagespreview.show(),stopLiveVideo(),$(videoContainer).find("a[elname=okdone]").show(),isAccessibilitySupported()&&$(videoContainer).find("a[elname=okdone]").focus(),$(videoContainer).find("a[elname=take_photo]").hide()}function closeVideoTaker(){if(stopLiveVideo(),unBindKeyUpEvent(),$("body").removeClass("hideWindowScroll"),$("#videocontainer").parent().hide(),isAccessibilitySupported()){var linkname=$("#videocontainer").attr("linkname");$("#"+linkname+"-li").find("a[elname=webCamera]").focus()}}function turnOnVideo(devicesId,fieldLinkName){stopLiveVideo(),$("#CameraErrorPopup").parent().hide();var videoContainer=$("#videocontainer");$(videoContainer).find("a[elname=retake_photo]").hide(),$(videoContainer).find("a[elname=okdone]").hide();var constraintJson,video=document.querySelector("#videoElement");if(($(videoContainer).find("img[elname=videoImgpreview]").hide(),video.style.display="block",$("#videocontainer").find("p").hide(),navigator.mediaDevices.getUserMedia)&&(constraintJson=void 0!==devicesId&&""!=devicesId?{audio:!1,video:{deviceId:{exact:devicesId},width:{ideal:9999},height:{ideal:9999}}}:{video:{width:{ideal:9999},height:{ideal:9999}}},navigator.mediaDevices.getUserMedia(constraintJson).then(function(stream){video.srcObject=stream,$("#videocontainer").find("a[elname=take_photo]").show(),isAccessibilitySupported()&&$("#videocontainer").find("a[elname=take_photo]").focus()})["catch"](function(err0r){errorHandlingforNonCameraAcess(fieldLinkName)}),!$("#videocontainer").is(":visible")))if($("#videocontainer").parent().show(),isStandardForm()&&isEmbeddedForm()){var refElem=$("#"+fieldLinkName+"-li");setPopupPositionNearRefElem($(videoContainer),refElem,30,!0,!0)}else setcameraPopUpPosition(videoContainer,fieldLinkName,!1)}function setcameraPopUpPosition(elem,fieldLinkName,isVideoCont){var top;if(elem.css("position","absolute"),window.top.location!==window.self.location&&$(window).height()>800&&void 0!==fieldLinkName){var elemToFocus=$("#"+fieldLinkName+"-li");top=Math.max(0,$(elemToFocus).offset().top-$(elem).height()/4)}else top=Math.max(0,($(window).height()-elem.outerHeight())/4);if(isVideoCont&&(top-=70),elem.css("top",top+"px"),$(elem).attr("top",top+parseFloat($(elem).css("marginTop"))),!isStandardForm()){var left=Math.max(0,($(window).width()-elem.outerWidth())/2);elem.css("left",left+"px"),$(elem).attr("left",left+parseFloat($(elem).css("marginLeft")))}}function errorHandlingforNonCameraAcess(fieldLinkName){if(isStandardForm()&&isEmbeddedForm()?setPopupPositionNearRefElem($("#CameraErrorPopup"),$("#"+fieldLinkName+"-li"),30,!1,!1):setcameraPopUpPosition($("#CameraErrorPopup"),fieldLinkName,!1),$("#CameraErrorPopup").parent().show(),isAccessibilitySupported()){var closePopUp=$("#CameraErrorPopup").find("a[elname=closeVideo]");$(closePopUp).focus();var elements=[$(closePopUp)];$(closePopUp).attr("onclick","closeCameraNotAccessPopup('"+fieldLinkName+"')"),ZFLive.handleTabKeyNavForCommonPopupCase($("#CameraErrorPopup"),elements,0,"keydown.noncameraaccess")}$("#videocontainer").parent().hide(),unBindKeyUpEvent(),$(document).keyup(function(event){27===event.keyCode&&closeCameraNotAccessPopup(fieldLinkName)}),$("body").addClass("hideWindowScroll")}function closeCameraNotAccessPopup(fieldLinkName){$("body").removeClass("hideWindowScroll"),$("#videocontainer").parent().hide(),$("#CameraErrorPopup").parent().hide(),unBindKeyUpEvent(),isAccessibilitySupported()&&($(document).off("keydown.noncameraaccess"),$("#"+fieldLinkName+"-li").find("a[elname=webCamera]").focus())}function stopLiveVideo(){var video=document.querySelector("#videoElement"),stream=video.srcObject;if(stream!=undefined){for(var tracks=stream.getVideoTracks(),i=0;i0)formulaExpressionParser_WithChildFrmulas(getConditionalExpression_WithFrmulaInCondReCalc(formulaJson,!0,getActiveSubFormRowId()),formulaLinkName,!0,actSubFormRowId)}else $(getSFFieldElemWithFldLinkNameAttr(formulaLinkName)).each(function(index,formulaElem){var formulaParentElem=isNewHtmlDOM()?$(formulaElem).closest('div[elname="subFormFieldsUl"]'):$(formulaElem).closest("ul");if("subFormFieldsUl"==$(formulaParentElem).attr("elname")){var rowId=$(formulaParentElem).attr("rowid");formulaExpressionParser_WithChildFrmulas(getConditionalExpression_WithFrmulaInCondReCalc(formulaJson,!0,rowId),formulaLinkName,!0,rowId)}})}function evaluateFormulaInSubFormField_WithChildFrmulas(expression,formulaLinkName,formulaJson){if(isCurrentFormulaExistInsideActiveSubForm(formulaJson.parentFieldLinkName)){var actSubFormRowId=getActiveSubFormRowId();parseInt(actSubFormRowId)>0&&formulaExpressionParser_WithChildFrmulas(expression,formulaLinkName,!0,actSubFormRowId)}else $(getSFFieldElemWithFldLinkNameAttr(formulaLinkName)).each(function(index,formulaElem){var formulaParentElem=isNewHtmlDOM()?$(formulaElem).closest('div[elname="subFormFieldsUl"]'):$(formulaElem).closest("ul");if("subFormFieldsUl"==$(formulaParentElem).attr("elname")){var rowId=$(formulaParentElem).attr("rowid");formulaExpressionParser_WithChildFrmulas(expression,formulaLinkName,!0,rowId)}})}function formulaExpressionParser_WithChildFrmulas(frmulaExpression,formulaLinkName,isSubFormElem,rowId){setValueInFormula(formulaLinkName,calcFrmulaExpAndGetRes(frmulaExpression,formulaLinkName,isSubFormElem,rowId,!0),isSubFormElem,rowId,!1)}function getConditionalExpression_WithFrmulaInCondReCalc(formulaJson,isSubFormElem,rowId){var expression=formulaJson.default_expression,formulaRules=formulaJson.formula_rules;for(var ruleIdx in formulaRules){var rule=formulaRules[ruleIdx];if(ZFLive.evaluateConditionsForFormula(rule,isSubFormElem,rowId,!0)){expression=formulaRules[ruleIdx][ZFFormulaConstants.EXPRESSION];break}}return expression}function removeMultiSpaceAndSave(elem){var phoneInputElem=$(elem).find("div[elname=phoneFld]").find("input"),phoneNum=phoneInputElem.val();phoneInputElem.val(ZFLive.removeMultiSpace(phoneNum))}function constructPhoneValForDuplicateCheck(valueJson,elem){var phoneval="",linkName=$(elem).attr("compname");$(elem).find("div[elname=phoneFld]").find("input").each(function(indexelem,elemnew){var val=$.trim($(elemnew).val());phoneval+=val}),""!=phoneval&&(valueJson[linkName]=phoneval)}ZFLive.deleteFile=function(fieldName,ele){var elem=$(ele).closest("li"),filePath=$(elem).attr("uploadpath"),fileElementUL=$(ele).closest("ul[elname=fileElementUL]"),parentDiv=$(fileElementUL).parent("div");if($(ele).parent().attr("isnewlyadded")==undefined&&ZFSubFormLive.zfSubFormLive!=undefined&&ZFSubFormLive.zfSubFormLive.isPopUpEdit)$(ele).parent().attr("isdelsfpopup","true").hide();else{if(typeof filePath!=ResponseKey.UNDEFINED&&filePath.length>0){var reqUrl,formPerma=document.getElementById("formPerma").value;reqUrl=ZFLive.needReportBaseUrl?"/"+this.portalName+"/report/"+ZFLive.reportLinkName+"/deletefile?path="+filePath:typeof ZFLive.assignedRecord!=ResponseKey.UNDEFINED&&1==ZFLive.assignedRecord?"/"+this.portalName+"/form/"+this.formLinkName+"/myrecords/deletefile?path="+filePath:typeof ZFLive.approvalEditRecord!=ResponseKey.UNDEFINED&&1==ZFLive.approvalEditRecord?"/"+this.portalName+"/form/"+this.formLinkName+"/approvals/deletefile?path="+filePath:formPerma.length>0?"/"+this.portalName+"/form/"+this.formLinkName+"/formperma/"+formPerma+"/deletefile?path="+filePath:"/"+this.portalName+"/form/"+this.formLinkName+"/deletefile?path="+filePath,$.ajax({url:reqUrl,type:"DELETE",async:!0,beforeSend:function(jqXHR,settings){var csrf=ZFUtil.getCSRF();$.trim(csrf).length>0&&jqXHR.setRequestHeader("X-ZCSRF-TOKEN","zfcpn="+csrf)}})}$(ele).closest("li").remove(),ZFLive.removeStoredFile(fieldName,ele)}$(parentDiv).find("li[name=singleFileElement][isdelsfpopup!=true]").length<=0&&$(parentDiv).hide();var errorElems=$(fileElementUL).find("li.fileUploadError");if($("#error-"+fieldName).text("").hide(),0==$(errorElems).length){var errorIdd=isNewHtmlDOM()?$("div[id="+fieldName+"-li]").find("div[elname=fu_error]"):"#fu_error-"+fieldName;$(errorIdd).hide(),$(errorIdd).text(""),addErrorForAccessibility(fieldName,!1),this.validateUploadMinLimitConst(parentDiv)}},ZFLive.validateUploadMinLimitConst=function(fUCont){if(!isIELessThan10()&&!isWindowSafari()&&typeof ZFLive.constraintJson!==ResponseKey.UNDEFINED){var elem=isNewHtmlDOM()?$(fUCont).closest("div[elname=livefield-elem]"):$(fUCont).closest("li[elname=livefield-elem]"),compname=$(elem).attr("compname"),linkname=$(elem).attr("linkname"),errorIdd=(parseInt($(elem).attr("comptype")),ZFLive.errorId(compname)),ismandatory=$(elem).attr("mandatory");if(typeof ZFLive.constraintJson[linkname]!==ResponseKey.UNDEFINED&&typeof ZFLive.constraintJson[linkname][DataSpecConst.MIN_UPLOAD_LIMIT]!==ResponseKey.UNDEFINED){var minUploadLimit=ZFLive.constraintJson[linkname][DataSpecConst.MIN_UPLOAD_LIMIT],totalfiles=$("#"+compname+"-div-files").find("ul[elname=fileElementUL]").find("li[name=singleFileElement][isdelsfpopup!=true]").length;(totalfiles>0||"true"==ismandatory)&&totalfilesiFrmHeight&&triggerFormResizeToFixed(reviewPopupContHeight),window.top.location!==window.self.location){var rvwPopupPositionInp=document.getElementsByName("reviewPopupPositionInput")[0];rvwPopupPositionInp.style.display="block",window.requestAnimationFrame(function(){rvwPopupPositionInp.focus(),rvwPopupPositionInp.style.display="none",$(reviewPopUpDiv).removeClass("zfPreviewPopupCnt")})}isAccessibilitySupported()&&(isStandardForm()?$("#reviewPopUpDivCont").find("div[elname=reviewCloseBtn]").focus():$("#reviewPopUpDivCont").find("a[elname=reviewCloseBtn]").focus())}),$("body").addClass("hideWindowScroll"),isAccessibilitySupported()){var reviewPopUpDivCont=$("#reviewPopUpDivCont");if(isStandardForm())var elements=[$(reviewPopUpDivCont).find("div[elname=reviewCloseBtn]"),$(reviewPopUpDivCont).find("div[elname=popupMainDiv]")];else elements=[$(reviewPopUpDivCont).find("a[elname=reviewCloseBtn]")];ZFLive.handleTabKeyNavForCommonPopupCase($("#reviewPopUpDivCont"),elements,0,"keydown.reviewpopup")}$(document).keyup(function(event){27===event.keyCode&&$("#reviewImgpopupdiv").is(":hidden")&&ZFLive.closeReviewPopUp("reviewPopUpDiv")}),checkFormActionGTM("review")}return null},ZFLive.constructReviewTable=function(reviewValueJSON,parentPopupDiv){var tempReviewDiv=$(parentPopupDiv).find("#reviewTable");$(parentPopupDiv).find("div[elname=reviewTable]").remove();var pages=reviewValueJSON.pages;if(0!==pages.length)for(var key in pages){var reviewTable=tempReviewDiv.clone();$(reviewTable).show();var pageTitle=pages[key].page_title;""!==pageTitle&&reviewTable.find("span[elname=pageTitle]").text(pageTitle).show(),reviewTable.removeAttr("id"),reviewTable.attr("elname","reviewTable"),$(reviewTable).find("tr[elname=reviewRow]").remove();var fields=pages[key].fields;0===fields.length&&reviewTable.find("span[elname=pageTitle]").append($("

    "+i18n.nofields+"

    "));var reviewRowTemp=reviewTable.find("tr[elname=reviewRowTemp]"),subFormRvwTemplate=$("#subFormReviewDiv");for(var fld_key in fields)if("subFormField"===fields[fld_key].elemtype){var reviewField=fields[fld_key],fieldDispName=reviewField.display_name,subFormChildrenEntryArray=reviewField.value.rows,sfRow=reviewRowTemp.clone();isAccessibilitySupported()&&$(sfRow).removeAttr("aria-hidden"),sfRow.insertBefore(reviewRowTemp),sfRow.attr("linkName",reviewField.compname),sfRow.find("td[elname=fieldDispName]").remove(),$(sfRow).attr("elname","reviewRow");var tdElem=sfRow.find("td[elname=fieldVal]");if($(tdElem).append($('
    '+escapeSpecialCharacters(fieldDispName)+"
    ")).attr("colspan",2),Array.isArray(subFormChildrenEntryArray)&&!$.isEmptyObject(subFormChildrenEntryArray)){var count=0;$.each(subFormChildrenEntryArray,function(index,childrenEntryJson){count++;var subFormTableDiv=$(subFormRvwTemplate).clone().removeAttr("id").show(),subFormTable=$(subFormTableDiv).find("table");$(subFormTableDiv).find("label").text("#"+count);var sfFields=childrenEntryJson.fields;for(var subFormChildkey in sfFields){var sfFieldRow=reviewRowTemp.clone();isAccessibilitySupported()&&$(sfFieldRow).removeAttr("aria-hidden"),$(subFormTable).append($(sfFieldRow)),constructReviewFieldRow(sfFields[subFormChildkey],sfFieldRow)}$(tdElem).append($(subFormTableDiv))})}else $(tdElem).append($("

    "+i18n.noentry+"

    "));sfRow.show()}else if("gridField"===fields[fld_key].elemtype){var gridRow,reviewGridField=fields[fld_key],gridDispName=reviewGridField.display_name,isGridDispNameEmpty=!1;gridDispName==undefined||""==gridDispName?isGridDispNameEmpty=!0:((gridRow=reviewRowTemp.clone()).insertBefore(reviewRowTemp),gridRow.attr("linkName",reviewGridField.compname),gridRow.find("td[elname=fieldDispName]").remove(),$(gridRow).attr("elname","reviewRow"),isAccessibilitySupported()&&$(gridRow).removeAttr("aria-hidden"),tdElem=gridRow.find("td[elname=fieldVal]"),$(tdElem).append($('
    '+escapeSpecialCharacters(gridDispName)+"
    ")).attr("colspan",2));var gridTableDiv,gridTable,gridColumnArray=reviewGridField.grid_columns;isGridDispNameEmpty||(gridTableDiv=$(subFormRvwTemplate).clone().removeAttr("id").show(),gridTable=$(gridTableDiv).find("table"),$(gridTableDiv).find("label").hide());var gridFieldsCount=0;$.each(gridColumnArray,function(index,gridColumnJson){var gridFields=gridColumnJson.fields;for(var gridFieldIndex in gridFields){gridFieldsCount++;var gridFieldRow=reviewRowTemp.clone();if(isGridDispNameEmpty){var fieldRow=reviewRowTemp.clone();isAccessibilitySupported()&&$(fieldRow).removeAttr("aria-hidden"),fieldRow.insertBefore(reviewRowTemp),constructReviewFieldRow(gridFields[gridFieldIndex],fieldRow)}else isAccessibilitySupported()&&$(gridFieldRow).removeAttr("aria-hidden"),$(gridTable).append($(gridFieldRow)),constructReviewFieldRow(gridFields[gridFieldIndex],gridFieldRow)}}),!isGridDispNameEmpty&&gridFieldsCount>0&&($(tdElem).append($(gridTableDiv)),gridRow.show())}else{var fieldRow=reviewRowTemp.clone();isAccessibilitySupported()&&$(fieldRow).removeAttr("aria-hidden"),fieldRow.insertBefore(reviewRowTemp),constructReviewFieldRow(fields[fld_key],fieldRow)}reviewTable.insertBefore(tempReviewDiv)}},ZFLive.stopOnclickEvent=function(event){event.stopPropagation?event.stopPropagation():window.event&&(window.event.cancelBubble=!0)},ZFLive.resetCurrentDateRef=function(){try{if(typeof ZFLive!=ResponseKey.UNDEFINED&&typeof ZFLive.dateConstraintJson!=ResponseKey.UNDEFINED&&!jQuery.isEmptyObject(ZFLive.dateConstraintJson)){reqUri="/"+this.portalName+"/form/"+this.formLinkName+"/forminfo";var formtype=parseInt($("#formType").val());(typeof ZFormType!=ResponseKey.UNDEFINED&&formtype===ZFormType.DOCSFORMS||formtype===ZFormType.WRITERFORMS)&&(reqUri=reqUri+"?rid="+$("#formrid").val());var ajaxOpts={URI:reqUri,METHOD:ZFHttp.GET,ACCEPT:ZFMimeType.APPLICATION_JSON,CALLBACK:function(jsonData,ajaxOpts,jqXhr){if(200==jqXhr.status){var currentDate=JSON.parse(jqXhr.responseText).current_date;typeof currentDate!=ResponseKey.UNDEFINED&&(ZFLive.currentDate=currentDate)}}};ZFUtil.sendAjax(ajaxOpts,this,ZFLive.isPublicFormAccess)}}catch(e){}},ZFLive.showLiveDropdownOthers=function(selectElem){var liElem=getClosestFieldElemLi(selectElem);"zfs-others-zfs"==$(selectElem).val()?$(liElem).find("div[elname=allow-others-div]").slideDown(500,function(){isOneFieldForm()&&ZFSlideNav.updateSlideContainerHeight();var inputElem=$(this).find("input"),value=$.trim($(inputElem).val());value.length>0&&$(inputElem).val(value),$(inputElem).focus()}):$(liElem).find("div[elname=allow-others-div]").slideUp(500,function(){isOneFieldForm()?ZFSlideNav.updateSlideContainerHeight():isStandardForm()&&triggerFormResize()})},ZFLive.isTrigFrmChangeDotSelect2Evnt=function(event){return event!=undefined&&"select2"==event.namespace},ZFLive.hideClosestFieldElemErrorDiv=function(elem,event){ZFLive.isTrigFrmChangeDotSelect2Evnt(event)||removeErrorFromLiElem(getClosestFieldElemLi(elem))},ZFLive.textTransformlive=function(textTransformJson){for(var i in textTransformJson){var fieldLinkname=textTransformJson[i].fieldLinkname,liElem=getFieldElem(fieldLinkname);if(0!=$(liElem).length)if(textTransformJson[i].is_subform){var sFTextTransformJson=textTransformJson[i].fields;for(var j in sFTextTransformJson){var textTransformElemIter=getFieldElemWithFldLinkNameLivefieldElemFrmParent(liElem,sFTextTransformJson[j].fieldLinkname);$(textTransformElemIter).each(function(i,sfLiElem){bindTextTransformEvent(sfLiElem,sFTextTransformJson[j].case_sensitive_type,sFTextTransformJson[j].type)})}}else{bindTextTransformEvent(liElem,textTransformJson[i].case_sensitive_type,textTransformJson[i].type)}}},ZFLive.resetAdvRuleExecutedFormulaFieldsList=function(){ZFLive.advRuleExecutedFormulaFieldsList=[]},ZFLive.evalChildFormulaExpression=function(fieldLinkName){if(null!=ZFLive.formulaJson&&-1===$.inArray(fieldLinkName,ZFLive.advRuleExecutedFormulaFieldsList))for(var formulaJsonArr=JSON.parse(ZFLive.formulaJson),formulaInd=0;formulaInd0&&mediaLiveRecorder.mediaBlobs.push(event.data)}),$(containerElem).find("p[elname=timer]").text(mediaLiveRecorder.min+":"+mediaLiveRecorder.sec).show(),mediaLiveRecorder.timeInterval=setInterval(function(){mediaLiveRecorder.increaseTimer(type)},1e3),mediaLiveRecorder.mediaRecorder.start(100)})},stop:function(type){clearInterval(mediaLiveRecorder.timeInterval);var mediaContainer,mimeType=mediaLiveRecorder.mediaRecorder.mimeType;if(mediaLiveRecorder.mediaBlob=new Blob(mediaLiveRecorder.mediaBlobs,{type:mimeType}),type==MediaTypeLiveConstant.AUDIO){mediaContainer=$("#audiocontainer");var audioBuffer,audioContext=new AudioContext,fileReader=new FileReader;fileReader.onloadend=function(){audioBuffer=fileReader.result,audioContext.decodeAudioData(audioBuffer,function(audioBuffer){mediaLiveRecorder.mediaBlob=audioBufferToWav(audioBuffer),$(mediaContainer).find("a[elname=recordingDone]").show(),$(mediaContainer).find("audio[id=recordedAudio]").attr("src",window.URL.createObjectURL(mediaLiveRecorder.mediaBlob)),sizeLimitCheck(mediaLiveRecorder.mediaBlob,type)})},fileReader.readAsArrayBuffer(mediaLiveRecorder.mediaBlob)}type==MediaTypeLiveConstant.VIDEO&&(mediaContainer=$("#mediacontainer"),$(mediaContainer).find("video[id=recordedVideo]").attr("src",window.URL.createObjectURL(mediaLiveRecorder.mediaBlob)),sizeLimitCheck(mediaLiveRecorder.mediaBlob,type)),$(mediaContainer).find("p[elname=timer]").hide(),mediaLiveRecorder.stopStream(),mediaLiveRecorder.resetRecordingProperties(),mediaLiveRecorder.flag=!1},stopStream:function(){mediaLiveRecorder.streamBeingCaptured.getTracks().forEach(function(track){track.stop()})},resetRecordingProperties:function(){mediaLiveRecorder.mediaRecorder=null,mediaLiveRecorder.streamBeingCaptured=null},cancel:function(type){var mediaContainer;type==MediaTypeLiveConstant.AUDIO?(mediaContainer=$("#audiocontainer"),document.getElementById("recordedAudio").pause(),$(mediaContainer).find("audio[id=recordedAudio]").attr("src","").hide(),$(mediaContainer).removeClass("zfAudioRecPopupWidth"),$(mediacontainer).find("div[elname=audioAnimation]").hide()):type==MediaTypeLiveConstant.VIDEO&&(mediaContainer=$("#mediacontainer"),document.getElementById("recordedVideo").pause(),$(mediaContainer).find("video[id=recordedVideo]").attr("src","").hide(),$(mediaContainer).find("div[elname=recorderMsg]").hide().removeClass("videoRecordrInfoMsg"),$(mediaContainer).removeClass("avErrorDiv")),null!=mediaLiveRecorder.mediaRecorder&&(mediaLiveRecorder.mediaRecorder.stop(),mediaLiveRecorder.stopStream(),mediaLiveRecorder.resetRecordingProperties()),clearInterval(mediaLiveRecorder.timeInterval),$(mediaContainer).find("p[elname=timer]").hide()},increaseTimer:function(type){var container;mediaLiveRecorder.sec++,60==mediaLiveRecorder.sec&&(mediaLiveRecorder.sec=0,mediaLiveRecorder.min++),container=type==MediaTypeLiveConstant.AUDIO?$("#audiocontainer"):$("#mediacontainer"),$(container).find("p[elname=timer]").text(mediaLiveRecorder.min+":"+mediaLiveRecorder.sec)},recordingDone:function(linkName,type,uploadLimit){var extension,fileName,files=[],fileType=mediaLiveRecorder.mime;type==MediaTypeLiveConstant.AUDIO?(fileName="audio",extension=".wav",fileType="audio/x-wav",document.getElementById("recordedAudio").pause()):type==MediaTypeLiveConstant.VIDEO&&(fileName="video",extension="."+getExtensionFromMimeType(fileType),document.getElementById("recordedVideo").pause()),files[0]=blobToFile(mediaLiveRecorder.mediaBlob,fileName+extension,fileType),ZFLive.addMultipleFileUploadFields(files,linkName,uploadLimit)}};function sizeLimitCheck(blob,type){var mediaContainer,maxAllowedSize=20971520;typeof ZFLive.isLargeFileUploadForm!=ResponseKey.UNDEFINED&&typeof ZFLive.isLargeFileSizeAllowed!=ResponseKey.UNDEFINED&&typeof ZFLive.mode!=ResponseKey.UNDEFINED&&ZFLive.isLargeFileUploadForm&&ZFLive.isLargeFileSizeAllowed&&(ZFLive.mode==Mode.LIVE||ZFLive.mode==Mode.SAVED_RECORD||ZFLive.mode==Mode.EDIT)&&(maxAllowedSize=1073741824),(mediaContainer=type==MediaTypeLiveConstant.AUDIO?$("#audiocontainer"):$("#mediacontainer")).find("div[elname=recorderMsg]").hide(),blob.size>maxAllowedSize&&(mediaContainer.find("div[elname=recorderMsg]").text(ZFLiveErrorConstants.mediafile_size_error),mediaContainer.find("div[elname=recorderMsg]").show(),mediaContainer.addClass("avErrorDiv"),isAccessibilitySupported()&&$(mediaContainer).find("div[elname=recorderMsg]").attr({role:"alert","aria-live":"assertive"}))}function handleAudioFieldAccessibility(elem,startOrStop,linkName,type){var typeStr=type==MediaTypeLiveConstant.AUDIO?"audio":"video",recElem=$(elem).find("a[elname="+startOrStop+"Recording]"),closeMedia=$(elem).find("a[elname=closeMedia]"),elements=[$(recElem),$(closeMedia)];$(closeMedia).attr("onclick","cancelRecording('"+type+"','"+linkName+"')"),$(document).off("keydown."+typeStr),ZFLive.handleTabKeyNavForCommonPopupCase($(elem),elements,0,"keydown."+typeStr),setTimeout(function(){$(recElem).focus()},300)}function startRecording(type,linkName,noAudio){mediaLiveRecorder.start(type,noAudio).then(function(stream){var elem;type==MediaTypeLiveConstant.AUDIO?(elem=$("#audiocontainer"),$(elem).find("video[id=playingVideo]").hide(),$(elem).find("div[elname=audioAnimation]").show()):elem=$("#mediacontainer"),$(elem).find("a[elname=reRecord]").hide(),$(elem).find("a[elname=stopRecording]").show(),$(elem).find("a[elname=recordingDone]").hide(),$(elem).find("a[elname=startRecording]").hide(),isAccessibilitySupported()&&handleAudioFieldAccessibility(elem,"stop",linkName,type)})["catch"](function(error){var elem;type==MediaTypeLiveConstant.AUDIO?(elem=$("#audiocontainer"),errorHandlingforMediaAcess(linkName,ZFLiveErrorConstants.no_mike_permission,type)):(elem=$("#mediacontainer"),noAudio?errorHandlingforMediaAcess(linkName,ZFLiveErrorConstants.no_mike_permission,type):(startRecording(type,linkName,!0),$(elem).find("div[elname=recorderMsg]").text(ZFLiveErrorConstants.no_mike_info).show().addClass("videoRecordrInfoMsg"),isAccessibilitySupported()&&$(elem).find("div[elname=recorderMsg]").attr({role:"alert","aria-live":"assertive"}),$(elem).addClass("avErrorDiv")))})}function stopRecording(type,linkName){var elem;mediaLiveRecorder.stop(type),type==MediaTypeLiveConstant.AUDIO?(elem=$("#audiocontainer"),$(elem).find("audio[id=recordedAudio]").show(),$(elem).find("div[elname=audioAnimation]").hide(),$(elem).addClass("zfAudioRecPopupWidth")):type==MediaTypeLiveConstant.VIDEO&&(elem=$("#mediacontainer"),$(elem).find("video[id=playingVideo]").hide(),$(elem).find("video[id=playingVideo]").attr("src",""),$(elem).find("video[id=recordedVideo]").show(),$(elem).find("a[elname=recordingDone]").show()),$(elem).find("a[elname=reRecord]").show(),$(elem).find("a[elname=startRecording]").hide(),$(elem).find("a[elname=stopRecording]").hide(),isAccessibilitySupported()&&setTimeout(function(){var typeStr="audio",recordedElem=$(elem).find("audio[id=recordedAudio]");type==MediaTypeLiveConstant.VIDEO&&(typeStr="video",recordedElem=$(elem).find("video[id=recordedVideo]"));var recordingDone=$(elem).find("a[elname=recordingDone]");$(recordingDone).focus();var closeMediaElem=$(elem).find("a[elname=closeMedia]"),elements=[$(elem).find("a[elname=recordingDone]"),$(elem).find("a[elname=reRecord]"),$(closeMediaElem),$(recordedElem)];$(closeMedia).attr("onclick","cancelRecording('"+type+"','"+linkName+"')"),$(document).off("keydown."+typeStr),ZFLive.handleTabKeyNavForCommonPopupCase($(elem),elements,0,"keydown."+typeStr)},200)}function reRecord(type,linkName){var elem;mediaLiveRecorder.cancel(type),type==MediaTypeLiveConstant.VIDEO?turnOnCamera(elem=$("#mediacontainer")):(elem=$("#audiocontainer"),$(elem).find("p[elname=timer]").text("0:0").show(),$(elem).find("a[elname=startRecording]").show()),$(elem).find("audio[id=recordedAudio]").hide(),$(elem).find("video[id=recordedVideo").hide(),$(elem).find("a[elname=recordingDone]").hide(),$(elem).find("a[elname=reRecord]").hide(),isAccessibilitySupported()&&handleAudioFieldAccessibility(elem,"start",linkName,type)}function cancelRecording(type,fieldLinkName){var mediacontainer;mediaLiveRecorder.cancel(type),type==MediaTypeLiveConstant.VIDEO?mediacontainer=$("#mediacontainer"):(mediacontainer=$("#audiocontainer"),$(mediacontainer).find("div[elname=audioAnimation]").hide()),$(mediacontainer).parent().hide(),$("body").removeClass("hideWindowScroll"),$(mediacontainer).find("video[id=playingVideo]").hide(),$(mediacontainer).find("video[id=playingVideo]").attr("src",""),$(mediacontainer).find("div[elname=recorderMsg]").hide(),isAccessibilitySupported()&&(type==MediaTypeLiveConstant.VIDEO?$(document).off("keydown.video"):$(document).off("keydown.audio"),$("#"+fieldLinkName+"-li").find("a[elname=mediaRecorder]").focus())}function mediaDoneRecording(linkName,type,uploadLimit){mediaLiveRecorder.recordingDone(linkName,type,uploadLimit);var mediacontainer=$("#mediacontainer");type==MediaTypeLiveConstant.VIDEO?mediacontainer=$("#mediacontainer"):(mediacontainer=$("#audiocontainer"),$(mediacontainer).removeClass("zfAudioRecPopupWidth")),$(mediacontainer).parent().hide(),$("body").removeClass("hideWindowScroll"),$(mediacontainer).find("audio[id=recordedAudio]").attr("src","").hide(),$(mediacontainer).find("video[id=recordedVideo]").attr("src","").hide(),$(mediacontainer).find("div[elname=recorderMsg]").hide(),mediacontainer.removeClass("avErrorDiv"),isAccessibilitySupported()&&$("#"+linkName+"-li").find("a[elname=mediaRecorder]").focus()}function turnOnCamera(elem,linkName){var videoElem=document.querySelector("#playingVideo"),flag=!0;navigator.mediaDevices.getUserMedia({video:!0}).then(function(stream){$(elem).parent().show(),videoElem.srcObject=stream,$(elem).find("video[id=playingVideo]").show(),videoElem.onloadedmetadata=function(ev){videoElem.play(),flag&&($(elem).find("div[elname=recorderMsg]").hide(),$(elem).find("a[elname=startRecording]").show(),isAccessibilitySupported()&&handleAudioFieldAccessibility($(mediacontainer),"start",linkName,MediaTypeLiveConstant.VIDEO))},$(elem).find("a[elname=closeMedia]").click(function(){stream.getTracks().forEach(function(track){track.stop()}),flag=!1}),$(elem).find("a[elname=stopRecording]").click(function(){stream.getTracks().forEach(function(track){track.stop()}),$(elem).find("a[elname=startRecording]").hide(),flag=!1})})["catch"](function(error){errorHandlingforMediaAcess(linkName,ZFLiveErrorConstants.no_camera_permission,MediaTypeLiveConstant.VIDEO)})}function liveMediaRecord(linkName,type,uploadLimit,allowedType){try{document.activeElement.blur();var fileDiv=$("#"+linkName+"-div-files");if(!validateUploadLimitOnLive($(fileDiv).find("ul[elname=fileElementUL]").find("li[name=singleFileElement][isdelsfpopup!=true]").length,uploadLimit,linkName))return;var recordingFormat=getBrowersRecordingFormat(type);if(!isLiveRecordingTypeAllowed(allowedType,recordingFormat)){var errorMsg;errorMsg=-1!=ZFLiveErrorConstants.mediarecordertypeerror.indexOf("{0}")?ZFUtil.replaceParams(ZFLiveErrorConstants.mediarecordertypeerror,recordingFormat):ZFLiveErrorConstants.mediarecordertypeerror;var fuErrTg=$("#error-"+linkName);return fuErrTg.text(errorMsg),animateErrorMsg(fuErrTg),void addErrorForAccessibility(linkName,!0)}if(addErrorForAccessibility(linkName,!1),$("#mediaErrorPopup").parent().hide(),checkMediaRecApiPermission()){var mediacontainer;if(type==MediaTypeLiveConstant.VIDEO){if(mediacontainer=$("#mediacontainer"),!$(mediacontainer).is(":visible"))if(isStandardForm()&&isEmbeddedForm()){var refElem=$("#"+linkName+"-li");setPopupPositionNearRefElem($(mediacontainer),refElem,30,!0,!0)}else setcameraPopUpPosition(mediacontainer,linkName,!0);$(mediacontainer).find("video[id=playingVideo]").show(),$(mediacontainer).find("a[elname=startRecording]").attr("onclick","startRecording('"+type+"','"+linkName+"')").hide(),turnOnCamera(mediacontainer,linkName)}else{if(checkAudioPermission(linkName,mediacontainer=$("#audiocontainer")),!$(mediacontainer).is(":visible"))if(isStandardForm()&&isEmbeddedForm()){refElem=$("#"+linkName+"-li");setPopupPositionNearRefElem($(mediacontainer),refElem,30,!0,!0)}else setcameraPopUpPosition(mediacontainer,linkName,!1);$(mediacontainer).find("p[elname=timer]").show().text("0:0"),$(mediacontainer).find("a[elname=startRecording]").attr("onclick","startRecording('"+type+"','"+linkName+"')").show()}$("body").addClass("hideWindowScroll"),$(mediacontainer).find("a[elname=stopRecording]").attr("onclick","stopRecording('"+type+"','"+linkName+"')").hide(),$(mediacontainer).find("a[elname=closeMedia]").attr("onclick","cancelRecording('"+type+"','"+linkName+"')"),$(mediacontainer).find("a[elname=reRecord]").attr("onclick","reRecord('"+type+"','"+linkName+"')").hide(),$(mediacontainer).find("a[elname=recordingDone]").attr("onclick","mediaDoneRecording('"+linkName+"','"+type+"','"+uploadLimit+"')").hide()}else errorHandlingforMediaAcess(linkName,ZFLiveErrorConstants.mediarecapierror,type)}catch(error){return void errorHandlingforMediaAcess(linkName,ZFLiveErrorConstants.no_camera_permission,type)}}function checkAudioPermission(linkName,mediacontainer){navigator.mediaDevices.getUserMedia({audio:!0}).then(function(stream){$(mediacontainer).parent().show(),isAccessibilitySupported()&&handleAudioFieldAccessibility($(mediacontainer),"start",linkName,MediaTypeLiveConstant.AUDIO),stream.getTracks().forEach(function(track){track.stop()})})["catch"](function(error){$(mediacontainer).parent().hide(),errorHandlingforMediaAcess(linkName,ZFLiveErrorConstants.no_mike_permission,MediaTypeLiveConstant.AUDIO)})}function blobToFile(theBlob,fileName,fileType){return new File([theBlob],fileName,{lastModified:(new Date).getTime(),type:fileType})}function getExtensionFromMimeType(mimetype){return mimetype.split("/")[1]}function audioBufferToWav(aBuffer){var btwIndex,btwSample,numOfChan=aBuffer.numberOfChannels,btwLength=aBuffer.length*numOfChan*2+44,btwArrBuff=new ArrayBuffer(btwLength),btwView=new DataView(btwArrBuff),btwChnls=[],btwOffset=0,btwPos=0;for(setUint32(1179011410),setUint32(btwLength-8),setUint32(1163280727),setUint32(544501094),setUint32(16),setUint16(1),setUint16(numOfChan),setUint32(aBuffer.sampleRate),setUint32(2*aBuffer.sampleRate*numOfChan),setUint16(2*numOfChan),setUint16(16),setUint32(1635017060),setUint32(btwLength-btwPos-4),btwIndex=0;btwIndex=uploadLimit){var errorMsg;errorMsg=-1!=ZFLiveErrorConstants.fileuploadlimiterror.indexOf("{0}")?ZFUtil.replaceParams(ZFLiveErrorConstants.fileuploadlimiterror,uploadLimit):ZFLiveErrorConstants.fileuploadlimiterror;var fuErrTg=$("#error-"+linkName);return fuErrTg.text(errorMsg),animateErrorMsg(fuErrTg),addErrorForAccessibility(linkName,!0),!1}return addErrorForAccessibility(linkName,!1),!0}function checkMediaRecApiPermission(){return navigator.getUserMedia=navigator.getUserMedia||navigator.webkitGetUserMedia||navigator.mozGetUserMedia||navigator.msGetUserMedia||navigator.mediaDevices.getUserMedia,navigator.getUserMedia}function closeMediaErrorPopup(fieldLinkName){$("body").removeClass("hideWindowScroll"),$("#mediacontainer").parent().hide(),$("#audiocontainer").parent().hide(),$("#mediaErrorPopup").parent().hide(),unBindKeyUpEvent(),isAccessibilitySupported()&&($(document).off("keydown.mediaerrorpopup"),$("#"+fieldLinkName+"-li").find("a[elname=mediaRecorder]").focus())}function errorHandlingforMediaAcess(fieldLinkName,errMsg,type){var errContainer=$("#mediaErrorPopup");if(type==MediaTypeLiveConstant.VIDEO?$(errContainer).find("div[elname=mediaErrImg]").empty().append(''):type==MediaTypeLiveConstant.AUDIO&&$(errContainer).find("div[elname=mediaErrImg]").empty().append(''),isStandardForm()&&isEmbeddedForm()?setPopupPositionNearRefElem($(errContainer),$("#"+fieldLinkName+"-li"),30,!1,!0):setcameraPopUpPosition($(errContainer),fieldLinkName,!1),$(errContainer).parent().show(),isAccessibilitySupported()){var closePopUp=$(errContainer).find("a[elname=closeVideo]"),elements=[$(closePopUp)];$(closePopUp).attr("onclick","closeMediaErrorPopup('"+fieldLinkName+"')"),ZFLive.handleTabKeyNavForCommonPopupCase($(errContainer),elements,0,"keydown.mediaerrorpopup"),$(closePopUp).focus()}$("#mediacontainer").parent().hide(),$("#audiocontainer").parent().hide(),$(errContainer).find("h3").text(errMsg),unBindKeyUpEvent(),$(document).keyup(function(event){27===event.keyCode&&closeMediaErrorPopup()}),$("body").addClass("hideWindowScroll")}function checkValidMatrixChoiceNumberCurr(matrixDiv){var hasValidNumber=!0;return $(matrixDiv).find("tbody").find("tr").each(function(index,elem){$(elem).find("input[type=text]").each(function(index1,inputElem){if(""!=$.trim($(inputElem).val())){var inputType=$(inputElem).attr("inputType");inputType==ZFFieldTypeConstants.CURRENCY||inputType==ZFFieldTypeConstants.DECIMAL?validateDecimalLength($(inputElem).parent(),$(inputElem).parent().attr("decimallength"),inputType)?validateCurrencyWithFormat($(inputElem).parent())?removeMatrixError(inputElem,!0):(addErrorToolTip(inputElem,ZFLiveErrorConstants.decimalerror),hasValidNumber=!1):(addErrorToolTip(inputElem,ZFUtil.replaceParams(ZFLiveErrorConstants.decimallengtherror,$(inputElem).parent().attr("decimallength"))),hasValidNumber=!1):validateNumber($(inputElem).parent())?removeMatrixError(inputElem,!0):(addErrorToolTip(inputElem,ZFLiveErrorConstants.numbererror),hasValidNumber=!1)}})}),hasValidNumber}function validateValueOnMatrixInput(event,inputElem){var parentElem,inputType=$(inputElem).attr("inputType");parentElem=isNewHtmlDOM()?$(inputElem).closest("div[elname=livefield-elem]"):$(inputElem).parents("li[elname=livefield-elem]");var compname=$(parentElem).attr("compname"),errorIdd=ZFLive.errorId(compname),inputValue=$(inputElem).val();if(""!=inputValue){if(inputType==ZFFieldTypeConstants.NUMBER)validateMatrixNumberOnInput(event,errorIdd,inputElem,parentElem,inputValue,!1);else if(inputType==ZFFieldTypeConstants.DECIMAL||inputType==ZFFieldTypeConstants.CURRENCY){var decimalFormat=$(inputElem).parent().attr("decimalFormat"),allowNegative=!1;if(parseInt($(inputElem).attr("min"))<0&&(allowNegative=!0),getDecimalRegxForOnInputValidation(decimalFormat,allowNegative).test(inputValue))isOneFieldForm()?hideErrorOF(parentElem):($(errorIdd).hide(),$(errorIdd).text(""));else{$(inputElem).data("start_pos");var errMsg,oldVal=$(inputElem).data("zf_old_val");$(inputElem).val(oldVal),errMsg=inputType==ZFFieldTypeConstants.CURRENCY?ZFUtil.replaceParams(ZFLiveErrorConstants.invalidcurrency,ZFUtil.getDecimalErrorNO(decimalFormat)):ZFUtil.replaceParams(ZFLiveErrorConstants.decimalerror,ZFUtil.getDecimalErrorNO(decimalFormat)),$(errorIdd).text(errMsg),animateErrorMsg(errorIdd)}}}else inputType==ZFFieldTypeConstants.NUMBER&&null!=event.data&&validateMatrixNumberOnInput(event,errorIdd,inputElem,parentElem,event.data,!0)}function validateMatrixNumberOnInput(event,errorIdd,inputElem,parentElem,inputNumValue,isInvalidData){var numberRegex=/^\d+$/;if(parseInt($(inputElem).attr("min"))<0&&(numberRegex=/^-?\d*$/),getNumberOfDigitsInString($.trim(inputNumValue))>18)replaceValueAndShowError(event,inputElem,errorIdd,ZFLiveErrorConstants.maxdigitslimit.replace("{0}",18));else if(numberRegex.test(inputNumValue)){if(isInvalidData){var oldval=$(inputElem).data("zf_old_val");if(""!=oldval)return $(inputElem).val(oldval),$(errorIdd).text(ZFLiveErrorConstants.numbererror),void animateErrorMsgOF(errorIdd)}isOneFieldForm()?hideErrorOF(parentElem):($(errorIdd).hide(),$(errorIdd).text(""))}else replaceValueAndShowError(event,inputElem,errorIdd,ZFLiveErrorConstants.numbererror)}function replaceValueAndShowError(event,inputElem,errorIdd,errMsg){var oldVal=$(inputElem).data("zf_old_val");"deletecontentbackward"!=event.inputType.toLowerCase()&&"deletecontentforward"!=event.inputType.toLowerCase()||(oldVal=inputNumValue),$(inputElem).val(oldVal),$(errorIdd).text(errMsg),animateErrorMsg(errorIdd)}function setPrevValForMatrixIptValidation(inputElem){var oldVal=$(inputElem).val();$(inputElem).data("zf_old_val",oldVal),$(inputElem).data("start_pos",event.target.selectionStart)}function getDecimalRegxForOnInputValidation(format,isNegativeValAllowed){return 2==format||3==format?isNegativeValAllowed?/^-?[\d\.\,]*$/:/^[\d\.\,]*$/:4==format?isNegativeValAllowed?/^-?[\d\, ]*$/:/^[\d\, ]*$/:isNegativeValAllowed?/^-?[\d\.]*$/:/^[\d\.]*$/}function showToolTipForMatrixLiveForm(matrixElem){var elem=matrixElem;isNewHtmlDOM()&&ZFLive.isMatrixInTableFormat&&(elem=$(matrixElem).find("input"));var toolTipDiv=$("#tooltipDivTemp").clone();$(toolTipDiv).attr("id","tooltipDiv"),$(toolTipDiv).addClass("matrixErrorTooltip"),toolTipDiv.css({position:"absolute",zIndex:1e5,display:"block"});var title=$(elem).attr("tooltip-title");$(toolTipDiv).find("span").text(title),toolTipDiv.appendTo(document.body);var eleWidth=$(elem).outerWidth(),eleHeight=$(elem).outerHeight(),tooltipWidth=toolTipDiv.outerWidth(),leftPos=$(elem).offset().left,topPos=$(elem).offset().top;toolTipDiv.css({left:leftPos-(tooltipWidth/2-eleWidth/2),top:topPos+eleHeight+8}).addClass("topArrow"),$(toolTipDiv).show(),isNewHtmlDOM()&&ZFLive.isMatrixInTableFormat?$(matrixElem).off("mouseleave").on("mouseleave",function(){$("#tooltipDiv").remove()}):$(elem).off("click").off("mouseleave").on("mouseleave",function(){$("#tooltipDiv").remove()}),$("#tooltipDiv").css("pointer-events","none")}function addErrorToolTip(errorfield,errorMsg){highlightMatrixIptError(errorfield),isNewHtmlDOM()&&ZFLive.isMatrixInTableFormat?$(errorfield).closest("td").attr("onmouseenter","showToolTipForMatrixLiveForm(this);"):$(errorfield).attr("onmouseenter","showToolTipForMatrixLiveForm(this);"),$(errorfield).attr("tooltip-title",errorMsg)}function formatMatrixNumbCurrValue(input){var inputType=$(input).attr("inputType");inputType==ZFFieldTypeConstants.CURRENCY||inputType==ZFFieldTypeConstants.DECIMAL?(removeLeadingZeros($(input).parent()),formatDecimalValue($(input).parent())):inputType==ZFFieldTypeConstants.NUMBER&&removeLeadingZeros($(input).parent())}function changeTo24hrFormat(dateTime,dateLocale){var dateTimeElements=dateTime.split(" "),hourPart=dateTimeElements[1].substring(0,2);return(dateTimeElements[2]==CustomDateLocale[dateLocale].PM&&"12"!=hourPart||dateTimeElements[2]==CustomDateLocale[dateLocale].AM&&"12"==hourPart)&&(hourPart=(hourPart=(parseInt(hourPart)+12)%24)<10?"0"+hourPart:hourPart,dateTimeElements[1]=hourPart+dateTimeElements[1].substring(2)),dateTime=dateTimeElements[0]+" "+dateTimeElements[1]}function compareTimeSlots(dateTime,startTime,endTime,splitDateTimeIndex,dateFormat,dateLocale,errorIdd){var datePart=dateTime.substring(0,splitDateTimeIndex),startDateTime=datePart+" "+startTime,endDateTime=datePart+" "+endTime;if(compareDateTimeValues(dateTime,startDateTime,dateFormat,dateLocale,TimeFormat.HOURS_24.CODE)){var errMsg=ZFLiveErrorConstants.mindatetimelimit.replace("{0}",startDateTime);return $(errorIdd).text(errMsg),!1}if(compareDateTimeValues(endDateTime,dateTime,dateFormat,dateLocale,TimeFormat.HOURS_24.CODE)){errMsg=ZFLiveErrorConstants.maxdatetimelimit.replace("{0}",endDateTime);return $(errorIdd).text(errMsg),!1}return!0}function checkSizeForOtherOption(elem){var otherElem=$(elem).find('input[elname="checkbox-input"]');if(otherElem!=undefined){var compname=$(elem).attr("compname"),errorId=ZFLive.errorId(compname);if(otherElem.is(":checked"))$(elem).find("input[name=allow-others-text]").val().length>150&&($(errorId).text(i18n.invalidChoiceLen),animateErrorMsg(errorId),ZFLive.changeErrArray(compname),ZFLive.addMandatoryError(elem),addFieldToErrTrackFieldList(elem),checkAndAddFieldToGridErrTrackFieldList(elem))}}function highlightMatrixIptError(inputElem){isNewHtmlDOM()&&ZFLive.isMatrixInTableFormat?$(inputElem).closest("td").addClass("errorMatrixInput"):$(inputElem).addClass("errorMatrixInput")}function removeMatrixError(inputElem,removeErrToolTip){isNewHtmlDOM()&&ZFLive.isMatrixInTableFormat?$(inputElem).closest("td").removeClass("errorMatrixInput"):$(inputElem).removeClass("errorMatrixInput"),removeErrToolTip&&(isNewHtmlDOM()&&ZFLive.isMatrixInTableFormat?$(inputElem).closest("td").removeAttr("onmouseenter"):$(inputElem).removeAttr("onmouseenter"),$(inputElem).removeAttr("tooltip-title"))}function highlightMatrixSltError(inputElem){isNewHtmlDOM()&&ZFLive.isMatrixInTableFormat?$(inputElem).closest("td").addClass("errorMatrixInput"):($(inputElem).addClass("errorMatrixInput"),$(inputElem).closest("div").addClass("errorMatrixSelect2"))}function removeMatrixSltError(sltElem){isNewHtmlDOM()&&ZFLive.isMatrixInTableFormat?$(sltElem).closest("td").removeClass("errorMatrixInput"):$(sltElem).removeClass("errorMatrixSelect2")}function getAllowedDaysCountResult_forGenFormat(leftOperand,rightOperand,Operator,dateCalcType){if(0!=leftOperand&&-1!==leftOperand.indexOf("--zf--")){var myArray=leftOperand.split("--zf--");if(leftOperand=myArray[0],""!=myArray[1])var leftDisabledDays=JSON.parse(myArray[1])}if(0!=rightOperand&&-1!==rightOperand.indexOf("--zf--")){var myArray1=rightOperand.split("--zf--");if(rightOperand=myArray1[0],""!=myArray1[1])var rightDisabledDays=JSON.parse(myArray1[1])}var dateRegexVal=new RegExp("^\\w{0,2}-\\w{0,2}-\\w{4}$","u"),datetimeregexVal=new RegExp("^\\w{0,2}-\\w{0,2}-\\w{4}\\s\\w{2}:\\w{2}$","u");return isPatternMatches(leftOperand,dateRegexVal)||isPatternMatches(rightOperand,dateRegexVal)||isPatternMatches(rightOperand,datetimeregexVal)||isPatternMatches(leftOperand,datetimeregexVal)?(isPatternMatches(leftOperand,datetimeregexVal)&&(leftOperand=leftOperand.substring(0,leftOperand.indexOf(" "))),isPatternMatches(rightOperand,datetimeregexVal)&&(rightOperand=rightOperand.substring(0,rightOperand.indexOf(" "))),calculateDate_genFormat(leftOperand,rightOperand,Operator,dateCalcType,leftDisabledDays,rightDisabledDays)):calculateFormula("("+leftOperand+")"+Operator+"("+rightOperand+")")}function checkLimitResponsePerColumn(matrixElem){var matrixValueArr=[],isOneRespPerCol=!0;return $(matrixElem).find("tbody").find("tr").find("input:checked").each(function(index,inputElem){var value=$(inputElem).attr("columndisplay");-1==matrixValueArr.indexOf(value)?matrixValueArr.push(value):isOneRespPerCol=!1}),isOneRespPerCol}function addTapHighlightClrClass(){$("body").addClass("mobileTapHighlightClr")}function isiOSMobileBrowser(){var isiOS=/(iPad|iPhone|iPod)/g.test(navigator.userAgent),isiPad13=/Macintosh/g.test(navigator.userAgent)&&navigator.maxTouchPoints>=1;return isiOS||isiPad13}function convertColorCodeToHex(colorCode){if(null!==colorCode&&typeof colorCode!==ResponseKey.UNDEFINED)return colorCode.match(/#[0-9a-fA-F][0-9a-fA-F][0-9a-fA-F][0-9a-fA-F][0-9a-fA-F][0-9a-fA-F]/g)?colorCode:"#"+convertDecToHex(colorCode.substring(0,colorCode.indexOf(",")))+convertDecToHex(colorCode.substring(colorCode.indexOf(",")+1,colorCode.lastIndexOf(",")))+convertDecToHex(colorCode.substring(colorCode.lastIndexOf(",")+1,colorCode.length))}function selectRadioChoiceOs(elem){var parentElem=$(elem).closest("li[elname=livefield-elem]"),alreadyIsSelected=$(elem).attr("isSelected");$(parentElem).find("input[type=radio]").attr("isSelected",!1),"true"==alreadyIsSelected?($(elem).prop("checked",!1).trigger("change"),"zfs-others-zfs"==$(elem).val()&&$(parentElem).find("input[name=allow-others-text]").val("")):($(elem).attr("isSelected",!0),$(elem).prop("checked",!0).trigger("change"),"zfs-others-zfs"!=$(elem).val()?$(parentElem).find("input[name=allow-others-text]").val(""):$(parentElem).find("input[name=allow-others-text]").focus())}function focusSelectElem(selectElem){isiOSMobileBrowser()?$(selectElem).parent().focus():$(selectElem).focus(),isStandardForm()&&$(selectElem).hasClass("select2-hidden-accessible")&&setTimeout(function(){$(selectElem).select2("focus")},100)}function ZFResizeEventObserver(target,callBack){this.elem=target,this.resizeEventCallback=callBack}function signatureResizeEventCallback(self,entries){checkAndSetSignatureElemWidth($(self.elem)),$(self.elem).find("canvas").width()&&self.disconnectObserver()}function setSignatureWidthOnVisible(target){new ZFResizeEventObserver(target,signatureResizeEventCallback).observe()}function bindEvntInFirstPageSignatureComp(firstPageDiv){try{var signatureEle=isNewHtmlDOM()?firstPageDiv.find("div[comptype=25][elname=livefield-elem]"):firstPageDiv.find("li[comptype=25][elname=livefield-elem]");$(signatureEle).each(function(ele){setSignatureWidthOnVisible(this)})}catch(e){console.log(e)}}function setSelect2HeightUsingDummyInpOnFrmLoadCallback(self,entries){self.disconnectObserver();var formBodyDiv=$("div[elname=formWrapper]");setSelect2DropDownHeight(formBodyDiv)}function bindEvntToSetSelect2HeightUsingDummyInpOnFrmLoad(){try{const dummyInputElement=$("#dummyInputElement");dummyInputElement.length>0&&new ZFResizeEventObserver(dummyInputElement[0],setSelect2HeightUsingDummyInpOnFrmLoadCallback).observe()}catch(e){$("#dummyInputElement").remove(),console.log(e)}}function rangeValidationForMonthYear(elem,dataSpecJson,errorIdd){var inpVal=$.trim($(elem).find("input").val()),zf_date_format=$("#zf_date_format"),dateFormat=$(zf_date_format).val(),dateLocale=$(zf_date_format).attr("dateLocale");if(!(inpVal.length>0&&ZFUtil.validateMonthYear(inpVal,dateFormat,dateLocale)))return $(errorIdd).text(ZFLiveErrorConstants.entervalidmonthyear),!1;var dynamicMaxJson=dataSpecJson[DataSpecConst.MAX_LIMIT],dynamicMinJson=dataSpecJson[DataSpecConst.MIN_LIMIT],dateElem=splitMonthYearVal(inpVal,dateFormat,dateLocale),userDate=new Date(dateElem[1],dateElem[0],1),monthYearRangeType=dataSpecJson[DataSpecConst.TYPE];if(monthYearRangeType==MonthYearRangeType.PAST_MONTHYEAR){var limitDateElem=getCurrentDateElemForLimit(dateFormat,dateLocale),limitDate=new Date(limitDateElem[2],limitDateElem[1],limitDateElem[0]);if(typeof dataSpecJson[DataSpecConst.INCLUDE_CURRENTMONTH]==ResponseKey.UNDEFINED||dataSpecJson[DataSpecConst.INCLUDE_CURRENTMONTH]||limitDate.setMonth(limitDate.getMonth()-1),(monthDiff=ZFUtil.getMonthDiff(userDate,limitDate))<0){var errMsg=ZFLiveErrorConstants.maxmonthyearlimit.replace("{0}",convertJsDateToMonthYear(limitDate,dateFormat,dateLocale));return $(errorIdd).text(errMsg),!1}}else if(monthYearRangeType==MonthYearRangeType.FUTURE_MONTHYEAR){limitDateElem=getCurrentDateElemForLimit(dateFormat,dateLocale),limitDate=new Date(limitDateElem[2],limitDateElem[1],limitDateElem[0]);if(typeof dataSpecJson[DataSpecConst.INCLUDE_CURRENTMONTH]==ResponseKey.UNDEFINED||dataSpecJson[DataSpecConst.INCLUDE_CURRENTMONTH]||limitDate.setMonth(limitDate.getMonth()+1),(monthDiff=ZFUtil.getMonthDiff(limitDate,userDate))<0){errMsg=ZFLiveErrorConstants.minmonthyearlimit.replace("{0}",convertJsDateToMonthYear(limitDate,dateFormat,dateLocale));return $(errorIdd).text(errMsg),!1}}else if(monthYearRangeType==MonthYearRangeType.MONTHYEAR_OF_RESPONSE){limitDateElem=getCurrentDateElemForLimit(dateFormat,dateLocale),limitDate=new Date(limitDateElem[2],limitDateElem[1],limitDateElem[0]);if(0!=(monthDiff=ZFUtil.getMonthDiff(limitDate,userDate)))return monthDiff<0?errMsg=ZFLiveErrorConstants.minmonthyearlimit.replace("{0}",convertJsDateToMonthYear(limitDate,dateFormat,dateLocale)):monthDiff>0&&(errMsg=ZFLiveErrorConstants.maxmonthyearlimit.replace("{0}",convertJsDateToMonthYear(limitDate,dateFormat,dateLocale))),$(errorIdd).text(errMsg),!1}else{if(monthYearRangeType==MonthYearRangeType.STARTS_FROM||monthYearRangeType==MonthYearRangeType.RANGE)if(typeof dataSpecJson[DataSpecConst.FROM_DATE]!==ResponseKey.UNDEFINED){limitDateElem=splitMonthYearVal(dataSpecJson[DataSpecConst.FROM_DATE],dateFormat),limitDate=new Date(limitDateElem[1],limitDateElem[0],1);if((monthDiff=ZFUtil.getMonthDiff(limitDate,userDate))<0){errMsg=ZFLiveErrorConstants.minmonthyearlimit.replace("{0}",convertJsDateToMonthYear(limitDate,dateFormat,dateLocale));return $(errorIdd).text(errMsg),!1}}else if(typeof dataSpecJson[DataSpecConst.MIN_LIMIT]!==ResponseKey.UNDEFINED){var minDate=getDateLimit(elem,dynamicMinJson,dateFormat,dateLocale,dataSpecJson[DataSpecConst.DISABLED_DAYS]);if(typeof minDate!=ResponseKey.UNDEFINED)if((monthDiff=ZFUtil.getMonthDiff(minDate,userDate))<0){errMsg=ZFLiveErrorConstants.minmonthyearlimit.replace("{0}",convertJsDateToMonthYear(minDate,dateFormat,dateLocale));return $(errorIdd).text(errMsg),!1}}if(monthYearRangeType==MonthYearRangeType.ENDS_ON||monthYearRangeType==MonthYearRangeType.RANGE)if(typeof dataSpecJson[DataSpecConst.TO_DATE]!==ResponseKey.UNDEFINED){limitDateElem=splitMonthYearVal(dataSpecJson[DataSpecConst.TO_DATE],dateFormat),limitDate=new Date(limitDateElem[1],limitDateElem[0],1);if((monthDiff=ZFUtil.getMonthDiff(userDate,limitDate))<0){errMsg=ZFLiveErrorConstants.maxmonthyearlimit.replace("{0}",convertJsDateToMonthYear(limitDate,dateFormat,dateLocale));return $(errorIdd).text(errMsg),!1}}else if(typeof dataSpecJson[DataSpecConst.MAX_LIMIT]!==ResponseKey.UNDEFINED){var monthDiff,maxDate=getDateLimit(elem,dynamicMaxJson,dateFormat,dateLocale,dataSpecJson[DataSpecConst.DISABLED_DAYS]);if(typeof maxDate!=ResponseKey.UNDEFINED)if((monthDiff=ZFUtil.getMonthDiff(userDate,maxDate))<0){errMsg=ZFLiveErrorConstants.maxmonthyearlimit.replace("{0}",convertJsDateToMonthYear(maxDate,dateFormat,dateLocale));return $(errorIdd).text(errMsg),!1}}}if(typeof dataSpecJson[DataSpecConst.DISABLED_MONTHS]!==ResponseKey.UNDEFINED){var disabledMonths=dataSpecJson[DataSpecConst.DISABLED_MONTHS];if(!ZFUtil.blockMonths(userDate,disabledMonths)[0]){errMsg=ZFLiveErrorConstants.disabledmonthslimit.replace("{0}",getMonthName(userDate.getMonth(),dateLocale));return $(errorIdd).text(errMsg),!1}}return!0}function setMinMaxMonthYearRangesOfMYPicker(dateJson,elem,dateFormat,dateLocale){var dynamicMinJson=dateJson[DataSpecConst.MIN_LIMIT],dynamicMaxJson=dateJson[DataSpecConst.MAX_LIMIT],minLimit=dateJson[DataSpecConst.FROM_DATE],maxLimit=dateJson[DataSpecConst.TO_DATE],includeCurrentMonth=dateJson[DataSpecConst.INCLUDE_CURRENTMONTH],disabledMonths=dateJson[DataSpecConst.DISABLED_MONTHS],rangeType=dateJson[DataSpecConst.TYPE],monthYearPicker=$("#monthYearPicker");$(monthYearPicker).find("ul[elname=monthsUl]").find("li").removeClass("select");var minMonthValue=0,maxMonthValue=11,minYearValue=1900,maxYearValue=2100;if(rangeType==MonthYearRangeType.PAST_MONTHYEAR){maxYearValue=(maxLimit=ZFMonthYearComponent.currentDate).getFullYear();var includeNoOfMonth=includeCurrentMonth?0:1;maxMonthValue=maxLimit.getMonth()-includeNoOfMonth}else if(rangeType==MonthYearRangeType.FUTURE_MONTHYEAR){minYearValue=(minLimit=ZFMonthYearComponent.currentDate).getFullYear();includeNoOfMonth=includeCurrentMonth?0:1;minMonthValue=minLimit.getMonth()+includeNoOfMonth}else if(rangeType==MonthYearRangeType.MONTHYEAR_OF_RESPONSE){var datelimit=ZFMonthYearComponent.currentDate;minYearValue=datelimit.getFullYear(),maxYearValue=datelimit.getFullYear(),minMonthValue=datelimit.getMonth(),maxMonthValue=datelimit.getMonth()}else if(rangeType==MonthYearRangeType.STARTS_FROM){if(typeof minLimit!=ResponseKey.UNDEFINED&&""!=minLimit){var dateElem=splitMonthYearVal(minLimit,dateFormat,dateLocale);minLimit=new Date(dateElem[1],dateElem[0],1)}else minLimit=getDateLimit(elem,dynamicMinJson,dateFormat,dateLocale);typeof minLimit!=ResponseKey.UNDEFINED&&(minMonthValue=minLimit.getMonth(),minYearValue=minLimit.getFullYear())}else if(rangeType==MonthYearRangeType.ENDS_ON){if(typeof maxLimit!=ResponseKey.UNDEFINED&&""!=maxLimit){dateElem=splitMonthYearVal(maxLimit,dateFormat,dateLocale);maxLimit=new Date(dateElem[1],dateElem[0],1)}else maxLimit=getDateLimit(elem,dynamicMaxJson,dateFormat,dateLocale);typeof maxLimit!=ResponseKey.UNDEFINED&&(maxMonthValue=maxLimit.getMonth(),maxYearValue=maxLimit.getFullYear())}else if(rangeType==MonthYearRangeType.RANGE){if(typeof minLimit!=ResponseKey.UNDEFINED&&""!=minLimit){dateElem=splitMonthYearVal(minLimit,dateFormat,dateLocale);minLimit=new Date(dateElem[1],dateElem[0],1)}else minLimit=getDateLimit(elem,dynamicMinJson,dateFormat,dateLocale);if(typeof maxLimit!=ResponseKey.UNDEFINED&&""!=maxLimit){dateElem=splitMonthYearVal(maxLimit,dateFormat,dateLocale);maxLimit=new Date(dateElem[1],dateElem[0],1)}else maxLimit=getDateLimit(elem,dynamicMaxJson,dateFormat,dateLocale);typeof minLimit!=ResponseKey.UNDEFINED&&(minMonthValue=minLimit.getMonth(),minYearValue=minLimit.getFullYear()),typeof maxLimit!=ResponseKey.UNDEFINED&&(maxMonthValue=maxLimit.getMonth(),maxYearValue=maxLimit.getFullYear())}$(monthYearPicker).attr("minMonthValue",minMonthValue),$(monthYearPicker).attr("maxMonthValue",maxMonthValue),$(monthYearPicker).attr("minYearValue",minYearValue),$(monthYearPicker).attr("maxYearValue",maxYearValue),$(monthYearPicker).attr("disabledMonths",disabledMonths),$(monthYearPicker).attr("rangeType",rangeType),setYearRangeForMonthYearPicker(monthYearPicker,minYearValue,maxYearValue)}function handleTabKeyNavigationMonthYearPicker(monthYearDiv,currentElementIndex){if(isAccessibilitySupported()){var monthYearPicker=$("#monthYearPicker");$(monthYearPicker).find("li.disabledMonth").find("div").attr({tabindex:-1,"aria-disabled":"true"});var yearElement=$(monthYearPicker).find("select[elname=selectYear]").next().find("span.select2-selection"),setFocusedElem=$(monthYearPicker).find("li.select").find("div");0==setFocusedElem.length&&(setFocusedElem=$(monthYearPicker).find("li.currentMnth").find("div")),0==setFocusedElem.length&&(setFocusedElem=$(monthYearPicker).find("li:first").find("div"));var monthElement=setFocusedElem;$(yearElement).attr("tabindex",0),handleDateTimeAriaAttr(monthYearDiv,$(yearElement),"year");var elements=[yearElement,monthElement];if(event.shiftKey&&9===event.keyCode){event.preventDefault();var prevElementIndex=(currentElementIndex-1+elements.length)%elements.length;$(elements[prevElementIndex]).focus(),currentElementIndex=prevElementIndex}else if(9===event.keyCode){event.preventDefault();var nextElementIndex=(currentElementIndex+1)%elements.length;$(elements[nextElementIndex]).focus(),currentElementIndex=nextElementIndex}}}function initMonthYearField(monthYearFieldsList,dateFormat,dateLocale){for(var i=0;i=0?datesep="-":dateFormat.indexOf("/")>=0?datesep="/":dateFormat.indexOf(".")>=0&&(datesep=".");var year=jsDate.getFullYear(),monthNo=jsDate.getMonth(),month=monthNo+1;if(month=month<10?"0"+month:month,"dd-mmm-yyyy"==dateFormat)month=CustomDateLocale[dateLocale].monthNamesShort[monthNo];else if("dd-mmmm-yyyy"==dateFormat||"mmmm-dd-yyyy"==dateFormat){month=CustomDateLocale[dateLocale].monthNames[monthNo]}return"dd-mmm-yyyy"==dateFormat||"dd-mmmm-yyyy"==dateFormat?monthYear=month+datesep+year:"yyyy/mm/dd"==dateFormat||"yyyy-mm-dd"==dateFormat?monthYear=year+datesep+month:"mm-dd-yyyy"==dateFormat||"mm/dd/yyyy"==dateFormat||"mmmm-dd-yyyy"==dateFormat?monthYear=month+datesep+year:"dd.mm.yyyy"!=dateFormat&&"dd-mm-yyyy"!=dateFormat&&"dd/mm/yyyy"!=dateFormat||(monthYear=month+datesep+year),monthYear}function initializeMonthYearFieldsForOldStandardForm(){var zf_date_format=$("#zf_date_format"),dateFormat=$(zf_date_format).val(),dateLocale=$(zf_date_format).attr("dateLocale");initMonthYearField(ZFLive.monthYearFieldsList,dateFormat,dateLocale),setMonthLabelsInMYPickerAndModifyActionsOfMYPickerYearSelect($("#monthYearPicker"),dateLocale)}function setMonthYearFieldsLabelsForOFAndFullPageForms(){var zf_date_format=$("#zf_date_format");setMonthLabelsInMYPickerAndModifyActionsOfMYPickerYearSelect($("#monthYearPicker"),$(zf_date_format).attr("dateLocale"))}function invokeClickOnPressOfEnter(elem){13==event.keyCode&&$(elem).click()}function handleFocusOnFileUploadDelete(ele){var prevElement=$(ele).closest("li[elname=newlyAddedFUElement]").prev("li[elname=newlyAddedFUElement]").find("a[name=removeFileElement]"),nextElement=$(ele).closest("li[elname=newlyAddedFUElement]").next("li[elname=newlyAddedFUElement]").find("a[name=removeFileElement]");if(0!=$(prevElement).length)$(prevElement).focus();else if(0!=$(nextElement).length)$(nextElement).focus();else{var linkName=$(ele).parents("li[elname=newlyAddedFUElement]").attr("linkname");linkName=linkName.substring(0,linkName.indexOf("_fu1")),$("#"+linkName+"-li").find("a[elname=iconUpload]").focus()}}function addAccessibilityAttrForAddAutoFillInput(input,isExpanded){isAccessibilitySupported()&&$(input).attr("aria-expanded",isExpanded)}function getPredictions(userInput,countryNamesArray,inpCompLink,parentElemId,component){var searchVal=userInput.value;if(searchVal){var addressContMapDiv=$("#addrAutoCompl"),autoComplete=new google.maps.places.AutocompleteService,requestJson={input:searchVal,componentRestrictions:{country:countryNamesArray},locationBias:{radius:5e3,center:{lat:parseFloat(ZFLive.pri_lat),lng:parseFloat(ZFLive.pri_lon)}}};"ZipCode"==component&&(requestJson.types=["postal_code"]),autoComplete.getPlacePredictions(requestJson,(predictions,status)=>{if(status!==google.maps.places.PlacesServiceStatus.OK||!predictions)return $(addressContMapDiv).hide(),void addAccessibilityAttrForAddAutoFillInput(userInput,!1);var addressContMapUL=$(addressContMapDiv).find("ul[elname=addressContMapUL]");$(addressContMapUL).empty(),$(addressContMapUL).attr("id","addrAutoFill"),$(addressContMapDiv).is(":visible")||($(addressContMapDiv).show(),addAccessibilityAttrForAddAutoFillInput(userInput,!0));var addressContMapULGoogle=$(addressContMapDiv).find("div[elname=powGoogleMap]");$(addressContMapULGoogle).show(),$(addressContMapDiv).show();var index=0;predictions.forEach(prediction=>{var li=document.createElement("li");li.textContent=prediction.description,$(addressContMapUL).append(li);var addressContMapLi=$(addressContMapUL).find("li:last");$(addressContMapLi).attr("onclick",'ZFLive.chooseAddressValue(this,"'+inpCompLink+'", "'+parentElemId+'", "true")').attr("id","addrAutoComplVal"+index).attr("placeID",prediction.place_id),isAccessibilitySupported()&&($(addressContMapUL).attr("role","listbox"),$(addressContMapLi).attr("role","option")),index++}),setAddrAutoComplListPos(addressContMapDiv,userInput),isAccessibilitySupported()&&($(userInput).removeAttr("aria-controls"),$(userInput).removeAttr("aria-activedescendant"),$(userInput).attr("aria-controls",$(addressContMapUL).attr("id"))),$(document).on("click.addrAutofill",function(event){0==$("div[elname=addressContMap]").find(event.target).length&&($(addressContMapDiv).hide(),addAccessibilityAttrForAddAutoFillInput(userInput,!1)),$(document).off("click.addrAutofill")})})}}function setAddrAutoComplListPos(addressContMapDiv,currInput){var res=$(currInput).offset();$(addressContMapDiv).css("top",res.top+currInput.offsetHeight),$(addressContMapDiv).css("left",res.left),$(addressContMapDiv).css("width",$(currInput).parent().width()),setTopOrBottomPositionForList(addressContMapDiv,currInput)}function setTopOrBottomPositionForList(addressContMapDiv,currInput){var listHeight=$(addressContMapDiv).outerHeight(),currTop=$(addressContMapDiv)[0].getBoundingClientRect().top,inputTop=$(currInput).offset().top;if(listHeight+currTop>$(window).outerHeight(!0)){var listTop=inputTop-listHeight;$(addressContMapDiv).css("top",listTop)}}function fetchPlaceDetails(inpCompLink,placeId,isZipCodeSearch,parentLiElem){var fieldLinkName=$(parentLiElem).attr("linkname"),placeService=new google.maps.places.PlacesService(document.createElement("div"));$(parentLiElem).find('input[complink="'+inpCompLink+'"]').siblings("span[elname=loading-icon]").show(),$(parentLiElem).find("span[elname=loading-icon]").closest("span").addClass("addrSearchResultFreez"),$("div[elname=address_overlay]").show(),placeService.getDetails({placeId:placeId,fields:["address_components","formatted_address","name"]},(place,status)=>{if($(parentLiElem).find("span[elname=loading-icon]").hide(),$(parentLiElem).find("input[complink="+inpCompLink+"]").find("span[elname=loading-icon]").closest("span").removeClass("addrSearchResultFreez"),$("div[elname=address_overlay]").hide(),status===google.maps.places.PlacesServiceStatus.OK){var addressJson={},a="",r="",s="",n={},countryCode="";for(let component of place.address_components){if(component.hasOwnProperty("types")&&component.types.length>0)if("country"==(addressTypeOfZeroThElement=(types=component.types)[0])){countryCode=shortName=component.short_name;break}}var streetFields=["room","floor","street_number","street_address","route"],spaceNeededCountries=["US","NZ","GB","BR","AU","CA","FR","DE","ID","ES","MX","NL","IT","PH","SG","SZ","BE","GE","HK","AR","IE","PT","IL","NO","TH","EC","PL","CY","GR","SE","DO","FI","ZA","CH","NG","CZ","PR","PE","EG"],addressLine1Fields=["floor","subpremise","premise","street_number","street_address","route","neighborhood"],isCityValueSet=!1,isStateValueSet=!1;for(let component of place.address_components)if(component.hasOwnProperty("types")&&component.types.length>0){var types,addressTypeOfZeroThElement=(types=component.types)[0],longName=component.long_name;if("administrative_area_level_2"==addressTypeOfZeroThElement||"administrative_area_level_3"==addressTypeOfZeroThElement)addressJson.district=longName;else if("country"==addressTypeOfZeroThElement){addressJson.country=longName;var shortName=component.short_name;addressJson.country_code=shortName}else"postal_code"==addressTypeOfZeroThElement&&(addressJson.postal_code=longName);if("locality"!=addressTypeOfZeroThElement&&"sublocality_level_1"!=addressTypeOfZeroThElement||(addressJson.city=longName),"GB"!=countryCode&&"NO"!=countryCode||("postal_town"==addressTypeOfZeroThElement?(addressJson.city=longName,isCityValueSet=!0):"administrative_area_level_2"==addressTypeOfZeroThElement&&(addressJson.state=longName,isStateValueSet=!0)),isCityValueSet||"locality"!=addressTypeOfZeroThElement&&"sublocality_level_1"!=addressTypeOfZeroThElement?isStateValueSet||"administrative_area_level_1"!=addressTypeOfZeroThElement||(addressJson.state=longName):addressJson.city=longName,streetFields.includes(addressTypeOfZeroThElement))a=["street_number","street_address","route"].includes(addressTypeOfZeroThElement)&&spaceNeededCountries.includes(countryCode)?0===a.length?longName:a+" "+longName:0===a.length?longName:a+", "+longName,addressJson.street=a;if(addressLine1Fields.includes(addressTypeOfZeroThElement))r=["street_number","street_address","route"].includes(addressTypeOfZeroThElement)&&spaceNeededCountries.includes(countryCode)?0===r.length?longName:r+" "+longName:0===r.length?longName:r+", "+longName,addressJson.address_line1=r;["landmark","political","administrative_area_level_4","administrative_area_level_5","administrative_area_level_6","administrative_area_level_7","sublocality_level_1","sublocality_level_2","sublocality_level_3","sublocality_level_4","sublocality_level_5"].includes(addressTypeOfZeroThElement)&&(s=0===s.length?longName:s+", "+longName,addressJson.address_line2=s),types.includes("plus_code")&&(n.plus_code_global=longName,addressJson.vendor_specific_data=n)}place.hasOwnProperty("name")&&(place.hasOwnProperty("formatted_address")&&place.formatted_address.startsWith(place.name)||(addressJson.name=place.name)),handleKeyMappingForAddressThroughMaps(addressJson,fieldLinkName,isZipCodeSearch,parentLiElem),$(parentLiElem).attr("placeid",placeId),$(parentLiElem).find("input").off("input.googlemap").on("input.googlemap",function(event){ZFLive.removeAttribute(event,this)}),$(parentLiElem).find("select").off("change.googlemap").on("change.googlemap",function(event){ZFLive.removeAttribute(event,this)})}})}function handleKeyMappingForAddressThroughMaps(item,fieldLinkName,isZipCodeSearch,parentLiElem){var newItem=changeKeys(item,{country_code:"Country_isocode",address_line1:"AddressLine1",address_line2:"AddressLine2",city:"City",postal_code:"ZipCode",state:"Region"},fieldLinkName,isZipCodeSearch),evalFormula=[],formulaFldsArr=[];null!=ZFLive.formulaFieldsList&&(formulaFldsArr=JSON.parse(ZFLive.formulaFieldsList));var isSubform=isSfChild(parentLiElem);ZFLivePrefillUtil.prefillFormFields(parentLiElem,fieldLinkName,newItem,isSubform,!0),ZFLivePrefillUtil.evalRulesAfterPrefill(parentLiElem);var formFldLinkName=parentLiElem.attr("linkname");-1!=$.inArray(formFldLinkName,formulaFldsArr)&&evalFormula.push(formFldLinkName),ZFLivePrefillUtil.postActionsAfterPrefill(evalFormula)}function changeKeys(item,keyMapping,prefix,isZipCodeSearch){var newItem={};for(var key in keyMapping){var newKey=prefix+"_"+keyMapping[key];if(item.hasOwnProperty(key))if("country_code"===key)newItem[newKey]=item.country_code.toUpperCase();else if(isZipCodeSearch)newItem[newKey]="address_line1"===key||"address_line2"===key?"":item[key];else if("address_line1"===key)if(item.hasOwnProperty("name")&&!item[key].includes(item.name)){var addr_line1=item.name+", "+item[key];item.hasOwnProperty("street")&&!addr_line1.includes(item.street)?newItem[newKey]=addr_line1+", "+item.street:newItem[newKey]=addr_line1}else item.hasOwnProperty("street")&&!item[key].includes(item.street)?newItem[newKey]=item[key]+", "+item.street:newItem[newKey]=item[key];else newItem[newKey]=item[key];else if("city"===key)item.hasOwnProperty("district")&&(newItem[newKey]=item.district);else if("address_line1"!==key||isZipCodeSearch)newItem[newKey]="";else if(item.hasOwnProperty("name")){addr_line1=item.name;item.hasOwnProperty("street")&&!addr_line1.includes(item.street)?newItem[newKey]=addr_line1+", "+item.street:newItem[newKey]=addr_line1}else item.hasOwnProperty("street")?newItem[newKey]=item.street:newItem[newKey]=""}return newItem}function removeHighLighting(ulElem){$(ulElem).find("li").removeClass("select")}function highLightLI(liElem){$(liElem).addClass("select")}function updateAriaAttributesAddrAutofill(input,liElem){isAccessibilitySupported()&&($(input).attr("aria-activedescendant",$(liElem).attr("id")),$(liElem).attr("aria-selected","true"))}function focusPrevLIElem(ulElem,input){var selectedLiElem=getSelectedLI(ulElem);if($(input).removeAttr("aria-activedescendant"),$(selectedLiElem).removeAttr("aria-selected"),0===$(selectedLiElem).length)highLightLI($(ulElem).find("li:first")),updateAriaAttributesAddrAutofill(input,$(ulElem).find("li:first"));else{var prevLiElem=$(selectedLiElem).prev("li");removeHighLighting(ulElem),0===$(prevLiElem).length?(highLightLI($(ulElem).find("li:last")),updateAriaAttributesAddrAutofill(input,$(ulElem).find("li:last"))):(highLightLI(prevLiElem),updateAriaAttributesAddrAutofill(input,prevLiElem))}}function focusNextLIElem(ulElem,input){var selectedLiElem=getSelectedLI(ulElem);if($(input).removeAttr("aria-activedescendant"),$(selectedLiElem).removeAttr("aria-selected"),0===$(selectedLiElem).length)highLightLI($(ulElem).find("li:first")),updateAriaAttributesAddrAutofill(input,$(ulElem).find("li:first"));else{var nextLiElem=$(selectedLiElem).next("li");nextLiElem.attr("number");removeHighLighting(ulElem),0===$(nextLiElem).length?(highLightLI($(ulElem).find("li:first")),updateAriaAttributesAddrAutofill(input,$(ulElem).find("li:first"))):(highLightLI(nextLiElem),updateAriaAttributesAddrAutofill(input,nextLiElem))}}function getSelectedLI(ulElem){return $(ulElem).find("li.select")}function liSelectfn(ulElem,inpCompLink,parentElemId,isGoogleMap){var selectedLiElem=getSelectedLI(ulElem);if(0===$(selectedLiElem).length)return!1;ZFLive.chooseAddressValue(selectedLiElem,inpCompLink,parentElemId,isGoogleMap)}function showDraftSelectionPopup(){$(document.body).addClass("zdraftModalOpen");var draftEntriesSelectionPopup=$("#draftEntriesSelectionPopup");$(draftEntriesSelectionPopup).find("div[entryType=1] h2[elname=draftCount]").text(ZFLive.savedEntries.initial_count),$(draftEntriesSelectionPopup).fadeIn(function(){bindEventsToDraftSelectionPopup(draftEntriesSelectionPopup)})}function bindEventsToDraftSelectionPopup(draftEntriesSelectionPopup){var viewDraftEntriesDiv=$(draftEntriesSelectionPopup).find("div[elemtype=entryTypeChoice][entryType=1]"),addNewEntryDiv=$(draftEntriesSelectionPopup).find("div[elemtype=entryTypeChoice][entryType=2]");$(viewDraftEntriesDiv).off("click").on("click",function(){ZFLive.savedEntries.startIdx=1,ZFLive.savedEntries.pageSize=10,ZFLive.fetchSavedRecordsPermaAndShowSummaryPopup(!0,SavedEntriesConstants.NEXT)}),$(addNewEntryDiv).off("click").on("click",function(){hideDraftSelectionPopup()}),ZFLive.SavedEntriesAccessibilityUtil.setAccessibilityToDraftSelectionPopup()}function setAdvDisplayNamesTextContent(summaryDiv){for(var advDisNames=summaryDiv[0].querySelectorAll("[elname=adv_disp_name]"),i=0;i0&&"false"==$(gridFldElem).attr("needdata")?"false":$(elem).attr("needdata")}function triggerFormAction(elem){var pageCount=isStandardForm()?$("#formBodyDiv").find("[elname=formBodyULName]").length:$("#formBodyDiv").find("ul[elname=formBodyULName]").length,pageNum=isStandardForm()?$(elem).closest("[elname=formBodyULName]").attr("page_no"):$(elem).closest("ul[elname=formBodyULName]").attr("page_no");if(pageCount!=pageNum){var bodyElem=isStandardForm()?"div[elname=formContainer]":"#formRedirectURL";$(bodyElem).find("[elname=footer][page_no="+pageNum+"]").find("button[elname=next]").click()}else if(0!==ZFLive.formStatus&&1==ZFLive.enter_submit)if("edit"===ZFLive.mode){var updateBtn=$(ZFLive.formFormFieldsOuterWrapper).find("button[elname=update]");$(updateBtn).length>0&&!0!==$(updateBtn).prop("disabled")&&$(updateBtn)[0].click()}else!0!==$('button[elname="submit"]').prop("disabled")&&$(ZFLive.formFormFieldsOuterWrapper).find("button[elname=submit]")[0].click()}function ZFCrmLive(){this.zohoCrmFieldEntriesDetailsJson={},this.formBodyDiv=$("#formBodyDiv"),this.processSearch=!0,this.crmEncryptedRecordId="",this.crmEncryptedZsoid="",this.crmNewEncStr=undefined,this.zCrmFldDataJson={}}function ZFSubFormLive(){this.subFormValueArray=new Array,this.subFormValueJson={},this.isPopUpEdit=!1,this.addressMap={}}function iterateSubformAndRemoveErr(sfLi,validRowsArray){for(var sfRowIndex=0;sfRowIndexZFLive.subformMaxEntryLimit&&(valOfFld=ZFLive.subformMaxEntryLimit),roundTheValueInFormula(valOfFld,DateCalculationType.ROUNDDOWN)}return parseInt($(elem).attr("min-entry"))}function calcMaxEntryValForThisSF(elem){if(void 0!==$(elem).attr("max-entry-fld")){var valOfFld=getValue($(elem).attr("max-entry-fld"),!1);return void 0!==valOfFld&&null!=valOfFld&&""!=valOfFld||(valOfFld=0),valOfFld>ZFLive.subformMaxEntryLimit&&(valOfFld=ZFLive.subformMaxEntryLimit),roundTheValueInFormula(valOfFld,DateCalculationType.ROUNDUP)}return parseInt($(elem).attr("max-entry"))}function getSubFormChildActualCompName(compName){return compName.substr(0,compName.lastIndexOf("_"))}function constructSignatureFieldpopupview(elempopup,elem){var compname=$(elem).attr("compname");if($(elempopup).find("img").remove(),"none"==$("#signContainer-"+compname).css("display")){var idVal="editsignContainer-"+compname,imgId="img-"+compname,srcElem=$(elem).find("div[id="+idVal+"]").find("img[id="+imgId+"]");getSubformPopupCardImage(srcdata=$(srcElem).attr("src"),elempopup)}else{$(elem).attr("linkname");var srcdata,signElem=document.getElementById("drawingCanvas-"+compname);""!=(srcdata=isEmptyCanvasElem(signElem)?"":signElem.toDataURL())&&getSubformPopupCardImage(srcdata,elempopup)}}function getSubformPopupCardImage(srcdata,elempopup){var imgElem=document.createElement("img");imgElem.src=srcdata,imgElem.className="sfSignCardimg",$(elempopup).append(imgElem)}function showNoSubFormsRowBtnDiv(subFormsLiElem){var noElemAddEntryDiv=$(subFormsLiElem).find('[elname="noElemAddEntryBtnDiv"]');$(noElemAddEntryDiv).show(),isAccessibilitySupported()&&$(noElemAddEntryDiv).find("a[elname=noElemAddEntryBtn]").focus(),isStandardForm()?$(subFormsLiElem).find("div.fullPage_subfrmInner").css("overflow-x","hidden"):$(subFormsLiElem).find("div.tempSubfrmWrapper").css("overflow-x","hidden"),$(subFormsLiElem).find('[elname="subFormLabelDiv"] > ul').addClass("subfrmAdd_botspace")}function hideNoSubFormsRowBtnDiv(subFormsLiElem){$(subFormsLiElem).find('[elname="noElemAddEntryBtnDiv"]').hide(),isStandardForm()?$(subFormsLiElem).find("div.fullPage_subfrmInner").css("overflow-x",""):$(subFormsLiElem).find("div.tempSubfrmWrapper").css("overflow-x","auto"),$(subFormsLiElem).find('[elname="subFormLabelDiv"] > ul').removeClass("subfrmAdd_botspace")}function addFirstSubFormEntryRow(elem){var subFormParentLi=isStandardForm()?$(elem).closest('div[elemtype="subFormField"]'):$(elem).closest('li[elemtype="subFormField"]'),maxEntryVal=calcMaxEntryValForThisSF($(subFormParentLi)),minEntryVal=calcMinEntryValForThisSF($(subFormParentLi));if(maxEntryValZFLive.subformMaxEntryLimit&&(maxEntryVal=ZFLive.subformMaxEntryLimit),minEntryVal>ZFLive.subformMaxEntryLimit&&(minEntryVal=ZFLive.subformMaxEntryLimit),0!=maxEntryVal){var rowId=parseInt($(subFormParentLi).attr("rowIdx"))+1,sfFieldsClone=isStandardForm()?$(subFormParentLi).find('div[elname="subFormFieldsCloneUl"]').clone():$(subFormParentLi).find('ul[elname="subFormFieldsCloneUl"]').clone(),myClonedChildUl=$(sfFieldsClone).attr("elname","subFormFieldsUl").attr("rowId",rowId);isAccessibilitySupported()&&$(myClonedChildUl).find("div[elname=sfLivemoreListDiv]").hide();var subFormFieldsCloneUl=$(subFormParentLi).find('[elname="subFormFieldsCloneUl"]');if("true"==$(subFormParentLi).attr("show_seq_no")&&$(myClonedChildUl).find('div[elname="showSfSeqNo"]').find('span[elname="val"]').text(1),$(subFormParentLi).attr("rowIdx",rowId),$(myClonedChildUl).insertAfter($(subFormFieldsCloneUl)),hideNoSubFormsRowBtnDiv($(subFormParentLi)),isStandardForm())bindSelect2DropdownForChildElemOneField(myClonedChildUl,"select2FormList sfSel2DrpDwn"),$(myClonedChildUl).find(".tempContDiv span.select2FormCont").find("span:nth-child(2)").addClass("select2FormArrow"),multiSelectInitSubformChild(myClonedChildUl,subFormParentLi),bindSelect2FuncForAccessibility($(myClonedChildUl).find("div[comptype="+ZFFieldTypeConstants.ADDRESS+"],div[comptype="+ZFFieldTypeConstants.NAME+"],div[comptype="+ZFFieldTypeConstants.DROPDOWN+"],div[comptype="+ZFFieldTypeConstants.TIME+"]")),bindMultiSelectForAccessibility($(myClonedChildUl).find("div[comptype="+ZFFieldTypeConstants.MULTIPLE_CHOICE+"]").find("select"));else if(ZFLive.isDefaultTheme!=undefined&&1==ZFLive.isDefaultTheme||ZFLive.sfdpdTemplate!=undefined&&"modelone"==ZFLive.sfdpdTemplate){bindSelect2Dropdown(myClonedChildUl,"select2SformList"),bindSelect2FuncForAccessibility($(myClonedChildUl).find(".name, .tempFrmWrapper.address, .time, .dropdown")),$(myClonedChildUl).find(".time, .name, .address, .dropdown").addClass("zfSubformSelect2"),$(myClonedChildUl).find(".tempContDiv span.select2FormCont").find("span:nth-child(2)").addClass("select2FormArrow");var formSboxDiv=$(myClonedChildUl).find(".tempContDiv .form_sBox");$(formSboxDiv).find(".customArrow").addClass("selectArrow").removeClass("customArrow"),$(formSboxDiv).removeClass("form_sBox").addClass("form_selectBox")}$(myClonedChildUl).show(),$(myClonedChildUl).find("input, select").keypress(function(event){13===event.which&&(event.preventDefault(),triggerFormAction(myClonedChildUl))}),this.bindInputMaskForSubform(myClonedChildUl),modifyClonedSubFormEntryProp(myClonedChildUl,rowId,subFormParentLi,!0,!1),bindChangeToAddrFldAndCheckStatesListExistOnLoad($(myClonedChildUl),!1),focusFirstField($(myClonedChildUl)),isStandardForm()&&setSelect2DropDownHeight($("div[elname=formWrapper]"));var sfSummaryDiv=$(subFormParentLi).find('[elname="sfSummaryDiv"]');$(sfSummaryDiv).length>0&&"true"==$(subFormParentLi).attr("show_summary")&&(resetSFSummary($(subFormParentLi)),$(sfSummaryDiv).show()),triggerFormResize()}else showInfoPopUp(ZFUtil.replaceParams(i18n.subformentriesmaxlimit,maxEntryVal),$(elem))}function showSubFormPop(myClonedChildUl,subFormParentLi,rowId,isNew,prevRowId,sfCardElem){$(myClonedChildUl).hasClass("formFieldWrapper")||$(myClonedChildUl).addClass("formFieldWrapper");var sfPopUp=$("#subFormPopUp");subFormParentLi.hasClass("zfSubFrmfldDisabled")?sfPopUp.addClass("fieldDisabled zfSubFrmfldDisabled"):sfPopUp.removeClass("fieldDisabled zfSubFrmfldDisabled");var sfPopUpElem=$(sfPopUp).find("#sFPopUpElem");$(sfPopUpElem).html("").append($(myClonedChildUl)),(ZFLive.isDefaultTheme!=undefined&&1==ZFLive.isDefaultTheme||ZFLive.dpdTemplate!=undefined&&"modelone"==ZFLive.dpdTemplate)&&(bindSelect2Dropdown(myClonedChildUl,"select2FormList"),isStandardForm()?(bindSelect2FuncForAccessibility($(myClonedChildUl).find("div[comptype="+ZFFieldTypeConstants.ADDRESS+"],div[comptype="+ZFFieldTypeConstants.NAME+"],div[comptype="+ZFFieldTypeConstants.DROPDOWN+"],div[comptype="+ZFFieldTypeConstants.TIME+"]")),bindMultiSelectForAccessibility($(myClonedChildUl).find("div[comptype="+ZFFieldTypeConstants.MULTIPLE_CHOICE+"]").find("select"))):bindSelect2FuncForAccessibility($(myClonedChildUl).find(".name, .tempFrmWrapper.address, .time, .dropdown")),$(myClonedChildUl).find(".tempContDiv span.select2FormCont").find("span:nth-child(2)").addClass("select2FormArrow")),$(myClonedChildUl).show(),$(sfPopUp).fadeIn(),isOneFieldForm()&&updateSubformFieldsSeqNumber(myClonedChildUl),isNewHtmlDOM()&&(bindSelect2DropdownForChildElemOneField(myClonedChildUl,"select2FormList sfSel2DrpDwn"),$(myClonedChildUl).find(".tempContDiv span.select2FormCont").find("span:nth-child(2)").addClass("select2FormArrow"),multiSelectInitSubformChild(myClonedChildUl,subFormParentLi),bindEventForClearIconShowOrHide(myClonedChildUl)),$("body").addClass("hideWindowScroll");var sfPopupCont=$("#subFormPopUpCont");if(isOneFieldForm()){var windowWidth=$(window).outerWidth(!0),sfParentElemWidth=$(subFormParentLi).outerWidth(!0);windowWidth>850?$(sfPopupCont).width("800px"):(sfParentElemWidth>=windowWidth&&(sfParentElemWidth-=40),$(sfPopupCont).width(sfParentElemWidth))}else isStandardForm()?$(sfPopupCont).width($('div[elname="formContainer"]').width()-30):$(sfPopupCont).width($('[elname="frmTemplate"]').width()-30);$(sfPopupCont).find('[elname="subFormFieldsUl"]').removeClass("subFormHorizontal"),setSFPopUpPosition($(sfPopupCont),$(sfCardElem));var sfPopUpHeader=$(sfPopUp).find('[elname="sfPopUpHeader"]');$.trim($(subFormParentLi).find("label[elname=label]").text()).length>0?($(sfPopUpHeader).show(),isAccessibilitySupported()&&$(sfPopupCont).attr("aria-label",$(subFormParentLi).find("label[elname=label]").text()),isOneFieldForm()?$(sfPopUpHeader).find("h2").find("em").html($(subFormParentLi).find("label[elname=label] span").html()):$(sfPopUpHeader).find("h2").find("em").html($(subFormParentLi).find("label[elname=label]").html()),isNewHtmlDOM()?$(sfPopUpHeader).find("p").text($(subFormParentLi).find("span[elname=hint]").text()):$(sfPopUpHeader).find("p").text($(subFormParentLi).children('p[elname="hint"]').text())):$(sfPopUpHeader).hide(),$(myClonedChildUl).find("div[elname=signContainer]").each(function(index,sfFldUl){"true"!=$(sfFldUl).attr("isneedresizeWidth")&&0!=$(sfFldUl).find("canvas").attr("width")&&0!=$(sfFldUl).find("canvas").attr("height")||(isNewHtmlDOM()?setCanvasElemWidthAndHeight($(sfFldUl).closest("div[elname=livefield-elem]").attr("compname")):setCanvasElemWidth($(sfFldUl).parent().parent().attr("compname")),$(sfFldUl).removeAttr("isneedresizeWidth"))}),$(sfPopUp).attr("linkname",$(subFormParentLi).attr("linkname")),$(sfPopUp).attr("prevrowid",prevRowId),$(sfPopUp).attr("isnew",isNew),$(sfPopUp).attr("thisrowid",rowId),$(sfPopUp).find("#sFPopUpCloseLink").off("click"),isNew?($(sfPopUp).find("#sFPopUpCloseLink").click(hideSfPopUp),$(sfPopUp).attr("isedit",!1)):($(sfPopUp).find("#sFPopUpCloseLink").click(restoreSFPrevVal),$(sfPopUp).attr("isedit",!0)),$(sfPopUpElem).find("input, select").off("keypress"),$(sfPopUpElem).find("input, select").keypress(function(e){13==e.which&&(e.preventDefault(),addThisSFEntryFromPopUp())}),isNewHtmlDOM()&&setSelect2DropDownHeight(myClonedChildUl),isOneFieldForm()&&preventNumberFieldWheelEvent(myClonedChildUl)}function setSFPopUpPosition(elem,sfCardElem){if(isOneFieldForm()){elem.css("position","absolute");var winHeight=$(window).height(),ppHeight=elem.outerHeight();if(ppHeight>winHeight)top=Math.max(0,($(window).height()-elem.outerHeight())/3);else if(Math.floor(winHeight/ppHeight)<=1)top=Math.max(0,($(window).height()-elem.outerHeight())/3);else{var sfCardTop=sfCardElem.offset().top;if(ppHeight<1.2*Math.max(0,winHeight-sfCardTop))top=Math.max(0,sfCardElem.offset().top-parseFloat($(elem).css("marginTop")));else var bufferHeight=$("#navFooter").height()+70,top=Math.max(0,$(window).height()-elem.outerHeight()-bufferHeight)}elem.css("top",top+"px"),$(elem).attr("top",top+parseFloat($(elem).css("marginTop")));var left=Math.max(0,($(window).width()-elem.outerWidth())/2);elem.css("left",left+"px"),$(elem).attr("left",left+parseFloat($(elem).css("marginLeft"))).find("span[elname=ppSpan]").focus()}else{elem.css("position","absolute"),top=window.top.location!==window.self.location&&$(window).height()>800?Math.max(0,$(sfCardElem).offset().top-$(window).scrollTop()-parseFloat($(elem).css("marginTop"))-50):Math.max(0,($(window).height()-elem.outerHeight())/3),elem.css("top",top+"px"),$(elem).attr("top",top);left=Math.max(0,($(window).width()-elem.outerWidth())/2);elem.css("left",left+"px"),$(elem).attr("left",left+parseFloat($(elem).css("marginLeft")))}}function bindInputMaskForSubform(elem){for(var eachSubFormField=elem.find("[elname=livefield-elem]"),i=0;iZFLive.subformMaxEntryLimit&&(maxEntryVal=ZFLive.subformMaxEntryLimit),minEntryVal>ZFLive.subformMaxEntryLimit&&(minEntryVal=ZFLive.subformMaxEntryLimit),totalSubFormEntries>=maxEntryVal)showInfoPopUp(ZFUtil.replaceParams(i18n.subformentriesmaxlimit,maxEntryVal),$(elem));else{var rowIdFromUl=$(subFormParentLi).attr("rowIdx"),rowId=parseInt(rowIdFromUl)+1,myClonedChildUl=cloneSubFormEntry(subFormParentLi,rowId);if(1==viewType){var thisSubFormFldUl=isStandardForm()?$(elem).closest('div[elname="subFormFieldsUl"]'):$(elem).closest('ul[elname="subFormFieldsUl"]');if($(myClonedChildUl).insertAfter($(thisSubFormFldUl)),"true"==$(subFormParentLi).attr("show_seq_no")){var entrySeqNo=parseInt($(thisSubFormFldUl).find('div[elname="showSfSeqNo"]').find('span[elname="val"]').text()),sfFieldsUL=isStandardForm()?$(thisSubFormFldUl).nextAll('div[elname="subFormFieldsUl"]'):$(thisSubFormFldUl).nextAll('ul[elname="subFormFieldsUl"]');$(sfFieldsUL).each(function(index,sfFldUl){entrySeqNo+=1,$(sfFldUl).find('div[elname="showSfSeqNo"]').find('span[elname="val"]').text(entrySeqNo)})}isStandardForm()&&setSelect2DropDownHeight($("div[elname=formWrapper]"))}else if(2==viewType){var lastCard=$(subFormParentLi).find('div[elname="sfcardelem"]').last(),prevRowId=0;lastCard.length>0&&(prevRowId=parseInt($(lastCard).attr("cardrowid"))),showSubFormPop($(myClonedChildUl),$(subFormParentLi),rowId,!0,prevRowId,$(elem))}if(isDuplicate){if(1==viewType)thisSubFormFldUl=isNewHtmlDOM()?$(elem).closest('div[elname="subFormFieldsUl"]'):$(elem).closest('ul[elname="subFormFieldsUl"]');else if(2==viewType){var sfCardElem=$(elem).closest('[elname="sfcardelem"]'),thisCardRowId=$(sfCardElem).attr("cardrowid");thisSubFormFldUl=isNewHtmlDOM()?$(subFormParentLi).find('div[elname="subFormFieldsUl"][rowId="'+thisCardRowId+'"]'):$(subFormParentLi).find('ul[elname="subFormFieldsUl"][rowId="'+thisCardRowId+'"]')}ZFSubFormLive.zfSubFormLive=new ZFSubFormLive,ZFSubFormLive.zfSubFormLive.constructBackUpDataForPopUp($(thisSubFormFldUl),!0)}modifyClonedSubFormEntryProp(myClonedChildUl,rowId,subFormParentLi,!0,isDuplicate),bindChangeToAddrFldAndCheckStatesListExistOnLoad($(myClonedChildUl),isDuplicate),isDuplicate&&!isOneFieldForm()&&ZFLive.validateSubFormRowOnRowDuplicate($(subFormParentLi),myClonedChildUl,thisSubFormFldUl),1==viewType&&resetSFSummary($(subFormParentLi)),isOneFieldForm()||focusFirstField($(myClonedChildUl)),triggerFormResize()}}function cloneSubFormEntry(subFormParentLi,rowId){var viewType=$(subFormParentLi).attr("viewtype"),myClonedChildUlTemp=isNewHtmlDOM()?$(subFormParentLi).find('div[elname="subFormFieldsCloneUl"]').clone():$(subFormParentLi).find('ul[elname="subFormFieldsCloneUl"]').clone(),myClonedChildUl=$(myClonedChildUlTemp).attr("elname","subFormFieldsUl").attr("rowId",rowId);if(isAccessibilitySupported()&&$(myClonedChildUl).find("div[elname=sfLivemoreListDiv]").hide(),myClonedChildUl.find('[elname="livefield-elem"][comptype=13]').each(function(idx,li){var fldActualLinkName=$(li).attr("id").slice(0,-5);setNameChangeLiPropInSubFormFoRadio($(li),rowId,fldActualLinkName)}),1==viewType){if($(subFormParentLi).attr("rowIdx",rowId),isStandardForm())bindSelect2DropdownForChildElemOneField(myClonedChildUl,"select2FormList sfSel2DrpDwn"),$(myClonedChildUl).find(".tempContDiv span.select2FormCont").find("span:nth-child(2)").addClass("select2FormArrow"),multiSelectInitSubformChild(myClonedChildUl,subFormParentLi),bindSelect2FuncForAccessibility($(myClonedChildUl).find("div[comptype="+ZFFieldTypeConstants.ADDRESS+"],div[comptype="+ZFFieldTypeConstants.NAME+"],div[comptype="+ZFFieldTypeConstants.DROPDOWN+"],div[comptype="+ZFFieldTypeConstants.TIME+"]")),bindMultiSelectForAccessibility($(myClonedChildUl).find("div[comptype="+ZFFieldTypeConstants.MULTIPLE_CHOICE+"]").find("select"));else if(ZFLive.isDefaultTheme!=undefined&&1==ZFLive.isDefaultTheme||ZFLive.sfdpdTemplate!=undefined&&"modelone"==ZFLive.sfdpdTemplate){bindSelect2Dropdown(myClonedChildUl,"select2SformList"),bindSelect2FuncForAccessibility($(myClonedChildUl).find(".name, .tempFrmWrapper.address, .time, .dropdown")),$(myClonedChildUl).find(".time, .name, .address, .dropdown").addClass("zfSubformSelect2"),$(myClonedChildUl).find(".tempContDiv span.select2FormCont").find("span:nth-child(2)").addClass("select2FormArrow");var formSboxDiv=$(myClonedChildUl).find(".tempContDiv .form_sBox");$(formSboxDiv).find(".customArrow").addClass("selectArrow").removeClass("customArrow"),$(formSboxDiv).removeClass("form_sBox").addClass("form_selectBox")}$(myClonedChildUl).show(),$(myClonedChildUl).find("input, select").keypress(function(event){13===event.which&&(event.preventDefault(),triggerFormAction(myClonedChildUl))})}return this.bindInputMaskForSubform(myClonedChildUl),myClonedChildUl}function bindSelect2Dropdown(myClonedChildUl,listClass){var direction=getSelect2Direction();$(myClonedChildUl).find(".name, .tempFrmWrapper.address, .time, .dropdown").find("select").select2({containerCssClass:"select2FormCont",dropdownCssClass:listClass,dir:direction,templateSelection:getTemplateSelectionHtml,matcher:getSelect2Matcher,templateResult:getTemplateResultHtml})}function hideSfPopUp(){ZFLive.isSFPopUpEnterTriggered||($("#subFormPopUp").fadeOut("fast",function(){var sfPopUp=$("#subFormPopUp"),sfLinkName=$(sfPopUp).attr("linkname"),ulElem=$(sfPopUp).find("#sFPopUpElem").children('[elname="subFormFieldsUl"]');removeUploadedFiles($(ulElem));var rowId=$(ulElem).attr("rowid");$(ulElem).remove(),removeSubFormEntryCommon(getFieldElem(sfLinkName),rowId),triggerFormResize(),isOneFieldForm()&&ZFSlideNav.updateSlideContainerHeight(),isAccessibilitySupported()&&$("#"+sfLinkName+"-li").find("div[elname=addNewCardElem]").focus()}),$("body").removeClass("hideWindowScroll"))}function addThisSFEntryFromPopUp(){if(!ZFLive.isSFPopUpEnterTriggered){ZFLive.isSFPopUpEnterTriggered=!0,ZFLive.preventHidingErrorMsg();var subFormLinkName=$("#subFormPopUp").attr("linkname"),prevRowId=parseInt($("#subFormPopUp").attr("prevrowid")),isNew="true"==$("#subFormPopUp").attr("isnew"),thisRowId=parseInt($("#subFormPopUp").attr("thisrowid")),ulElem=$("#sFPopUpElem").children('[elname="subFormFieldsUl"]');if(ZFLive.errorArray=new Array,ZFLive.errCnt=0,emptyErrActionObj(),$(ulElem).find('[elname="sfEntryError"]').hide(),$(ulElem).find('[elname="livefield-elem"]').each(function(index,elem){ZFLive.validateField(elem,!0,!1),checkErrTrackFieldListAndRemoveErrorFromLiElem(elem)}),0==ZFLive.errorArray.length){if(0==uploadObjects.length){var uploadFieldsDiv;if(!isNew)ZFSubFormLive.zfSubFormLive=undefined,uploadFieldsDiv=isNewHtmlDOM()?$("#subFormPopUp").find('div[elname="livefield-elem"][comptype="19"],div[elname="livefield-elem"][comptype="32"],div[elname="livefield-elem"][comptype="35"]'):$("#subFormPopUp").find('li[elname="livefield-elem"][comptype="19"],li[elname="livefield-elem"][comptype="32"],li[elname="livefield-elem"][comptype="35"]'),$(uploadFieldsDiv).each(function(fldIdx,fileLi){$(fileLi).find('ul[elname="fileElementUL"]').find("[name=singleFileElement]").each(function(fileIdx,fileElem){$(fileElem).removeAttr("isnewlyadded"),"true"==$(fileElem).attr("isdelsfpopup")&&$(fileElem).find('a[name="removeFileElement"]').click()});var parentFileDiv=$(fileLi).find('[elname="fileElementUL"]').parent("div");$(parentFileDiv).find("li[name=singleFileElement]").length<=0?$(parentFileDiv).hide():$(parentFileDiv).show()});performSFPopUpClose(ulElem,subFormLinkName,prevRowId,isNew,thisRowId),typeof ZFLive.mode!=ResponseKey.UNDEFINED&&isAdvancedRule()&&(isSubFormRulePresentForThisField(subFormLinkName)||isSubFormPresentInAnyAction(subFormLinkName))&&zf_rule.evalAdvRules(zf_rule.on_form_load_ruleorder,undefined,subFormLinkName,thisRowId)}ZFLive.isAdvAnalyticsEnabled&&ZFAdvAnalytics.zfAdvAnalytics.triggerEventForSubFormPopup(subFormLinkName)}else{var compname=ZFLive.errorArray[0];addEachErrorForAccessibility(ZFLive.errorArray);var parentElem=$("#"+compname+"-li");isOneFieldForm()&&isMobileBrowser()?$(parentElem)[0].scrollIntoView({behavior:"auto",block:"center"}):focusFirstErrorElem($(parentElem)),ZFLive.isSFPopUpEnterTriggered=!1}ZFLive.resetHidingErrorMsg()}}function editSFEntry(elem){var sfCardElem=$(elem).closest('[elname="sfcardelem"]'),rowId=$(sfCardElem).attr("cardrowid"),subFormParentLi=getClosestSubformElemLi(sfCardElem),thisSubFormFldUl=isNewHtmlDOM()?$(subFormParentLi).find('div[elname="subFormFieldsUl"][rowId="'+rowId+'"]'):$(subFormParentLi).find('ul[elname="subFormFieldsUl"][rowId="'+rowId+'"]');if(2==$(subFormParentLi).attr("viewtype")){var previousElem=$(thisSubFormFldUl).prev(),prevRowId=$(previousElem).attr("rowid");showSubFormPop($(thisSubFormFldUl),$(subFormParentLi),rowId,!1,prevRowId,$(sfCardElem)),ZFSubFormLive.zfSubFormLive=new ZFSubFormLive,ZFSubFormLive.zfSubFormLive.constructBackUpDataForPopUp($(thisSubFormFldUl),!1),ZFSubFormLive.zfSubFormLive.isPopUpEdit=!0,isOneFieldForm()||focusFirstField($(thisSubFormFldUl)),triggerFormResize()}}function restoreSFPrevVal(){if(!ZFLive.isSFPopUpEnterTriggered){var subFormLinkName=$("#subFormPopUp").attr("linkname"),prevRowId=parseInt($("#subFormPopUp").attr("prevrowid")),ulElem=isNewHtmlDOM()?$("#subFormPopUp").find('div[elname="subFormFieldsUl"]'):$("#subFormPopUp").find('ul[elname="subFormFieldsUl"]'),sfLi=getFieldElemWithFldLinkNameAttrLivefieldElem(subFormLinkName);if(ZFSubFormLive.zfSubFormLive.setBackedUpValueToFields(sfLi,ulElem,!1),$(ulElem).find('[elname="livefield-elem"]').each(function(index,elem){removeErrorFromLiElem(elem)}),"undefined"!=typeof ZFLive.sfUniqueJson&&!$.isEmptyObject(ZFLive.sfUniqueJson)&&"undefined"!=typeof ZFLive.sfUniqueJson[subFormLinkName]){var thisSfUniqueJson=ZFLive.sfUniqueJson[subFormLinkName],uniqueFields=thisSfUniqueJson.fields;if(uniqueFields.length>0)if(2==thisSfUniqueJson.unique_type)validateSfCombUnique(uniqueFields,getFieldElemWithFldLinkNameLivefieldElemFrmParent(ulElem,uniqueFields[0]),sfLi,!0);else if(1==thisSfUniqueJson.unique_type)for(var i=0;i0){var rowId=$(sfCardElem).attr("cardrowid");$.inArray(rowId,errorRows)>-1&&showCombinedUniqueError($(ulElem),subFormLinkName,$(subFormLi))}}}else{var uniqueFlds=ZFLive.sfUniqueJson[subFormLinkName].fields,thisSfUniqueError=ZFLive.sfUniqueValidator[subFormLinkName];if(void 0!==uniqueFlds&&uniqueFlds.length>0&&void 0!==thisSfUniqueError){subFormLi=getFieldElemWithFldLinkNameAttrLivefieldElem(subFormLinkName);for(var i=0;i0){rowId=$(sfCardElem).attr("cardrowid");if($.inArray(rowId,thisSfUniqueError[fldLinkName])>-1){var errorLi=getFieldElemWithFldLinkNameLivefieldElemFrmParent(ulElem,fldLinkName);showIndUniqueError($(errorLi),subFormLinkName,$(subFormLi))}}}}}triggerFormResize(),isOneFieldForm()&&ZFSlideNav.updateSlideContainerHeight()},1e3)}function constructSFCard(ulElem,subFormLinkName,prevRowId,isNew,lastRowIndex){var sfCardElem,subFormLi=getFieldElem(subFormLinkName);if(isNew){if(hideNoSubFormsRowBtnDiv($(subFormLi)),$(subFormLi).attr("rowIdx",lastRowIndex),sfCardElem=constructNewSFCard($(subFormLi),$(ulElem),$(ulElem).attr("rowId")),"true"==$(subFormLi).attr("show_seq_no")){var previousSfCard=$(subFormLi).find('[elname="sfcardelem"][cardrowid="'+prevRowId+'"]'),entrySeqNo=0;$(previousSfCard).length>0&&(entrySeqNo=parseInt($(previousSfCard).find('div[elname="showSfSeqNo"]').find('span[elname="val"]').text())),$(sfCardElem).find('div[elname="showSfSeqNo"]').find('span[elname="val"]').text(entrySeqNo+1)}}else{var rowId=$(ulElem).attr("rowId");sfCardElem=$(subFormLi).find('[elname="sfcardelem"][cardrowid="'+rowId+'"]'),$(sfCardElem).find('div[elname="sfCardContDiv"]').each(function(idx,cardContDiv){var thisChildLinkName=$(cardContDiv).attr("linkname"),childElem=getFieldElemWithFldLinkNameLivefieldElemFrmParent(ulElem,thisChildLinkName);parseInt($(childElem).attr("comptype"))==ZFFieldTypeConstants.SIGNATURE?constructSignatureFieldpopupview($(cardContDiv).find('[elname="recordVal"]'),childElem):($(cardContDiv).find('[elname="recordVal"]').text(getValueFromLiForSFCard(childElem)),setIsOtherSelectedAttrInCardSummaryForDD(childElem,$(cardContDiv).find('[elname="recordVal"]')))})}var sfCardInnerElem=$(sfCardElem).find('[elname="sfCardInnerElem"]');if(isAccessibilitySupported()){$(sfCardInnerElem).attr("tabindex","0").focus(),$(sfCardInnerElem).attr("role","group"),$(sfCardInnerElem).attr("onfocus","showSubFormPopUpMenu(this,event);"),$(sfCardInnerElem).find("span[elname=sfEditpen]").attr("onfocus","showSubFormPopUpMenu(this,event);"),$(sfCardInnerElem).find("span[elname=sfDuplicateIcn]").attr("onfocus","showSubFormPopUpMenu(this,event);"),$(sfCardInnerElem).find("span[elname=sfTrashicn]").attr("onfocus","showSubFormPopUpMenu(this,event);"),$(sfCardInnerElem).attr("onfocusout","hideSubFormPopUpMenu(this,event);");var compName="";compName=isStandardForm()?$(sfCardInnerElem).closest("div[elname=livefield-elem]").attr("compname"):$(sfCardInnerElem).closest("li[elname=livefield-elem]").attr("compname"),$(sfCardInnerElem).attr("aria-labelledby",compName+"-arialabel hint-"+compName)}return sfCardElem}function constructSubFormCardContent(){var subformFldElems=isNewHtmlDOM()?$('div[elemtype="subFormField"][viewtype="2"]'):$('li[elemtype="subFormField"][viewtype="2"]');$(subformFldElems).each(function(idx1,sfLi){var showSeqNo=$(sfLi).attr("show_seq_no"),subformFldEntryUL=isNewHtmlDOM()?$(sfLi).find('div[elname="subFormFieldsUl"]'):$(sfLi).find('ul[elname="subFormFieldsUl"]');$(subformFldEntryUL).each(function(idx2,entryUL){var sfCardElem=constructNewSFCard($(sfLi),$(entryUL),$(entryUL).attr("rowId"));"true"==showSeqNo&&$(sfCardElem).find('div[elname="showSfSeqNo"]').find('span[elname="val"]').text(idx2+1)})})}function constructNewSFCard(sfLi,entryUL,rowId){var clonedCardElem=$(sfLi).find('[elname="sfcard_cloneElem"]').clone().attr("elname","sfcardelem").attr("cardrowid",$(entryUL).attr("rowId"));return $(clonedCardElem).find('div[elname="sfCardContDiv"]').each(function(idx,cardContDiv){var thisChildLinkName=$(cardContDiv).attr("linkname"),childElem=getFieldElemWithFldLinkNameLivefieldElemFrmParent(entryUL,thisChildLinkName);parseInt($(childElem).attr("comptype"))==ZFFieldTypeConstants.SIGNATURE?constructSignatureFieldpopupview($(cardContDiv).find('[elname="recordVal"]'),childElem):($(cardContDiv).find('[elname="recordVal"]').text(getValueFromLiForSFCard(childElem)),setIsOtherSelectedAttrInCardSummaryForDD(childElem,$(cardContDiv).find('[elname="recordVal"]'))),"true"!=$(childElem).attr("needdata")&&$(cardContDiv).hide()}),$(clonedCardElem).insertBefore($(sfLi).find('[elname="addNewCardElem"]')).show(),triggerFormResize(),$(clonedCardElem)}function getValueFromLiForSFCard(childElem){var id=$(childElem).attr("id"),comptype=parseInt($(childElem).attr("comptype"));if(id){if(comptype==ZFFieldTypeConstants.SINGLE_LINE||comptype==ZFFieldTypeConstants.WEBSITE||comptype==ZFFieldTypeConstants.DATE||comptype==ZFFieldTypeConstants.MONTHYEAR||comptype===ZFFieldTypeConstants.DATETIME||comptype===ZFFieldTypeConstants.EMAIL)return $.trim($(childElem).find("input").val());if(comptype==ZFFieldTypeConstants.CURRENCY){var currencyVal=$.trim($(childElem).find("input").val());if(currencyVal.length>0){var currencySymbol=$(childElem).find('[elname="currencySymbolSpan"]').text(),currencyPosition=$(childElem).attr("currency_position");if("1"==currencyPosition)return currencySymbol+" "+currencyVal;if("2"==currencyPosition)return currencyVal+" "+currencySymbol}return""}if(comptype==ZFFieldTypeConstants.NUMBER||comptype==ZFFieldTypeConstants.DECIMAL){var fieldVal=$.trim($(childElem).find("input").val());if(fieldVal.length>0){var fieldUnit=$(childElem).find('span[elname="field_unit_span"]').text();if(typeof fieldUnit==ResponseKey.UNDEFINED||""==fieldUnit.trim())return fieldVal;if("1"==(unitPosition=$(childElem).attr("unit_position")))return fieldUnit+" "+fieldVal;if("2"==unitPosition)return fieldVal+" "+fieldUnit}return""}if(comptype==ZFFieldTypeConstants.FORMULA){var formulaVal=$.trim($(childElem).find("input").val());if(formulaVal.length>0){var unitPosition,formulaUnit=$(childElem).find('span[elname="formula_unit_span"]').text();if(typeof formulaUnit==ResponseKey.UNDEFINED)return formulaVal;if("1"==(unitPosition=$(childElem).attr("unit_position")))return formulaUnit+" "+formulaVal;if("2"==unitPosition)return formulaVal+" "+formulaUnit}return""}if(comptype==ZFFieldTypeConstants.MULTI_LINE)return $.trim($(childElem).find("TextArea").val().split("\n")[0]);if(comptype==ZFFieldTypeConstants.TIME)return getTimeValueFromElem($(childElem));if(comptype==ZFFieldTypeConstants.NAME||comptype==ZFFieldTypeConstants.ADDRESS){var delimiter,addValString="";return delimiter=comptype==ZFFieldTypeConstants.NAME?ZFLive.nameDelimiter:ZFLive.addrDelimiter,$(childElem).find("input,select").each(function(indexelem,elemnew){var val=$.trim($(elemnew).val());$(elemnew).attr("id")?"-Select-"==val?addValString+="":addValString.length>0?addValString+=delimiter+val:addValString+=val:val.length>0&&(addValString.length>0?addValString+=delimiter+val:addValString+=val)}),"\n"===delimiter?$.trim(addValString.split("\n")[0]):$.trim(addValString)}if(comptype==ZFFieldTypeConstants.PHONE){var phoneval="",linkName=$(childElem).attr("compname");if("INTERNATIONAL"==$(childElem).find('div[elname="phoneFormatElem"]').attr("phoneformat")){if($(childElem).find('[elname="phoneFld"]').find("input").each(function(indexelem,elemnew){var val=$.trim($(elemnew).val());phoneval+=val}),"true"==$(childElem).find("input").attr("iscodeEnabled")){var countryCode="";""!=phoneval&&null!=(countryCode=$(childElem).find("#"+linkName).intlTelInput("getSelectedCountryData").dialCode)&&(phoneval="+"+countryCode+phoneval)}}else{(countryCode=$.trim($(childElem).find('input[elname="countrycode"]').val())).length>0&&(phoneval="("+countryCode+") ");var phoneFirst=$.trim($(childElem).find('input[elname="first"]').val());phoneFirst.length>0&&(phoneval+=phoneFirst);var phoneSecond=$.trim($(childElem).find('input[elname="second"]').val());phoneSecond.length>0&&(phoneval+="-"+phoneSecond)}return phoneval}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.RADIO){choiceVal="";return $(childElem).find("input[type=radio]").each(function(indexelem,elemnew){var val=$(elemnew).parent().find("label").text();$(elemnew).is(":checked")&&(choiceVal=$(elemnew).attr("allowothers")?$(childElem).find("input[name=allow-others-text]").val():val)}),choiceVal}if(comptype==ZFFieldTypeConstants.CHECKBOX){var checkboxJsonArr=[];return $(childElem).find("input[type=checkbox]").each(function(indexelem,elemnew){var val=$(elemnew).parent().find("label").text();$(elemnew).is(":checked")&&($(elemnew).attr("allowothers")?checkboxJsonArr.push($(childElem).find("input[name=allow-others-text]").val()):checkboxJsonArr.push(val))}),checkboxJsonArr.join(", ")}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?val=$(childElem).find("span[elname=True").text():!val&&$(childElem).find("span[elname=False]").text().length>0&&(val=$(childElem).find("span[elname=False]").text()),$.trim(val)}if(comptype==ZFFieldTypeConstants.FILE_UPLOAD||comptype==ZFFieldTypeConstants.IMAGE_UPLOAD||comptype==ZFFieldTypeConstants.MEDIA_UPLOAD){var filepatharr=[];comptype=$(childElem).attr("comptype");return $(childElem).find("ul[elname=fileElementUL]").find("li[elname!=templateFileElement]").each(function(index,elem){var value=$(elem).find('[elname="fileName"]').text()+$(elem).find('[elname="fileExtension"]').text();""!=value&&filepatharr.push(value)}),filepatharr.join(", ")}if(comptype==ZFFieldTypeConstants.RATING){var ratingVal="";return $(childElem).find("div[elname=ratingSubData]").find("a").each(function(indexelem,elemnew){var val=$(elemnew).attr("value");if(val!=undefined)return ratingVal=val,!1}),ratingVal}if(comptype==ZFFieldTypeConstants.SLIDER)return $(childElem).find("div[name=slider]").each(function(index,elemnew){val=$(elemnew).attr("value")}),val}}function setValueForSummary(sfLi,fldLi){var fldLinkName=$(fldLi).attr("linkname"),totalVal=0,sfRows=isStandardForm()?$(sfLi).find('div[elname="subFormFieldsUl"]'):$(sfLi).find('ul[elname="subFormFieldsUl"]');$(sfRows).each(function(index,sfUl){var fldLi=isStandardForm()?$(sfUl).find("div[linkname="+fldLinkName+"]"):$(sfUl).find('li[linkname="'+fldLinkName+'"]'),thisVal=getSummaryValue($(fldLi));null!=thisVal&&""!=thisVal&&thisVal!=undefined&&(totalVal=Number(totalVal)+Number(thisVal))});var comptype=parseInt($(fldLi).attr("comptype"));if(0!=totalVal)if(comptype===ZFFieldTypeConstants.DECIMAL||comptype===ZFFieldTypeConstants.CURRENCY){var decimalFormat=$(fldLi).attr("decimalformat"),decimallength=$(fldLi).attr("decimallength");totalVal=ZFUtil.getFormattedDecimal(totalVal.toFixed(decimallength),decimalFormat)}else if(comptype===ZFFieldTypeConstants.FORMULA){decimalFormat=$(fldLi).attr("decimalformat");typeof(decimallength=$(fldLi).attr("decimallength"))!=ResponseKey.UNDEFINED&&-1!=decimallength||(decimallength=2),totalVal=ZFUtil.getFormattedDecimal(totalVal.toFixed(decimallength),decimalFormat)}isStandardForm()?$(sfLi).find('div[elname="sfSummaryDiv"]').find('div[linkname="sum_'+fldLinkName+'"]').find('span[elname="summary_val"]').text(totalVal):$(sfLi).find('div[elname="sfSummaryDiv"]').find('li[linkname="sum_'+fldLinkName+'"]').find('span[elname="summary_val"]').text(totalVal)}function getSummaryValue(fldLiElem){var val="",comptype=parseInt($(fldLiElem).attr("comptype"));if(comptype===ZFFieldTypeConstants.FORMULA)val=getFormulaValueFromLiElem(fldLiElem);else if(comptype===ZFFieldTypeConstants.CURRENCY||comptype===ZFFieldTypeConstants.DECIMAL){if(validateCurrencyWithFormat(fldLiElem)){var decimalFormat=$(fldLiElem).attr("decimalformat");val=ZFUtil.getReformattedDecimal($.trim($(fldLiElem).find("input").val()),decimalFormat)}}else comptype===ZFFieldTypeConstants.NUMBER?validateNumber(fldLiElem)&&(val=$.trim($(fldLiElem).find("input").val())):comptype===ZFFieldTypeConstants.SLIDER&&(val=$(fldLiElem).find("div[name=slider]").attr("value"));return val}function removeSFCardEntry(elem){var sfCardElem=$(elem).closest('[elname="sfcardelem"]');isAccessibilitySupported()&&(isStandardForm?$(sfCardElem).next("div[elname=addNewCardElem]").focus():$(sfCardElem).closest("div[elname=sfCardWrapperDiv]").find("div[elname=addNewCardElem]").focus());var rowId=$(sfCardElem).attr("cardrowid"),subFormParentLi=getClosestSubformElemLi(sfCardElem),thisSubFormFldUl=isNewHtmlDOM()?$(subFormParentLi).find('div[elname="subFormFieldsUl"][rowId="'+rowId+'"]'):$(subFormParentLi).find('ul[elname="subFormFieldsUl"][rowId="'+rowId+'"]');if(removeUploadedFiles($(thisSubFormFldUl)),removeMapEntry(thisSubFormFldUl),"true"==$(subFormParentLi).attr("show_seq_no")){var entrySeqNo=parseInt($(sfCardElem).find('div[elname="showSfSeqNo"]').find('span[elname="val"]').text());$(sfCardElem).nextAll('[elname="sfcardelem"]').each(function(index,eachSfCardElem){$(eachSfCardElem).find('div[elname="showSfSeqNo"]').find('span[elname="val"]').text(entrySeqNo),entrySeqNo+=1})}$(thisSubFormFldUl).remove(),$(sfCardElem).remove(),removeSubFormEntryCommon(subFormParentLi,rowId),triggerFormResize()}function removeSubFormEntry(elem){var thisSubFormFldUl=isStandardForm()?$(elem).closest('div[elname="subFormFieldsUl"]'):$(elem).closest('ul[elname="subFormFieldsUl"]');removeMapEntry(thisSubFormFldUl);var subFormParentLi=isStandardForm()?$(thisSubFormFldUl).closest("div[elname=livefield-elem]"):$(thisSubFormFldUl).closest("li"),rowId=$(thisSubFormFldUl).attr("rowid");if("true"==$(subFormParentLi).attr("show_seq_no")){var entrySeqNo=parseInt($(thisSubFormFldUl).find('div[elname="showSfSeqNo"]').find('span[elname="val"]').text()),sfFlds=isStandardForm()?$(thisSubFormFldUl).nextAll('div[elname="subFormFieldsUl"]'):$(thisSubFormFldUl).nextAll('ul[elname="subFormFieldsUl"]');$(sfFlds).each(function(index,sfFld){$(sfFld).find('div[elname="showSfSeqNo"]').find('span[elname="val"]').text(entrySeqNo),entrySeqNo+=1})}if(isAccessibilitySupported()){var focusableElem=isStandardForm()?$(thisSubFormFldUl).next("div[elname=subFormFieldsUl]"):$(thisSubFormFldUl).next("ul[elname=subFormFieldsUl]");0===focusableElem.length&&(focusableElem=isStandardForm()?$(thisSubFormFldUl).prev("div[elname=subFormFieldsUl]"):$(thisSubFormFldUl).prev("ul[elname=subFormFieldsUl]"))}$(thisSubFormFldUl).remove();var sfParents=isStandardForm()?$(subFormParentLi).find('div[elname="subFormFieldsUl"]'):subFormParentLi.find('ul[elname="subFormFieldsUl"]');if(0==$(sfParents).length){showNoSubFormsRowBtnDiv($(subFormParentLi));var sfSummaryDiv=$(subFormParentLi).find('[elname="sfSummaryDiv"]');$(sfSummaryDiv).length>0&&$(sfSummaryDiv).hide()}else isAccessibilitySupported()&&focusFirstField($(focusableElem));resetSFSummary($(subFormParentLi)),removeSubFormEntryCommon(subFormParentLi,rowId),triggerFormResize()}function resetSFSummary(sfLi){if("true"==$(sfLi).attr("show_summary")){var sfChildElems=isStandardForm()?$(sfLi).find('div[elname="subFormFieldsCloneUl"]').find('div[elname="livefield-elem"][summary_type="1"]'):$(sfLi).find('ul[elname="subFormFieldsCloneUl"]').find('li[elname="livefield-elem"][summary_type="1"]');$(sfChildElems).each(function(idx1,sfChildLi){var comptype=parseInt($(sfChildLi).attr("comptype"));comptype!==ZFFieldTypeConstants.NUMBER&&comptype!==ZFFieldTypeConstants.DECIMAL&&comptype!==ZFFieldTypeConstants.CURRENCY&&comptype!==ZFFieldTypeConstants.FORMULA&&comptype!==ZFFieldTypeConstants.SLIDER||setValueForSummary($(sfLi),$(sfChildLi))})}}function removeMapEntry(subFormFldUl){var livefieldElems=isNewHtmlDOM()?$(subFormFldUl).find('div[elname="livefield-elem"]'):$(subFormFldUl).find('li[elname="livefield-elem"]');$(livefieldElems).each(function(idx,li){var compType=parseInt($(li).attr("comptype"));if($(li).attr("linkname")&&compType==ZFFieldTypeConstants.ADDRESS){var compName=$(li).attr("compname");ZFLive.mapPlacesJson.hasOwnProperty(compName)&&delete ZFLive.mapPlacesJson[compName]}})}function removeSubFormEntryCommon(subFormParentLi,rowId){removeUniqueErrorOnDel(subFormParentLi,rowId);var sfParentCloneLiIter=isNewHtmlDOM()?$(subFormParentLi).find('div[elname="subFormFieldsCloneUl"]').find('div[elname="livefield-elem"]'):$(subFormParentLi).find('ul[elname="subFormFieldsCloneUl"]').find('li[elname="livefield-elem"]');null!=ZFLive.formulaFieldsList&&(typeof ZFLive.mode!=ResponseKey.UNDEFINED&&isAdvancedRule()?$(sfParentCloneLiIter).each(function(idx,li){var compType=parseInt($(li).attr("comptype"));if($(li).attr("linkname")&&(compType==ZFFieldTypeConstants.NUMBER||compType==ZFFieldTypeConstants.CURRENCY||compType==ZFFieldTypeConstants.DECIMAL||compType==ZFFieldTypeConstants.RATING||compType==ZFFieldTypeConstants.RADIO||compType==ZFFieldTypeConstants.CHECKBOX||compType==ZFFieldTypeConstants.DROPDOWN||compType==ZFFieldTypeConstants.MULTIPLE_CHOICE||compType==ZFFieldTypeConstants.SLIDER||compType==ZFFieldTypeConstants.FORMULA)){var fieldsArr=JSON.parse(ZFLive.formulaFieldsList),linkName=$(li).attr("linkname");if(compType==ZFFieldTypeConstants.FORMULA||linkName&&-1!=$.inArray(linkName,fieldsArr))return zf_rule.evalAdvRulesOnFieldStateChange(zf_rule.on_form_load_ruleorder,li),isOneFieldForm()&&updateSlides(),!1}}):$(sfParentCloneLiIter).each(function(idx,li){var compType=parseInt($(li).attr("comptype"));if($(li).attr("linkname")&&(compType==ZFFieldTypeConstants.NUMBER||compType==ZFFieldTypeConstants.CURRENCY||compType==ZFFieldTypeConstants.DECIMAL||compType==ZFFieldTypeConstants.RATING||compType==ZFFieldTypeConstants.RADIO||compType==ZFFieldTypeConstants.CHECKBOX||compType==ZFFieldTypeConstants.DROPDOWN||compType==ZFFieldTypeConstants.MULTIPLE_CHOICE||compType==ZFFieldTypeConstants.SLIDER||compType==ZFFieldTypeConstants.FORMULA))for(var fieldsArr=JSON.parse(ZFLive.formulaFieldsList),fldInd=0;fldIndscrollParent.scrollTop+viewportHeight){scrollRowIntoView=!0;var rowHeight=$(myClonedChildUl).outerHeight(!0);scrollToHeight-=Math.min(rowHeight+50,viewportHeight/2)}scrollRowIntoView?$(ZFPageAnimation.scrollWindow).animate({scrollTop:scrollToHeight},1e3,function(){focusFirstField($(myClonedChildUl))}):focusFirstField($(myClonedChildUl))}else{var subFormFirstChild=$(myClonedChildUl).find("li[elname=livefield-elem]:visible:first"),subFormFirstChildBottom=$(subFormFirstChild).offset().top+$(subFormFirstChild).outerHeight(),subFormEntryBottom=$(myClonedChildUl).offset().top+$(myClonedChildUl).outerHeight(),viewportTop=$(window).scrollTop(),viewportBottom=viewportTop+$(window).height(),viewPortCenter=(viewportBottom-viewportTop)/2;subFormFirstChildBottom>viewportBottom-50||subFormFirstChildBottom>viewportTop+viewPortCenter&&subFormEntryBottom>viewportBottom?$("html, body").animate({scrollTop:viewportTop+viewPortCenter},1e3,function(){focusFirstField($(myClonedChildUl))}):focusFirstField($(myClonedChildUl))}}function modifyClonedSubFormEntryPropPostAction(myClonedChildUl,rowId,subFormParentLi){var needToExecuteAdvRules=!0;if(null!=ZFLive.formulaFieldsList)if(typeof ZFLive.mode!=ResponseKey.UNDEFINED&&isAdvancedRule()){var formulaFldArr=JSON.parse(ZFLive.formulaFieldsList);myClonedChildUl.find('[elname="livefield-elem"]').each(function(idx,li){var compType=parseInt($(li).attr("comptype"));if($(li).attr("linkname")&&(compType==ZFFieldTypeConstants.NUMBER||compType==ZFFieldTypeConstants.CURRENCY||compType==ZFFieldTypeConstants.DECIMAL||compType==ZFFieldTypeConstants.RATING||compType==ZFFieldTypeConstants.RADIO||compType==ZFFieldTypeConstants.CHECKBOX||compType==ZFFieldTypeConstants.DROPDOWN||compType==ZFFieldTypeConstants.MULTIPLE_CHOICE||compType==ZFFieldTypeConstants.SLIDER||compType==ZFFieldTypeConstants.FORMULA)){var linkName=$(li).attr("linkname");if(compType==ZFFieldTypeConstants.FORMULA||-1!=$.inArray(linkName,formulaFldArr))return needToExecuteAdvRules=!1,zf_rule.evalAdvRulesOnFieldStateChange(zf_rule.on_form_load_ruleorder,li),isOneFieldForm()&&updateSlides(),!1}})}else{formulaFldArr=JSON.parse(ZFLive.formulaFieldsList);var formulaJsonArr=JSON.parse(ZFLive.formulaJson);myClonedChildUl.find('[elname="livefield-elem"]').each(function(idx,li){var linkName=$(li).attr("linkname"),compType=getFormFieldType(linkName);if(compType==ZFFieldTypeConstants.FORMULA){for(var formulaInd=0;formulaInd0&&!isDuplicate&&ZFLive.getStatesListForAddrStateDd(countriesToGetStatesList,isOneFieldform)}function setLiPropInSubFormForInputTextAndError(li,rowId,fldActualLinkName){$(li).find("input").attr("name",fldActualLinkName+"_"+rowId),isOneFieldForm()||($(li).find("input").attr("id",fldActualLinkName+"_"+rowId+"-arialabel"),$(li).find("label").attr("for",fldActualLinkName+"_"+rowId+"-arialabel"));var errorElem=isNewHtmlDOM()?$(li).find('div[elname="error"]'):$(li).find('p[elname="error"]');$(errorElem).attr("id","error-"+fldActualLinkName+"_"+rowId)}function setLiPropInSubFormForNumberElemReconfirm(li,rowId,fldActualLinkName){var needReconf=$(li).attr("need_reconf");if(typeof needReconf!=ResponseKey.UNDEFINED&&"true"==needReconf){var numReconfSpan=$(li).find("span[elname=livefield-reconf-elem]");isNewHtmlDOM()||4!=$(li).attr("comptype")||(numReconfSpan=$(li).find("div[elname=livefield-reconf-elem]")),$(numReconfSpan).find("input").attr("name",fldActualLinkName+"_"+rowId+"-reconf"),isStandardForm()&&$(numReconfSpan).find("input").attr("aria-describedby","error-"+fldActualLinkName+"_"+rowId+"-reconf");var reconfErrElem=isNewHtmlDOM()?$(numReconfSpan).closest("div[elname=livefield-elem]").find('div[elname="reconf-error"]'):$(numReconfSpan).find('p[elname="reconf-error"]');$(reconfErrElem).attr("id","error-"+fldActualLinkName+"_"+rowId+"-reconf"),$(numReconfSpan).find("input").on("cut copy paste",function(e){e.preventDefault()})}}function setLiPropInSubFormForEmailElem(li,rowId,fldActualLinkName){var emailSpan=$(li).find("span[elname=livefield-email-elem]");if($(emailSpan).find("input").attr("name",fldActualLinkName+"_"+rowId),!isOneFieldForm()){var labelElem=isStandardForm()?$(li).find("label.fieldlabel"):$(li).find("label.labelName");$(labelElem).attr("for",fldActualLinkName+"_"+rowId+"-arialabel"),$(emailSpan).find("input").attr("id",fldActualLinkName+"_"+rowId+"-arialabel")}var errorElem=isNewHtmlDOM()?$(li).find('div[elname="error"]'):$(li).find('p[elname="error"]');$(errorElem).attr("id","error-"+fldActualLinkName+"_"+rowId);var needReconf=$(li).attr("need_reconf");if(typeof needReconf!=ResponseKey.UNDEFINED&&"true"==needReconf){var emailReconfSpan=$(li).find("span[elname=livefield-reconf-elem]");$(emailReconfSpan).find("input").attr("name",fldActualLinkName+"_"+rowId+"-reconf"),isStandardForm()&&$(emailReconfSpan).find("input").attr("aria-describedby","error-"+fldActualLinkName+"_"+rowId+"-reconf");var reconfErrElem=isNewHtmlDOM()?$(emailReconfSpan).closest("div[elname=livefield-elem]").find('div[elname="reconf-error"]'):$(emailReconfSpan).find('p[elname="reconf-error"]');$(reconfErrElem).attr("id","error-"+fldActualLinkName+"_"+rowId+"-reconf"),$(emailReconfSpan).find("input").on("cut copy paste",function(e){e.preventDefault()})}}function setLiPropInSubFormForFormula(li,rowId,fldActualLinkName){$(li).find("input").attr("name",fldActualLinkName+"_"+rowId)}function setLiPropInSubFormForSignature(li,rowId,fldActualLinkName){var signContainerdiv=$(li).find('div[elname="signContainer"]');$(li).find('div[elname="signContainer"]').attr("id","signContainer-"+fldActualLinkName+"_"+rowId);var canvasElem=$(signContainerdiv).find("canvas");$(canvasElem).attr("id","drawingCanvas-"+fldActualLinkName+"_"+rowId),$(signContainerdiv).find("a[elname=clearSign]").attr("onClick","clearSignature('drawingCanvas-"+fldActualLinkName+"_"+rowId+"')"),$(signContainerdiv).find("div[elname=signArea]").attr("id","sign-area-"+fldActualLinkName+"_"+rowId);var editsignContainer=$(li).find('div[elname="singaturEditDiv"]');if($(editsignContainer).attr("id","editsignContainer-"+fldActualLinkName+"_"+rowId),$(editsignContainer).find("img").attr("id","img-"+fldActualLinkName+"_"+rowId),$(editsignContainer).find("span").attr("onClick","editSignature('editsignContainer-"+fldActualLinkName+"_"+rowId+"', 'signContainer-"+fldActualLinkName+"_"+rowId+"')"),isOneFieldForm())$(li).find("div[elname=error]").attr("id","error-"+fldActualLinkName+"_"+rowId),bindSignatueEventsAndFunctionOneFieldSubform(fldActualLinkName+"_"+rowId);else{var errorElem=isStandardForm()?$(li).find("div[elname=error]"):$(li).find("p[elname=error]");$(errorElem).attr("id","error-"+fldActualLinkName+"_"+rowId),bindSignatueEventsAndFunction(fldActualLinkName+"_"+rowId);var labelElem=isStandardForm()?$(li).find("label.fieldlabel"):$(li).find("label.labelName");$(labelElem).attr("id",fldActualLinkName+"_"+rowId+"-arialabel"),$(canvasElem).closest("div[elname=signContainer]").find("span[elname=eSignatureSpan]").attr("id",fldActualLinkName+"_"+rowId+"-esign"),$(canvasElem).attr("aria-labelledby",fldActualLinkName+"_"+rowId+"-arialabel "+fldActualLinkName+"_"+rowId+"-esign"),$(editsignContainer).find("img").attr("aria-labelledby",fldActualLinkName+"_"+rowId+"-arialabel "+fldActualLinkName+"_"+rowId+"-esign")}}function bindSignatueEventsAndFunction(linkName){isStandardForm()?setCanvasElemWidthAndHeight(linkName):setCanvasElemWidth(linkName),$("#drawingCanvas-"+linkName).mousedown(function(event){var canvasElem=document.getElementById("drawingCanvas-"+linkName),signatureFieldParent=$(canvasElem).attr("signaturefieldparent"),fontColor="#000000",inputElem="";if(isStandardForm()){var valueTxtClr=$(":root").css("--value-txt-clr");(valueTxtClr!=ResponseKey.UNDEFINED||valueTxtClr.length>0)&&(fontColor="rgb("+valueTxtClr+")")}else{if("subform"==signatureFieldParent){var sfElem=$("#formBodyDiv").find(".formFieldWrapper li[elemType=subFormField][viewtype=1]");inputElem=$(sfElem).find("input[type=text], input[type=number], textarea").filter(":first")}else{var fldElem=$("#formBodyDiv").find(".formFieldWrapper > .tempFrmWrapper > .tempContDiv");inputElem=$(fldElem).find("input[type=text], input[type=number], textarea").filter(":first")}""!=inputElem&&inputElem.length>0&&(fontColor=inputElem.css("color"))}var signFldDiv,context=canvasElem.getContext("2d");signFldDiv=isStandardForm()?$(canvasElem).closest("div[elname=livefield-elem][fldtype="+ZFFieldTypeConstants.SIGNATURE+"]"):$(canvasElem).closest("li[elname=livefield-elem][comptype="+ZFFieldTypeConstants.SIGNATURE+"]");var position=getXYCoords(event,canvasElem,!1);context.moveTo(position.X,position.Y),context.beginPath(),$(this).mousemove(function(event){bindSignatureOnSignEvent(signFldDiv),startScribbling(event,canvasElem,context,!1,fontColor)}).mouseup(function(event){endScribbling(event,canvasElem,context,fontColor),removeErrorFromLiElem(getClosestFieldElemLi(canvasElem))}).mouseout(function(event){endScribbling(event,canvasElem,context,fontColor),removeErrorFromLiElem(getClosestFieldElemLi(canvasElem))}),this.addEventListener("touchstart",function(event){position=getXYCoords(event,canvasElem,!0),context.moveTo(position.X,position.Y),context.beginPath(),event.preventDefault()},!1),this.addEventListener("touchmove",function(event){bindSignatureOnSignEvent(signFldDiv),startScribbling(event,canvasElem,context,!0,fontColor),event.preventDefault()},!1)}),window.navigator.userAgent.indexOf("MSIE ")>0&&$("#drawingCanvas-"+linkName).keypress(function(event){13===event.keyCode&&event.preventDefault()}),(isStandardForm()?$("#"+linkName+"-li").hasClass("fieldDisabled"):$("#"+linkName+"-li").attr("isDisable"))&&($("#drawingCanvas-"+linkName).css("pointer-events","none"),$("#drawingCanvas-"+linkName).css("cursor","default"))}function bindSignatueEventsAndFunctionOneFieldSubform(linkName){setCanvasElemWidthAndHeight(linkName);var signCanvas=$("#drawingCanvas-"+linkName);if($(signCanvas).closest("div[elname=livefield-elem]").hasClass("fieldDisabled"))$(signCanvas).css("pointer-events","none"),$(signCanvas).css("cursor","default");else{var canvasElem=document.getElementById("drawingCanvas-"+linkName),fontColor=($(canvasElem).attr("signaturefieldparent"),"#000000"),oneFldTxtClr=$(":root").css("--value-txt-clr");(oneFldTxtClr!=ResponseKey.UNDEFINED||oneFldTxtClr.length>0)&&(fontColor=oneFldTxtClr);var context=canvasElem.getContext("2d"),signFldDiv=$(signCanvas).closest("div[elname=livefield-elem][fldtype="+ZFFieldTypeConstants.SIGNATURE+"]");$(signCanvas).mousedown(function(event){var position=getXYCoords(event,canvasElem,!1);context.moveTo(position.X,position.Y),context.beginPath(),$(this).mousemove(function(event){bindSignatureOnSignEvent(signFldDiv),startScribbling(event,canvasElem,context,!1,fontColor)}).mouseup(function(event){endScribbling(event,canvasElem,context,fontColor),removeErrorFromLiElem(getClosestFieldElemLi(canvasElem))}).mouseout(function(event){endScribbling(event,canvasElem,context,fontColor),removeErrorFromLiElem(getClosestFieldElemLi(canvasElem))})}),canvasElem.addEventListener("touchstart",function(event){var position=getXYCoords(event,canvasElem,!1);context.moveTo(position.X,position.Y),context.beginPath()},!1),canvasElem.addEventListener("touchmove",function(event){bindSignatureOnSignEvent(signFldDiv),startScribbling(event,canvasElem,context,!0,fontColor),event.preventDefault()},!1),canvasElem.addEventListener("touchend",function(event){endScribbling(event,canvasElem,context,fontColor),removeErrorFromLiElem(getClosestFieldElemLi(canvasElem))},!1)}window.navigator.userAgent.indexOf("MSIE ")>0&&$(signCanvas).keypress(function(event){13===event.keyCode&&event.preventDefault()})}function setAccessibilityValues(li,fldActualLinkName,rowId){if(!isOneFieldForm()){$(li).attr("aria-labelledby",fldActualLinkName+"_"+rowId+"-arialabel");var labelElem=isStandardForm()?$(li).find("label.fieldlabel"):$(li).find("label.labelName");$(labelElem).attr("id",fldActualLinkName+"_"+rowId+"-arialabel");var otherInput=$(li).find('input[name="allow-others-text"]');$(otherInput).closest("span[elname=allow-others-span]").find("em[elname=cusChoiceEm]").attr("id",fldActualLinkName+"_"+rowId+"_others-text"),$(otherInput).attr("aria-labelledby",fldActualLinkName+"_"+rowId+"-arialabel "+fldActualLinkName+"_"+rowId+"_others-text")}}function setLiPropInSubFormFoRadioAndError(li,rowId,fldActualLinkName){$(li).find('input[type="radio"]').each(function(inputIdx,inputTag){$(inputTag).attr("name",fldActualLinkName+"_"+rowId),"radio-input"!==$(inputTag).attr("elname")&&$(inputTag).attr("elname",fldActualLinkName+"_"+rowId);var thisRadioId=$(inputTag).attr("id"),thisRadioNumIndex=thisRadioId.lastIndexOf("_"),thisRadioNum=thisRadioId.substr(thisRadioNumIndex+1);$(inputTag).attr("id",fldActualLinkName+"_"+rowId+"_"+thisRadioNum);var thisRadioLabel=$(inputTag).closest("span").find("label");$(thisRadioLabel).attr("for",fldActualLinkName+"_"+rowId+"_"+thisRadioNum)}),setAccessibilityValues(li,fldActualLinkName,rowId);var errorElem=isNewHtmlDOM()?$(li).find('div[elname="error"]'):$(li).find('p[elname="error"]');$(errorElem).attr("id","error-"+fldActualLinkName+"_"+rowId)}function setNameChangeLiPropInSubFormFoRadio(li,rowId,fldActualLinkName){$(li).find('input[type="radio"]').each(function(inputIdx,inputTag){$(inputTag).attr("name",fldActualLinkName+"_"+rowId)})}function setLiPropInSubFormForCheckBoxAndError(li,rowId,fldActualLinkName){$(li).find("input[type='checkbox']").each(function(inputIdx,inputTag){$(inputTag).attr("name",fldActualLinkName+"_"+rowId),"checkbox-input"!==$(inputTag).attr("elname")&&$(inputTag).attr("elname",fldActualLinkName+"_"+rowId);var thisRadioId=$(inputTag).attr("id"),thisRadioNumIndex=thisRadioId.lastIndexOf("_"),thisRadioNum=thisRadioId.substr(thisRadioNumIndex+1);$(inputTag).attr("id",fldActualLinkName+"_"+rowId+"_"+thisRadioNum);var thisRadioLabel=$(inputTag).closest("span").find("label");$(thisRadioLabel).attr("for",fldActualLinkName+"_"+rowId+"_"+thisRadioNum)}),setAccessibilityValues(li,fldActualLinkName,rowId);var errorElem=isNewHtmlDOM()?$(li).find('div[elname="error"]'):$(li).find('p[elname="error"]');$(errorElem).attr("id","error-"+fldActualLinkName+"_"+rowId)}function setLiPropForSubFormForDecision(li,rowId,fldActualLinkName){$(li).find("input").attr("id",fldActualLinkName+"_"+rowId).attr("name",fldActualLinkName+"_"+rowId),$(li).find("label").attr("for",fldActualLinkName+"_"+rowId),isOneFieldForm()||($(li).find("[elname=labelNameSrOnly]").attr("id","labelName-"+fldActualLinkName+"_"+rowId),$(li).find("input").attr("aria-labelledby","labelName-"+fldActualLinkName+"_"+rowId));var errorElem=isNewHtmlDOM()?$(li).find('div[elname="error"]'):$(li).find('p[elname="error"]');$(errorElem).attr("id","error-"+fldActualLinkName+"_"+rowId)}function setLiPropInSubFormForSelectAndError(li,rowId,fldActualLinkName){if($(li).find('select[name="'+fldActualLinkName+'_0"]').attr("name",fldActualLinkName+"_"+rowId),!isOneFieldForm()){var selectElem=$(li).find('select[id="'+fldActualLinkName+'_0-arialabel"]'),select2FormCont=$(selectElem).parent().find(".select2FormCont");$(select2FormCont).attr("aria-labelledby",fldActualLinkName+"_"+rowId+"-arialabel-cont "+$(select2FormCont).find(".select2-selection__rendered").attr("id")),$(selectElem).attr("id",fldActualLinkName+"_"+rowId+"-arialabel"),$(li).find("input[name=allow-others-text]").attr("aria-describedby",fldActualLinkName+"_"+rowId+"-arialabel-cont");var labelElem=isStandardForm()?$(li).find("label.fieldlabel"):$(li).find("label.labelName");$(labelElem).attr("for",fldActualLinkName+"_"+rowId+"-arialabel"),$(labelElem).attr("id",fldActualLinkName+"_"+rowId+"-arialabel-cont")}var errorElem=isNewHtmlDOM()?$(li).find('div[elname="error"]'):$(li).find('p[elname="error"]');$(errorElem).attr("id","error-"+fldActualLinkName+"_"+rowId),$(li).find('select[name="'+fldActualLinkName+'_0-temp-select"]').attr("name",fldActualLinkName+"_"+rowId+"-temp-select")}function setLiPropInSubFormForMultipleChoiceAndError(li,rowId,fldActualLinkName){if(!isOneFieldForm()){$(li).attr("aria-labelledby",fldActualLinkName+"_"+rowId+"-arialabel");var labelElem=isStandardForm()?$(li).find("label.fieldlabel"):$(li).find("label.labelName");$(labelElem).attr("id",fldActualLinkName+"_"+rowId+"-arialabel"),$(li).find("[elemname=fieldContentDiv]").attr("aria-labelledby",fldActualLinkName+"_"+rowId+"-arialabel"),isStandardForm()&&$(li).find("input").attr({"aria-labelledby":fldActualLinkName+"_"+rowId+"-arialabel","aria-describedby":"error-"+fldActualLinkName+"_"+rowId})}$(li).find("select").attr("name",fldActualLinkName+"_"+rowId).attr("id",fldActualLinkName+"_"+rowId+"-multiple-id"),$(li).find("div[elname=liveFieldTempChoiceCont]").find("select").attr("name",fldActualLinkName+"_"+rowId+"-temp-select").removeAttr("id");var errorElem=isNewHtmlDOM()?$(li).find('div[elname="error"]'):$(li).find('p[elname="error"]');$(errorElem).attr("id","error-"+fldActualLinkName+"_"+rowId)}function setLiPropInSubFormForErrorElem(li,rowId,fldActualLinkName){if(!isOneFieldForm()){var compType=$(li).attr("comptype");7!=compType&&8!=compType||$(li).find("input[aria-labelledby], select[aria-labelledby]").each(function(idx,elem){var select2FormCont=$(elem).parent().find(".select2FormCont"),selectionRenderedId=$(select2FormCont).find(".select2-selection__rendered").attr("id"),attrStr="";"true"==$(elem).attr("mandatory")?($(elem).closest("span[elname=compEachElem]").find("span[elname=ariaReqSpan]").attr("id","ariarequired-"+fldActualLinkName+"_"+rowId+idx),attrStr=fldActualLinkName+"_"+rowId+"-arialabel aria-showelemslabel-"+fldActualLinkName+"_"+rowId+idx+" ariarequired-"+fldActualLinkName+"_"+rowId+idx+" "+selectionRenderedId,isStandardForm()&&($(elem).closest("span[elname=compEachElem]").prev("span[elname=ariaReqSpan]").attr("id","ariarequired-"+fldActualLinkName+"_"+rowId+idx),$(elem).closest("div[elname=eachCompElem]").prev("span[elname=ariaReqSpan]").attr("id","ariarequired-"+fldActualLinkName+"_"+rowId+idx))):attrStr=fldActualLinkName+"_"+rowId+"-arialabel aria-showelemslabel-"+fldActualLinkName+"_"+rowId+idx+" "+selectionRenderedId,$(elem).attr({"aria-labelledby":attrStr,name:fldActualLinkName+"_"+rowId}),$(select2FormCont).attr({"aria-labelledby":attrStr,name:fldActualLinkName+"_"+rowId}),$(elem).closest("span[elname=compEachElem]").find("label[elname=formSubInfoText]").attr("id","aria-showelemslabel-"+fldActualLinkName+"_"+rowId+idx),isStandardForm()&&0==$(select2FormCont).length&&$(elem).closest("div[elname=eachCompElem]").find("label[elname=formSubInfoText]").attr("id","aria-showelemslabel-"+fldActualLinkName+"_"+rowId+idx)}),6==compType&&($(li).find("select[aria-labelledby]").attr("name",fldActualLinkName+"_"+rowId),$(li).find("select[aria-labelledby]").each(function(idx,elem){var fieldContentDiv=$(elem).closest("span[elname=compEachElem]"),select2FormCont=$(elem).parent().find(".select2FormCont"),selectionRenderedId=$(select2FormCont).find(".select2-selection__rendered").attr("id"),attrStr="";"hours"==$(elem).attr("timecomp")&&($(fieldContentDiv).find("label[elname=formSubInfoText]").attr("id",fldActualLinkName+"_"+rowId+"-arialabel-hours"),attrStr=fldActualLinkName+"_"+rowId+"-arialabel "+fldActualLinkName+"_"+rowId+"-arialabel-hours "+selectionRenderedId),"minutes"==$(elem).attr("timecomp")&&($(fieldContentDiv).find("label[elname=formSubInfoText]").attr("id",fldActualLinkName+"_"+rowId+"-arialabel-minutes"),attrStr=fldActualLinkName+"_"+rowId+"-arialabel "+fldActualLinkName+"_"+rowId+"-arialabel-minutes "+selectionRenderedId),"Meridiem"==$(elem).attr("timecomp")&&($(fieldContentDiv).find("label[elname=formSubInfoText]").attr("id",fldActualLinkName+"_"+rowId+"-arialabel-Meridiem"),attrStr=fldActualLinkName+"_"+rowId+"-arialabel "+fldActualLinkName+"_"+rowId+"-arialabel-Meridiem "+selectionRenderedId),$(elem).attr("aria-labelledby",attrStr),$(select2FormCont).attr("aria-labelledby",attrStr)}));var labelElem=isStandardForm()?$(li).find("label.fieldlabel"):$(li).find("label.labelName");$(labelElem).attr("id",fldActualLinkName+"_"+rowId+"-arialabel")}var errorElem=isNewHtmlDOM()?$(li).find('div[elname="error"]'):$(li).find('p[elname="error"]');$(errorElem).attr("id","error-"+fldActualLinkName+"_"+rowId)}function setLiPropInSubFormForPhoneElem(li,rowId,fldActualLinkName,subFormParentLi){var keyid=$(li).attr("compname");if(!isOneFieldForm()){var labelElem=isStandardForm()?$(li).find("label.fieldlabel"):$(li).find("label.labelName");$(labelElem).attr("id",fldActualLinkName+"_"+rowId+"-arialabel"),$(li).find("input[aria-labelledby]").attr("aria-labelledby",fldActualLinkName+"_"+rowId+"-arialabel")}var errorElem=isNewHtmlDOM()?$(li).find('div[elname="error"]'):$(li).find('p[elname="error"]');$(errorElem).attr("id","error-"+fldActualLinkName+"_"+rowId);var reconfErrElem=isNewHtmlDOM()?$(li).find('div[elname="reconf-error"]'):$(li).find('p[elname="reconf-error"]');$(reconfErrElem).attr("id","error-"+fldActualLinkName+"_"+rowId+"-reconf");var subformCloneParentUL=isNewHtmlDOM()?subFormParentLi.find("div[elname=subFormFieldsCloneUl]"):subFormParentLi.find("ul[elname=subFormFieldsCloneUl]"),childPhoneLi=getFieldElemWithFldLinkNameLivefieldElemFrmParent(subformCloneParentUL,fldActualLinkName),subformFldParentInp=$(childPhoneLi).find('div[elname="phoneFld"]').find('input[elname="countrycode"]'),isCodeEnabled=$(subformFldParentInp).attr("iscodeEnabled"),phoneFormat=$(li).find('div[elname="phoneFormatElem"]').attr("phoneformat");"INTERNATIONAL"==phoneFormat?$(li).find("input").attr("id",fldActualLinkName+"_"+rowId):isOneFieldForm()||"USA-FORMAT"!=phoneFormat||($(li).find("[elname=phoneFld] input").each(function(idx,elem){var phoneFldElem=$(elem).closest("span[elname=compEachElem]");"countrycode"==$(elem).attr("elname")&&($(phoneFldElem).find("label[elname=formSubInfoText]").attr("id",fldActualLinkName+"_"+rowId+"-countrycode"),$(elem).attr({"aria-labelledby":fldActualLinkName+"_"+rowId+"-arialabel "+fldActualLinkName+"_"+rowId+"-countrycode"})),"first"==$(elem).attr("elname")&&($(phoneFldElem).find("label[elname=formSubInfoText]").attr("id",fldActualLinkName+"_"+rowId+"-first"),$(elem).attr({"aria-labelledby":fldActualLinkName+"_"+rowId+"-arialabel "+fldActualLinkName+"_"+rowId+"-first"})),"second"==$(elem).attr("elname")&&($(phoneFldElem).find("label[elname=formSubInfoText]").attr("id",fldActualLinkName+"_"+rowId+"-second"),$(elem).attr({"aria-labelledby":fldActualLinkName+"_"+rowId+"-arialabel "+fldActualLinkName+"_"+rowId+"-second"}))}),$(li).find("[elname=confPhoneFld] input").each(function(idx,elem){var phoneFldElem=$(elem).closest("span[elname=compEachElem]");"countrycode"==$(elem).attr("elname")&&($(phoneFldElem).find("label[elname=formSubInfoText]").attr("id",fldActualLinkName+"_"+rowId+"-countrycode-reconf"),$(elem).attr("aria-labelledby",fldActualLinkName+"_"+rowId+"-arialabel "+fldActualLinkName+"_"+rowId+"-countrycode-reconf")),"first"==$(elem).attr("elname")&&($(phoneFldElem).find("label[elname=formSubInfoText]").attr("id",fldActualLinkName+"_"+rowId+"-first-reconf"),$(elem).attr("aria-labelledby",fldActualLinkName+"_"+rowId+"-arialabel "+fldActualLinkName+"_"+rowId+"-first-reconf")),"second"==$(elem).attr("elname")&&($(phoneFldElem).find("label[elname=formSubInfoText]").attr("id",fldActualLinkName+"_"+rowId+"-second-reconf"),$(elem).attr("aria-labelledby",fldActualLinkName+"_"+rowId+"-arialabel "+fldActualLinkName+"_"+rowId+"-second-reconf"))}));var needConf=$(li).attr("need_reconf"),phoneInpConf=$(li).find('input[elname="countrycodeConf"]'),phoneInpConfrimation=$(li).find('div[elname="confPhoneFld"]').find("input");if("true"==needConf&&(isStandardForm()&&$(phoneInpConf).attr("aria-describedby","error-"+fldActualLinkName+"_"+rowId+"-reconf"),0!=$(phoneInpConfrimation).length&&$(phoneInpConfrimation).on("cut copy paste",function(e){e.preventDefault()})),"true"==isCodeEnabled){var phoneInp=$(li).find('input[elname="countrycode"]'),initVal=phoneInp.val();ZFPhone.countryCodeProps.initialCountry=$(subformFldParentInp).attr("initCountry");var listOfcountries=$(subformFldParentInp).attr("countrylist"),countryCodeProps=jQuery.extend(!0,{},ZFPhone.countryCodeProps),isRtlEnabled=!1;isNewHtmlDOM()?"2"===ZFLive.txtDirection&&(isRtlEnabled=!0):$("body").hasClass("rtlWrapper")&&(isRtlEnabled=!0),countryCodeProps.isRtl=isRtlEnabled,""!=listOfcountries.length&&(countryCodeProps.onlyCountries=listOfcountries.split(",")),phoneInp.attr("id",keyid),setcounytryCodeDetails(phoneInp,countryCodeProps,isRtlEnabled),null!=initVal&&""!=initVal&&phoneInp.intlTelInput("setNumber",$(phoneInp).val()),"true"==needConf&&(phoneInpConf.attr("id",keyid+"-reconf"),phoneInpConf.attr("name",keyid+"-reconf"),isStandardForm()&&$(phoneInpConf).attr("aria-describedby","error-"+fldActualLinkName+"_"+rowId+"-reconf"),setcounytryCodeDetails(phoneInpConf,countryCodeProps,isRtlEnabled))}}function setcounytryCodeDetails(inpElem,countryCodeProps,isRtlEnabled){if(inpElem.intlTelInput(countryCodeProps),inpElem.on("countrychange",function(e,countryData){var valinfld=inpElem.val();"+"+inpElem.intlTelInput("getSelectedCountryData").dialCode==valinfld&&inpElem.val("")}),$(inpElem).parent().addClass("phCodeWrapper"),!isOneFieldForm()){var keyID="#"+$(inpElem).attr("id"),labelName=$(keyID+"-arialabel").find("span").text(),selectedElem=$(keyID).parent().find(".selected-flag");selectedElem.attr("aria-label",labelName+" "+i18n.accessibilityphonecountrydropdown),selectedElem.attr("role","combobox")}var cssPaddingProp=0==isRtlEnabled?"padding-left":"padding-right";$(inpElem).css(cssPaddingProp,ZFUtil.getFlagContWidth(inpElem)+4+"px"),$(inpElem).on("countrychange",function(){$(inpElem).css(cssPaddingProp,ZFUtil.getFlagContWidth(inpElem)+4+"px")}),$(inpElem).on("open:countrydropdown",function(){ZFUtil.setCountryCodeDropdownPosition(inpElem)})}function setMultiLineLiPropForSubForm(li,rowId,fldActualLinkName){$(li).find("textarea").attr("name",fldActualLinkName+"_"+rowId),isOneFieldForm()||($(li).find("textarea").attr("id",fldActualLinkName+"_"+rowId+"-arialabel"),$(li).find("label").attr("for",fldActualLinkName+"_"+rowId+"-arialabel"),$(li).find("p[elname=countmsg]").attr("id","countMsg-"+fldActualLinkName+"_"+rowId));var errorElem=isNewHtmlDOM()?$(li).find('div[elname="error"]'):$(li).find('p[elname="error"]');$(errorElem).attr("id","error-"+fldActualLinkName+"_"+rowId)}function setSliderLiPropForSubForm(li,rowId,fldActualLinkName){var inite=$(li).find("div#amount-"+fldActualLinkName+"_0").attr("value");if($(li).find('div[name="slider"]').attr("id","amount-"+fldActualLinkName+"_"+rowId),$(li).find("div#sld-"+fldActualLinkName+"_0").attr("id","sld-"+fldActualLinkName+"_"+rowId),!isOneFieldForm()){var labelElem=isStandardForm()?$(li).find("label.fieldlabel"):$(li).find("label.labelName");$(labelElem).attr("id",fldActualLinkName+"_"+rowId+"-arialabel"),$(li).find("div#sld-"+fldActualLinkName+"_"+rowId).find("[elname=circular-slider]").attr("aria-labelledby",fldActualLinkName+"_"+rowId+"-arialabel")}$(li).find("div#slid_"+fldActualLinkName+"_0_Div").attr("id","slid_"+fldActualLinkName+"_"+rowId+"_Div"),$(li).find("div#slid-"+fldActualLinkName+"_0").attr("id","slid-"+fldActualLinkName+"_"+rowId),callSliderScript(fldActualLinkName+"_"+rowId,inite,li);var errorElem=isNewHtmlDOM()?$(li).find('div[elname="error"]'):$(li).find('p[elname="error"]');$(errorElem).attr("id","error-"+fldActualLinkName+"_"+rowId)}function setRatingLiPropForSubForm(li,rowId,fldActualLinkName){var errorElem=isNewHtmlDOM()?$(li).find('div[elname="error"]'):$(li).find('p[elname="error"]');if($(errorElem).attr("id","error-"+fldActualLinkName+"_"+rowId),!isOneFieldForm()){var labelElem=isStandardForm()?$(li).find("label.fieldlabel"):$(li).find("label.labelName");$(labelElem).attr("id",fldActualLinkName+"_"+rowId+"-arialabel"),$(li).find('div[elname="ratingSubData"]').attr("aria-labelledby",fldActualLinkName+"_"+rowId+"-arialabel")}$(li).find('[elname="ratingSubData"]').find("a").each(function(ratingIdx,ratingAtag){$(ratingAtag).attr("name",fldActualLinkName+"_"+rowId)}),$(li).find("em#"+fldActualLinkName+"_0").attr("id",fldActualLinkName+"_"+rowId)}function setFileUploadLiPropForSubForm(li,rowId,fldActualLinkName){var fileUploadLimit=$(li).attr("uploadlimit");if(!isOneFieldForm()){var labelElem=isStandardForm()?$(li).find("label.fieldlabel"):$(li).find("label.labelName");$(labelElem).attr("id",fldActualLinkName+"_"+rowId+"-arialabel")}if(32==$(li).attr("comptype")?($(li).find('input[type="file"][ename="upload"]').attr("id",fldActualLinkName+"_"+rowId+"-id"),$(li).find('input[type="file"][ename="upload"]').attr("name",fldActualLinkName+"_"+rowId)):35==$(li).attr("comptype")?$(li).find('input[type="file"]:not([elname="videoInput"])').attr({id:fldActualLinkName+"_"+rowId+"-id",name:fldActualLinkName+"_"+rowId}):($(li).find('input[type="file"]').attr("id",fldActualLinkName+"_"+rowId+"-id"),$(li).find('input[type="file"]').attr("name",fldActualLinkName+"_"+rowId)),$(li).find('input[type="file"]').off("onchange"),isIELessThan10()||isWindowSafari())$(li).find("input[type='file']").attr("onchange","ZFLive.addFileUploadFields('"+fldActualLinkName+"_"+rowId+"', this)");else{var inp=$(li).find("input[type='file']");"true"==$(inp).attr("iscompression")?$(inp).attr("onchange","ZFLive.addMultipleFileUploadFields(this.files, '"+fldActualLinkName+"_"+rowId+"', '"+fileUploadLimit+"',true)"):$(inp).attr("onchange","ZFLive.addMultipleFileUploadFields(this.files, '"+fldActualLinkName+"_"+rowId+"', '"+fileUploadLimit+"')")}if($(li).find('input[elname="'+fldActualLinkName+'_0"]').attr("elname",fldActualLinkName+"_"+rowId),$(li).find("#"+fldActualLinkName+"_0-singlediv").attr("id",fldActualLinkName+"_"+rowId+"-singlediv"),$(li).find("#"+fldActualLinkName+"_0-div-files").attr("id",fldActualLinkName+"_"+rowId+"-div-files"),$(li).find('[elname="delSpan"]').off("click"),$(li).find('[elname="delSpan"]').attr("onclick","ZFLive.deleteFilesNewlyAdded('"+fldActualLinkName+"_"+rowId+"')"),$(li).find('[elname="removeFUElement"]').off("click"),$(li).find('[elname="removeFUElement"]').attr("onclick","ZFLive.deleteMultiplyAddedFiles('"+fldActualLinkName+"_"+rowId+"', this, null)"),$(li).find('[name="fileElementDiv"]').attr("elname",fldActualLinkName+"_"+rowId),$(li).find('[elname="templateFileElement"]').length>0){var removeElementLink=$(li).find('[elname="templateFileElement"]').find('a[name="removeFileElement"]');$(removeElementLink).off("click"),ZFLive.isOldUploadType?$(removeElementLink).attr("onclick","ZFLive.removeFile('"+fldActualLinkName+"_"+rowId+"',this);"):isNewHtmlDOM()?($(removeElementLink).attr("onclick","ZFLive.removeAndDeleteFile_of('"+fldActualLinkName+"_"+rowId+"',this);"),$(li).find('div[elname="fu_error"]').attr("id","fu_error-"+fldActualLinkName+"_"+rowId)):($(removeElementLink).attr("onclick","ZFLive.removeAndDeleteFile('"+fldActualLinkName+"_"+rowId+"',this);"),$(li).find('p[elname="fu_error"]').attr("id","fu_error-"+fldActualLinkName+"_"+rowId))}else $(li).find('[elname="addFileElement"]').off("click").attr("onclick","ZFLive.addFUElementIE(this, '"+fldActualLinkName+"_"+rowId+"','"+fileUploadLimit+"');"),$(li).find('[elname="removeFileElement"]').off("click").attr("onclick","ZFLive.removeFUElementIE(this, '"+fldActualLinkName+"_"+rowId+"',null);");if(isNewHtmlDOM()){if(!$(li).hasClass("fieldDisabled")){if($(li).find('div[elname="uploadActionDiv"]').attr("onclick","triggerinputfiletag('"+fldActualLinkName+"_"+rowId+"');"),$(li).find('div[elname="cameraActionDiv"]').length>0)if(isMobileBrowser())$(li).find('div[elname="cameraActionDiv"]').removeAttr("onclick").unbind("click").bind("click",function(){$(li).find('input[ename="cameraInput"]').click()});else"true"==$(li).find('div[elname="cameraActionDiv"]').attr("iscompression")?$(li).find('div[elname="cameraActionDiv"]').attr("onclick","liveCameraopen('"+fldActualLinkName+"_"+rowId+"','"+fileUploadLimit+"',true);"):$(li).find('div[elname="cameraActionDiv"]').attr("onclick","liveCameraopen('"+fldActualLinkName+"_"+rowId+"','"+fileUploadLimit+"');");$(li).find('a[elname="mediaRecorder"]').length>0&&(isMobileBrowser()&&3==$(li).attr("media_type")?$(li).find('a[elname="mediaRecorder"]').removeAttr("onclick").unbind("click").bind("click",function(){$(li).find('input[elname="videoInput"]').click()}):$(li).find('a[elname="mediaRecorder"]').attr("onclick","liveMediaRecord('"+fldActualLinkName+"_"+rowId+"','"+$(li).attr("media_type")+"','"+fileUploadLimit+"','"+$(li).attr("allowedtype")+"');"))}}else{if(!isOneFieldForm()){var iconUploadElem=$(li).find('a[elname="iconUpload"]');$(iconUploadElem).attr("aria-labelledby",fldActualLinkName+"_"+rowId+"-arialabel "+fldActualLinkName+"_"+rowId+"-upload-icon"),$(iconUploadElem).prev("span[elname=uploadIconSpan]").attr("id",fldActualLinkName+"_"+rowId+"-upload-icon")}if($(li).find('a[elname="iconUpload"]').attr("onclick","triggerinputfiletag('"+fldActualLinkName+"_"+rowId+"');"),$(li).find('a[elname="webCamera"]').length>0){var webCameraElem=$(li).find('a[elname="webCamera"]');if(isMobileBrowser())$(li).hasClass("fieldDisabled")||$(webCameraElem).removeAttr("onclick").unbind("click").bind("click",function(){$(li).find('input[ename="cameraInput"]').click()});else"true"==$(webCameraElem).attr("iscompression")?$(webCameraElem).attr("onclick","liveCameraopen('"+fldActualLinkName+"_"+rowId+"','"+fileUploadLimit+"',true);"):$(webCameraElem).attr("onclick","liveCameraopen('"+fldActualLinkName+"_"+rowId+"','"+fileUploadLimit+"');");isOneFieldForm()||($(webCameraElem).attr("aria-labelledby",fldActualLinkName+"_"+rowId+"-arialabel "+fldActualLinkName+"_"+rowId+"-image-icon"),$(webCameraElem).prev("span[elname=uploadIconSpan]").attr("id",fldActualLinkName+"_"+rowId+"-image-icon"))}$(li).find('a[elname="mediaRecorder"]').length>0&&(isMobileBrowser()&&3==$(li).attr("media_type")&&!$(li).hasClass("fieldDisabled")?$(li).find('a[elname="mediaRecorder"]').removeAttr("onclick").unbind("click").bind("click",function(){$(li).find('input[elname="videoInput"]').click()}):$(li).find('a[elname="mediaRecorder"]').attr("onclick","liveMediaRecord('"+fldActualLinkName+"_"+rowId+"','"+$(li).attr("media_type")+"','"+fileUploadLimit+"','"+$(li).attr("allowedtype")+"');"))}var errorElem=isNewHtmlDOM()?$(li).find('div[elname="error"]'):$(li).find('p[elname="error"]');$(errorElem).attr("id","error-"+fldActualLinkName+"_"+rowId)}function setDateLiPropForSubForm(li,rowId,fldActualLinkName){if($(li).find("#"+fldActualLinkName+"_0dateDiv").attr("id",fldActualLinkName+"_"+rowId+"dateDiv"),$(li).find("input").attr("id",fldActualLinkName+"_"+rowId+"-date").removeClass("hasDatepicker"),isAccessibilitySupported()){var labelElem=isStandardForm()?$(li).find("label.fieldlabel"):$(li).find("label.labelName");$(labelElem).attr("for",fldActualLinkName+"_"+rowId+"-date"),$(li).find("input").attr("aria-describedby",fldActualLinkName+"_"+rowId+"-subInfoText");var fieldContentDiv=isStandardForm()?$(li).find("input").closest("div[elname=zfFieldDiv]"):$(li).find("input").closest("div[elemname=fieldContentDiv]");$(fieldContentDiv).find("label[elname=formSubInfoText]").attr("id",fldActualLinkName+"_"+rowId+"-subInfoText"),$(fieldContentDiv).find("span[elname=arialabel-month]").attr("id",fldActualLinkName+"_"+rowId+"-month"),$(fieldContentDiv).find("span[elname=arialabel-year]").attr("id",fldActualLinkName+"_"+rowId+"-year")}var errorElem=isNewHtmlDOM()?$(li).find('div[elname="error"]'):$(li).find('p[elname="error"]');$(errorElem).attr("id","error-"+fldActualLinkName+"_"+rowId),callDateScript(fldActualLinkName+"_"+rowId)}function setMonthYearLiPropForSubForm(li,rowId,fldActualLinkName){$(li).find("#"+fldActualLinkName+"_0monthYearDiv").attr("id",fldActualLinkName+"_"+rowId+"monthYearDiv"),$(li).find("input").attr("id",fldActualLinkName+"_"+rowId+"-monthyear");var errorElem=isNewHtmlDOM()?$(li).find('div[elname="error"]'):$(li).find('p[elname="error"]');$(errorElem).attr("id","error-"+fldActualLinkName+"_"+rowId),callMonthYearScript(fldActualLinkName+"_"+rowId)}function setDateTimeLiPropForSubForm(li,rowId,fldActualLinkName){if($(li).find("#"+fldActualLinkName+"_0dateTimeDiv").attr("id",fldActualLinkName+"_"+rowId+"dateTimeDiv"),$(li).find("input").attr("id",fldActualLinkName+"_"+rowId+"-dateTime").removeClass("hasDatepicker"),!isOneFieldForm()){var labelElem=isStandardForm()?$(li).find("label.fieldlabel"):$(li).find("label.labelName");$(labelElem).attr("for",fldActualLinkName+"_"+rowId+"-dateTime"),$(li).find("input").attr("aria-describedby",fldActualLinkName+"_"+rowId+"-subInfoText");var fieldContentDiv=isStandardForm()?$(li).find("input").closest("div[elname=zfFieldDiv]"):$(li).find("input").closest("div[elemname=fieldContentDiv]");$(fieldContentDiv).find("label[elname=formSubInfoText]").attr("id",fldActualLinkName+"_"+rowId+"-subInfoText"),$(fieldContentDiv).find("span[elname=arialabel-month]").attr("id",fldActualLinkName+"_"+rowId+"-month"),$(fieldContentDiv).find("span[elname=arialabel-year]").attr("id",fldActualLinkName+"_"+rowId+"-year"),$(fieldContentDiv).find("span[elname=arialabel-hours]").attr("id",fldActualLinkName+"_"+rowId+"-hours"),$(fieldContentDiv).find("span[elname=arialabel-minutes]").attr("id",fldActualLinkName+"_"+rowId+"-minutes"),$(fieldContentDiv).find("span[elname=arialabel-meridiem]").attr("id",fldActualLinkName+"_"+rowId+"-meridiem")}var errorElem=isNewHtmlDOM()?$(li).find('div[elname="error"]'):$(li).find('p[elname="error"]');$(errorElem).attr("id","error-"+fldActualLinkName+"_"+rowId),callDateTimeScript(fldActualLinkName+"_"+rowId)}function callDateScript(key){var dateformat=$("#"+key+"dateDiv").attr("elname"),serverDateFormat=$("#zf_date_format").val(),dateElem=$("#"+key+"-date"),dateDiv=(dateElem=$("#"+key+"-date"),$("#"+key+"dateDiv")),dateLocale=$(dateDiv).attr("datelocale");typeof dateLocale!=ResponseKey.UNDEFINED&&""!=dateLocale||(dateLocale="en-GB");var isDisable=$("#"+key+"dateDiv").attr("isDisable");$(dateDiv).find("img").remove();var fldLi=getClosestFieldElemLi(dateDiv),weekStart=$(fldLi).attr("startoftheweek"),disableDays=$(fldLi).attr("disableddays");$(dateElem).datepicker({showOn:"button",buttonImage:spacerGifLiveUrl,buttonImageOnly:!0,dateFormat:dateformat,showAnim:"drop",changeMonth:!0,yearRange:"1900:2100",firstDay:weekStart,beforeShowDay:function(date){return ZFUtil.blockDisabledDaysAndHolidays(date,disableDays)},beforeShow:function(date){ZFUtil.setDateLimit(this,serverDateFormat,dateLocale)},onClose:function(){isAccessibilitySupported()&&$(this).focus()},onChangeMonthYear:function(year,month,inst){isAccessibilitySupported()&&setTimeout(function(){ZFLive.handleKeyNavigationsForDatePicker(this,event,!0)},0)},monthNamesShort:CustomDateLocale[dateLocale].monthNamesShort,monthNames:CustomDateLocale[dateLocale].monthNames,dayNamesMin:CustomDateLocale[dateLocale].dayNamesMin,showMonthAfterYear:CustomDateLocale[dateLocale].showMonthAfterYear,yearSuffix:CustomDateLocale[dateLocale].yearSuffix,changeYear:!0});var imgElem=$(dateDiv).find("img");$(imgElem).removeClass("ui-datepicker-trigger"),$(imgElem).addClass("calendarIcon"),$(imgElem).removeAttr("alt"),$(imgElem).appendTo($(dateDiv).find("div[elname=imgWrapDiv]")),$("#ui-datepicker-div").addClass("calIndex"),"true"==isDisable&&$(dateElem).datepicker().datepicker("disable")}function callMonthYearScript(key){var dateFormat=$("#zf_date_format").val(),monthYearElem=$("#"+key+"-monthyear"),monthYearDiv=$("#"+key+"monthYearDiv");initializeMonthYearPicker(monthYearElem,dateFormat,$(monthYearDiv).attr("datelocale"))}function callDateTimeScript(key){var dateTimeDiv=$("#"+key+"dateTimeDiv");$(dateTimeDiv).find("img").remove();var dateformat=$("#"+key+"dateTimeDiv").attr("elname"),serverDateFormat=$("#"+key+"dateTimeDiv").attr("serverDateFormat"),dateLocale=$("#"+key+"dateTimeDiv").attr("dateLocale"),isDisable=$("#"+key+"dateTimeDiv").attr("isDisable");ZFUtil.datetimepicker(serverDateFormat,dateformat,$("#"+key+"-dateTime"),dateLocale,!1);var imgElem=$(dateTimeDiv).find("img");$(imgElem).removeClass("ui-datepicker-trigger"),$(imgElem).addClass("calendarIcon"),$(imgElem).removeAttr("alt"),$("#ui-datepicker-div").addClass("calIndex"),"true"==isDisable&&$("#"+key+"-dateTime").datepicker().datepicker("disable")}function callSliderScript(key,inite,li){var range,minClassLimit,maxClassLimit,sliderType=$(li).attr("sliderType"),sliderMin=$(li).attr("sliderMin"),sliderMax=$(li).attr("sliderMax");isStandardForm()&&(range=sliderMax-sliderMin,minClassLimit=parseFloat(sliderMin)+.1*range,maxClassLimit=parseFloat(sliderMin)+.9*range);var isDisable=$(li).attr("isDisable"),showStepByPoint=$(li).attr("show_stepby_point"),showStepByValue=$(li).attr("show_stepby_value"),stepValue=$(li).attr("step_value"),isRtlEnabled=!1,rangeDirection="min",stopTriggered=!1,downEventTriggered=!1,moveEventTriggered=!1;isNewHtmlDOM()?"2"===ZFLive.txtDirection&&(isRtlEnabled=!0,rangeDirection="max"):$("body").hasClass("rtlWrapper")&&(isRtlEnabled=!0,rangeDirection="max");var thisSliderDiv=$("#sld-"+key);$(thisSliderDiv).children("div").remove(),inite===undefined&&(inite=""),$("#slid-"+key).text(inite),$("#sld-"+key).slider({orientation:sliderType,range:rangeDirection,min:Number(sliderMin),max:Number(sliderMax),step:Number(stepValue),animate:"300",value:inite,isRTL:isRtlEnabled,slide:function(event,ui){if(event.originalEvent!=undefined&&("mousedown"===event.originalEvent.type?downEventTriggered=!0:"mousemove"===event.originalEvent.type&&(moveEventTriggered=!0),!stopTriggered&&downEventTriggered&&moveEventTriggered))return!1;var slidval=ui.value;if($("#amount-"+key).attr("value",slidval),$("#slid-"+key).text(slidval),isStandardForm()&&(slidval<=minClassLimit?$("#"+key+"-li").find("div[id=slid_"+key+"_Div").addClass("sliderMinRange"):slidval>=maxClassLimit?$("#"+key+"-li").find("div[id=slid_"+key+"_Div").addClass("sliderMaxRange"):$("#"+key+"-li").find("div[id=slid_"+key+"_Div").removeClass("sliderMinRange sliderMaxRange")),isAccessibilitySupported()){var sliderValCont=$("#"+key+"-li").find("a[aria-label="+slidval+"]");$(sliderValCont).attr("tabindex","-1"),isRtlEnabled?($(sliderValCont).nextAll("a[aria-label]").attr("tabindex","-1"),$(sliderValCont).prevAll("a[aria-label]").attr("tabindex","0"),$("#"+key+"-li").find("[elname=circular-slider]").attr("tabindex","0")):($(sliderValCont).prevAll("a[aria-label]").attr("tabindex","-1"),$(sliderValCont).nextAll("a[aria-label]").attr("tabindex","0"));var circularSlider=$("#"+key+"-li").find("[elname=circular-slider]");$(circularSlider).attr("aria-valuenow",slidval)}$("#slid_"+key+"_Div").show(),stopTriggered=!1},stop:function(event,ui){stopTriggered=!0,downEventTriggered=!1,moveEventTriggered=!1,setSfTotalValForSlider(key),removeErrorFromLiElemForSlider(key)}}),$("#amount-"+key).val(inite),"true"==isDisable&&$("#sld-"+key).slider({disabled:!0}),showStepByPoint="true"==showStepByPoint,showStepByValue="true"==showStepByValue,ZFLive.setSliderIndicators("#sld-"+key,Number(stepValue),Number(sliderMin),Number(sliderMax),showStepByPoint,showStepByValue,isRtlEnabled)}function showInfoPopUp(msg,refElem){$("body").addClass("hideWindowScroll");var errMsgPopupElem=$("#infomsg-popup-div");$(errMsgPopupElem).find('p[elname="infoMsg"]').text(msg),$(errMsgPopupElem).show();var infoMsgPoupCont=$("#infomsg-popup-cont");if(setPopUpElemPositionNew($(infoMsgPoupCont),refElem),isAccessibilitySupported()){var setFocusableElem=$(errMsgPopupElem).find("p[elname=infoMsg]");if($(setFocusableElem).focus(),isStandardForm()){var deleteIconElem=$(errMsgPopupElem).find("div[elname=ppDeleteIcon]");$(deleteIconElem).attr("onClick","closeInfoPopUp('subformInfoMsgPopup', '"+$(refElem).closest("div[elname=livefield-elem]").attr("id")+"');")}else{deleteIconElem=$(errMsgPopupElem).find("a[elname=ppDeleteIcon]");$(deleteIconElem).attr("onClick","closeInfoPopUp('subformInfoMsgPopup', '"+$(refElem).closest("li[elname=livefield-elem]").attr("id")+"');")}var elements=[$(setFocusableElem),$(deleteIconElem)];ZFLive.handleTabKeyNavForCommonPopupCase($(infoMsgPoupCont),elements,0,"keydown.infoMsgPopup")}$(document).on("keyup",function(event){27===event.keyCode&&(isAccessibilitySupported()?closeInfoPopUp("subformInfoMsgPopup",$(refElem).closest("li[elname=livefield-elem]").attr("id")):closeInfoPopUp())})}function closeInfoPopUp(fromElem,refElem){if($("body").removeClass("hideWindowScroll"),unBindKeyUpEvent(),$("#infomsg-popup-div").hide(),isAccessibilitySupported()&&void 0!==fromElem&&"subformInfoMsgPopup"===fromElem){$(document).off("keydown.infoMsgPopup");var focusElem=$("#"+refElem).find("div[elname=addNewCardElem]");0==focusElem.length&&(focusElem=$("#"+refElem).find("ul[elname=subFormFieldsUl]:last").find("[elname=sfMoreCircle]")),$(focusElem).focus()}}function performCombinedUniqueCheckForFinalVal(sfLi,sfUniqueCheckJson,validRowsArray,sfRow,addRangeErrClass){var sfLinkName=$(sfLi).attr("linkname");if("undefined"!=typeof sfUniqueCheckJson.isValidForCombUniq&&"undefined"!=typeof ZFLive.sfUniqueJson[sfLinkName]&&"2"==ZFLive.sfUniqueJson[sfLinkName].unique_type)if("undefined"==typeof sfUniqueCheckJson.combined_unique&&(sfUniqueCheckJson.combined_unique=[]),sfUniqueCheckJson.isValidForCombUniq){var combVal=sfUniqueCheckJson.thisentrycombval,valPosInArray=$.inArray(combVal,sfUniqueCheckJson.combined_unique);if(-1!=valPosInArray){sfUniqueCheckJson.combined_unique.push(""),showCombinedUniqueErrorOnFinalValidation($(sfRow),sfLinkName,$(sfLi),addRangeErrClass);var oldSfRow=validRowsArray[valPosInArray];return void(-1==$.inArray($(oldSfRow).attr("rowid"),ZFLive.sfUniqueValidator[sfLinkName].combined_unique)&&showCombinedUniqueErrorOnFinalValidation($(oldSfRow),sfLinkName,$(sfLi),addRangeErrClass))}sfUniqueCheckJson.combined_unique.push(combVal)}else sfUniqueCheckJson.combined_unique.push("")}function validateSFUniquenessForAllFields(sfLi,elem,sfUniqueCheckJson,addRangeErrClass,validRowsArray){var sfLinkName=$(sfLi).attr("linkname");if(typeof ZFLive.sfUniqueJson!==ResponseKey.UNDEFINED&&typeof ZFLive.sfUniqueJson[sfLinkName]!==ResponseKey.UNDEFINED){var uniqueFlds=ZFLive.sfUniqueJson[sfLinkName].fields,linkname=$(elem).attr("linkname");if(void 0!==uniqueFlds&&uniqueFlds.length>0&&$.inArray(linkname,uniqueFlds)>-1)if("1"==ZFLive.sfUniqueJson[sfLinkName].unique_type){"undefined"==typeof sfUniqueCheckJson[linkname]&&(sfUniqueCheckJson[linkname]=[]);var compname=$(elem).attr("compname");if(-1!=$.inArray(compname,ZFLive.errorArray))return void sfUniqueCheckJson[linkname].push("");if(""!=(elemVal=getValueForSfUniqCheck($(elem)))){var valPosInArray=$.inArray(elemVal,sfUniqueCheckJson[linkname]);if(-1!=valPosInArray){sfUniqueCheckJson[linkname].push(""),showIndUniqueErrorOnFinalValidation($(elem),sfLinkName,sfLi,addRangeErrClass);var oldSfRow=validRowsArray[valPosInArray],oldErrElem=getFieldElemWithFldLinkNameLivefieldElemFrmParent(oldSfRow,linkname);return void(-1==$.inArray(oldErrElem.attr("compname"),ZFLive.errorArray)&&showIndUniqueErrorOnFinalValidation($(oldErrElem),sfLinkName,sfLi,addRangeErrClass))}sfUniqueCheckJson[linkname].push(elemVal)}else sfUniqueCheckJson[linkname].push("")}else if("2"==ZFLive.sfUniqueJson[sfLinkName].unique_type){"undefined"==typeof sfUniqueCheckJson.isValidForCombUniq&&(sfUniqueCheckJson.isValidForCombUniq=!0);var elemVal;compname=$(elem).attr("compname");if(-1!=$.inArray(compname,ZFLive.errorArray))return void(sfUniqueCheckJson.isValidForCombUniq=!1);""!=(elemVal=getValueForSfUniqCheck($(elem)))?sfUniqueCheckJson.thisentrycombval+=elemVal+"--zf--":sfUniqueCheckJson.isValidForCombUniq=!1}}}function removeUniqueErrorOnDel(subFormParentLi,rowId){var sfLinkName=$(subFormParentLi).attr("linkname");typeof ZFLive.sfUniqueJson!==ResponseKey.UNDEFINED&&typeof ZFLive.sfUniqueJson[sfLinkName]!==ResponseKey.UNDEFINED&&("2"==ZFLive.sfUniqueJson[sfLinkName].unique_type?removeSFCombinedUniqueOnDel(subFormParentLi,sfLinkName,rowId):removeSFIndUniqueOnDel(subFormParentLi,sfLinkName,rowId))}function removeSFCombinedUniqueOnDel(sfLi,sfLinkName,rowId){if("undefined"!=typeof ZFLive.sfUniqueValidator[sfLinkName]&&"undefined"!=typeof ZFLive.sfUniqueValidator[sfLinkName].combined_unique){var previousErrorArr=ZFLive.sfUniqueValidator[sfLinkName].combined_unique,prevErrIdx=$.inArray(rowId,previousErrorArr);if(prevErrIdx>-1){previousErrorArr.splice(prevErrIdx,1);var errRowIdToRemove="";if(1==previousErrorArr.length)errRowIdToRemove=previousErrorArr[0];else{var errArr=[];for(i=0;i-1)){var isMatchFound=!1,sfCombinedUniqueList=ZFLive.sfUniqueJson[sfLinkName].fields,thisErrVal=getCombinedUniqueValueForARow($(sfLi).find('[rowId="'+thisErrIdx+'"]'),sfCombinedUniqueList);for(j=i+1;j0)for(var fldIdx=0;fldIdx-1){previousErrorArr.splice(prevErrIdx,1);var errRowIdToRemove="";if(1==previousErrorArr.length)errRowIdToRemove=previousErrorArr[0];else for(var errArr=[],i=0;i-1)){var isMatchFound=!1,thisErrVal=getValueForSfUniqCheck(getFieldElemWithFldLinkNameLivefieldElemFrmParent($(sfLi).find('[rowId="'+thisErrIdx+'"]'),fldLinkName));for(j=i+1;j0){var sfLinkName=$(sfPopUp).attr("linkname");sfLi=getFieldElemWithFldLinkNameAttrLivefieldElem(sfLinkName)}else sfLi=getClosestSubformElemLi(elem);var sfFldLinkName=$(sfLi).attr("linkname");if("undefined"!=typeof ZFLive.sfUniqueJson[sfFldLinkName]){var thisSfUniqueJson=ZFLive.sfUniqueJson[sfFldLinkName],uniqueFields=thisSfUniqueJson.fields;$.inArray(linkname,uniqueFields)>-1&&(2==thisSfUniqueJson.unique_type?validateSfCombUnique(uniqueFields,elem,sfLi,!0):1==thisSfUniqueJson.unique_type&&validateSfIndUnique(elem,sfLi,!0),clearError=!1)}}if(clearError){removeErrorFromLiElem($(elem));var errorIdd=ZFLive.errorId($(elem).attr("compname"));$(errorIdd).removeClass("rangeError").removeClass("warningMessage")}}function validateSfIndUnique(elem,sfLi,removeError){var elemVal=getValueForSfUniqCheck($(elem)),errRowIdx=[],linkname=$(elem).attr("linkname");if(""!=elemVal){var sfLiFormFieldULIter=isNewHtmlDOM()?$(sfLi).find('div[elname="subFormFieldsUl"]'):$(sfLi).find('ul[elname="subFormFieldsUl"]');if($(sfLiFormFieldULIter).each(function(sfFldsUlIndex,sfFldsUl){var sfFldLi=getFieldElemWithFldLinkNameLivefieldElemFrmParent(sfFldsUl,linkname),fldVal=getValueForSfUniqCheck(sfFldLi);$(sfFldLi).attr("compname")!=$(elem).attr("compname")&&elemVal==fldVal&&errRowIdx.push($(sfFldsUl).attr("rowId"))}),errRowIdx.length>0){var sfFldUl=getClosestParentSubFormUL(elem);errRowIdx.push($(sfFldUl).attr("rowId"))}}setSFIndUniqueError(errRowIdx,$(sfLi),$(sfLi).attr("linkname"),linkname,$(elem),removeError)}function validateSfCombUnique(sfCombinedUniqueList,elem,sfLi,removeError){var thisSfUl=isNewHtmlDOM()?$(elem).closest('div[elname="subFormFieldsUl"]'):$(elem).closest('ul[elname="subFormFieldsUl"]'),combinedUiqueVal=getCombinedUniqueValueForARow($(thisSfUl),sfCombinedUniqueList),combinedUiqueErrorEntries=[];if(void 0!==combinedUiqueVal&&""!=$.trim(combinedUiqueVal)){var subformULIterator=isNewHtmlDOM()?$(sfLi).find('div[elname="subFormFieldsUl"]'):$(sfLi).find('ul[elname="subFormFieldsUl"]');$(subformULIterator).each(function(sfFldsUlIndex,sfFldsUl){if($(sfFldsUl).attr("rowid")!=thisSfUl.attr("rowid")){var thisEntryVal=getCombinedUniqueValueForARow($(sfFldsUl),sfCombinedUniqueList);combinedUiqueVal==thisEntryVal&&combinedUiqueErrorEntries.push($(sfFldsUl).attr("rowid"))}}),combinedUiqueErrorEntries.length>0&&combinedUiqueErrorEntries.push($(thisSfUl).attr("rowid"))}setSFCombinedUniqueError(combinedUiqueErrorEntries,$(sfLi),$(sfLi).attr("linkname"),$(elem).attr("linkname"),$(elem),removeError)}function getCombinedUniqueValueForARow(sfFldsUl,sfCombinedUniqueList){for(var thisEntryVal="",sfCombUniqFldPos=0;sfCombUniqFldPos0&&ZFLive.checkPhFldIdentical(elem,compname,!1,!1)?elemVal.trim().toLowerCase():""}return elemVal.trim().toLowerCase()}if(compType==ZFFieldTypeConstants.EMAIL||compType==ZFFieldTypeConstants.NUMBER||compType==ZFFieldTypeConstants.DECIMAL||compType==ZFFieldTypeConstants.CURRENCY){if(needConf(elem)){reconf_input=$(elem).find("span[elname=livefield-reconf-elem]").find("input"),compname=$(elem).attr("compname");return typeof reconf_input!=ResponseKey.UNDEFINED&&$.trim($(reconf_input).val()).length>0&&ZFLive.checkIfIdentical(elem,compname,!1)?elemVal.trim().toLowerCase():""}return elemVal.trim().toLowerCase()}return elemVal.trim().toLowerCase()}}return""}function clearSFUniqueError(elem){var parentElname=$(elem).closest("ul").attr("elname");if(void 0!==parentElname&&"subFormFieldsUl"==parentElname){var sfLi,linkname=elem.attr("linkname"),sfPopUp=$(elem).closest("#subFormPopUp");if($(sfPopUp).length>0){var sfLinkName=$(sfPopUp).attr("linkname");sfLi=getFieldElemWithFldLinkNameAttrLivefieldElem(sfLinkName)}else sfLi=isStandardForm()?$(elem).closest('div[elemtype="subFormField"]'):$(elem).closest('li[elemtype="subFormField"]');var sfFldLinkName=$(sfLi).attr("linkname"),thisSfUniqueJson=ZFLive.sfUniqueJson[sfFldLinkName];if(typeof thisSfUniqueJson!==ResponseKey.UNDEFINED){var uniqueFields=thisSfUniqueJson.fields;$.inArray(linkname,uniqueFields)>-1&&(2==thisSfUniqueJson.unique_type?setSFCombinedUniqueError([],sfLi,sfFldLinkName,linkname,elem,!1):1==thisSfUniqueJson.unique_type&&setSFIndUniqueError([],sfLi,sfFldLinkName,linkname,elem,!1))}}}function setSFCombinedUniqueError(errArr,sfLi,sfLinkName,fldLinkName,thisElem,removeError){"undefined"!=typeof ZFLive.sfUniqueValidator[sfLinkName]?"undefined"==typeof ZFLive.sfUniqueValidator[sfLinkName].combined_unique&&(ZFLive.sfUniqueValidator[sfLinkName].combined_unique=[]):(ZFLive.sfUniqueValidator[sfLinkName]={},ZFLive.sfUniqueValidator[sfLinkName].combined_unique=[]);var previousErrorArr=ZFLive.sfUniqueValidator[sfLinkName].combined_unique,thisSfUl=isNewHtmlDOM()?$(thisElem).closest('div[elname="subFormFieldsUl"]'):$(thisElem).closest('ul[elname="subFormFieldsUl"]'),prevErrIdx=$.inArray($(thisSfUl).attr("rowid"),previousErrorArr);if(prevErrIdx>-1){if(errArr.length>0)for(i=0;i-1)){var isMatchFound=!1,sfCombinedUniqueList=ZFLive.sfUniqueJson[sfLinkName].fields,thisErrVal=getCombinedUniqueValueForARow($(sfLi).find('[rowId="'+thisErrIdx+'"]'),sfCombinedUniqueList);for(j=i+1;j0)for(i=0;i-1){if(errArr.length>0)for(i=0;i-1)){var isMatchFound=!1,thisErrVal=getValueForSfUniqCheck(getFieldElemWithFldLinkNameLivefieldElemFrmParent($(sfLi).find('[rowId="'+thisErrIdx+'"]'),fldLinkName));for(j=i+1;j0){for(i=0;i0&&void 0!==thisSfUniqueError)for(var i=0;i0&&$.inArray(rowId,thisSfUniqueError[fldLinkName])>-1){removeCardErr=!1;break}}removeCardErr&&($(cardDiv).find('[elname="sfCardInnerElem"]').removeClass("sfCardError"),0==$(sfLi).find('[elname="sfCardInnerElem"].sfCardError').length&&$(sfLi).children("p[elname=error],div[elname=error]").hide())}}}function validateSFUniqueOnReConf(elem,isValid){var linkname=$(elem).attr("linkname");if("undefined"!=typeof ZFLive.sfUniqueJson&&!$.isEmptyObject(ZFLive.sfUniqueJson)){var sfLi,sfPopUp=$(elem).closest("#subFormPopUp");if($(sfPopUp).length>0){var sfLinkName=$(sfPopUp).attr("linkname");sfLi=getFieldElemWithFldLinkNameAttrLivefieldElem(sfLinkName)}else sfLi=getClosestSubformElemLi(elem);var sfFldLinkName=$(sfLi).attr("linkname");if("undefined"!=typeof ZFLive.sfUniqueJson[sfFldLinkName]){var thisSfUniqueJson=ZFLive.sfUniqueJson[sfFldLinkName],uniqueFields=thisSfUniqueJson.fields;if($.inArray(linkname,uniqueFields)>-1)if(isValid)2==thisSfUniqueJson.unique_type?validateSfCombUnique(uniqueFields,elem,sfLi,!1):1==thisSfUniqueJson.unique_type&&validateSfIndUnique(elem,sfLi,!1);else{2==thisSfUniqueJson.unique_type?setSFCombinedUniqueError([],sfLi,sfFldLinkName,linkname,elem,!0):1==thisSfUniqueJson.unique_type&&setSFIndUniqueError([],sfLi,sfFldLinkName,linkname,elem,!0)}}}}function needToTriggerSelect2ChangeInSubForm(sfViewType){return isNewHtmlDOM()||ZFLive.isDefaultTheme!=undefined&&1==ZFLive.isDefaultTheme||"1"==sfViewType&&ZFLive.sfdpdTemplate!=undefined&&"modelone"==ZFLive.sfdpdTemplate||"2"==sfViewType&&ZFLive.dpdTemplate!=undefined&&"modelone"==ZFLive.dpdTemplate}function setIsOtherSelectedAttrInCardSummaryForDD(childElem,recordValElem){if(parseInt($(childElem).attr("comptype"))==ZFFieldTypeConstants.DROPDOWN&&$(childElem).attr("id")){var isOthersValueSelected=!1,fldLinkName=$(childElem).attr("compname");$(childElem).find("select[name='"+fldLinkName+"']").each(function(indexelem,elemnew){"zfs-others-zfs"==$(elemnew).val()&&(isOthersValueSelected=!0)}),$(recordValElem).attr("isOthersValueSelected",isOthersValueSelected)}}ZFLive.playMedia=function(elem,type){var src=$(elem).attr("src"),popupDiv=isStandardForm()&&isEmbeddedForm()?$("#iframe-media-popupdiv"):$("#popupdiv");if(type==MediaTypeLiveConstant.AUDIO)var mediaEle=$(popupDiv).find("audio")[0];else mediaEle=$(popupDiv).find("video")[0];$(mediaEle).attr("src",""),$(mediaEle).attr("src",src),ZFLive.showPlayableMediaElem(mediaEle,popupDiv);var imageChoiceDivCont=isStandardForm()&&isEmbeddedForm()?$("#iframe-imageChoiceDiv-cont"):$("#imageChoiceDiv-cont");if(isStandardForm()&&isEmbeddedForm()){var refElem=event.target,popupCont=$(popupDiv).find("div[elname=popupCont]");setPopupPositionNearRefElem(popupCont,refElem,30,!0)}if(!isStandardForm()){var popUpContDiv=$(mediaEle).parent();setZoomPopUpElemPosition($(imageChoiceDivCont));var maxHt=$(imageChoiceDivCont).height(),maxWt=$(imageChoiceDivCont).width();$(popUpContDiv).height(maxHt-Math.max(0,$(window).height()/8)-72),$(popUpContDiv).width(maxWt-65),$(mediaEle).css("max-width",maxWt-65),$(mediaEle).css("max-height",maxHt-Math.max(0,$(window).height()/8)-85)}$(popupDiv).show(),$("body").addClass("hideWindowScroll");var linkName=$(elem).closest("li[elname=newlyAddedFUElement]").attr("linkname");setTimeout(function(){if(isAccessibilitySupported()){$(mediaEle).focus();var closePreview=$(imageChoiceDivCont).find("[elname=hideZoomedImage]");isStandardForm()&&isEmbeddedForm()?$(closePreview).attr("onclick","ZFLive.hideZoomedImage_iframe('"+linkName+"')"):$(closePreview).attr("onclick","ZFLive.hideZoomedImage('"+linkName+"')");var elements=[$(mediaEle),$(closePreview)];ZFLive.handleTabKeyNavForCommonPopupCase($(imageChoiceDivCont),elements,0,"keydown.previewmedia")}},300),isStandardForm()&&isEmbeddedForm()?$(document).on("keyup.zoomimage",function(event){27==event.keyCode&&ZFLive.hideZoomedImage_iframe(linkName)}):$(document).keyup(function(event){27==event.keyCode&&ZFLive.hideZoomedImage(linkName)})},ZFLive.playMediaInReview=function(elem,type){var mediaPopupDiv=$("#reviewImgpopupdiv");if(type==MediaTypeLiveConstant.AUDIO)var mediaEle=document.querySelector("#reviewImgpopupdiv audio");else mediaEle=document.querySelector("#reviewImgpopupdiv video");$(mediaEle).attr("src",$(elem).attr("src")),ZFLive.showPlayableMediaElem(mediaEle,mediaPopupDiv);var popUpContDiv=$(mediaEle).parent(),imgContDiv=$("#imageContDiv");if(!isStandardForm()){setZoomPopUpElemPosition(imgContDiv);var maxHt=$(imgContDiv).height(),maxWt=$(imgContDiv).width();$(popUpContDiv).height(maxHt-Math.max(0,$(window).height()/8)-72),$(popUpContDiv).width(maxWt-65),$(mediaEle).css("max-width",maxWt-65),$(mediaEle).css("max-height",maxHt-Math.max(0,$(window).height()/8)-85)}$(mediaPopupDiv).show(),$("body").addClass("hideWindowScroll"),$(document).keyup(function(event){27===event.keyCode&&ZFLive.hideZoomedReviewImage(elem)}),isAccessibilitySupported()&&setTimeout(function(){$(mediaEle).focus()},300)},ZFLive.showPlayableMediaElem=function(media,popUpDiv){try{media.play().then(function(){$(media).show()})["catch"](function(error){$(popUpDiv).find("p[elname=mediaPlayerError]").show(),isAccessibilitySupported()&&($(popUpDiv).focus(),$(popUpDiv).find("p[elname=mediaPlayerError]").attr({role:"alert","aria-live":"assertive"}))})}catch(error){$(popUpDiv).find("p[elname=mediaPlayerError]").show(),isAccessibilitySupported()&&($(popUpDiv).focus(),$(popUpDiv).find("p[elname=mediaPlayerError]").attr({role:"alert","aria-live":"assertive"}))}},ZFLive.setSliderIndicators=function(sliderDivId,stepValue,minValue,maxValue,showPoints,showValue,isRtlEnabled,inite){if(isAccessibilitySupported()){if(showPoints||showValue){for(var stepValues=[],count=0,i=minValue+stepValue;i10);i+=stepValue)stepValues.push(i);if(count>10)return;var nextPosition=widthDiff=100*stepValue/(maxValue-minValue),tabindex="0",fldElem=isStandardForm()?$(sliderDivId).closest("div[elname=livefield-elem]"):$(sliderDivId).parents("li[elname=livefield-elem]");if("true"===$(fldElem).attr("isdisable")&&(tabindex="-1"),showPoints)if(isRtlEnabled){tabindex="-1"==tabindex||inite>=maxValue?"-1":"0",$(sliderDivId).append('');for(i=stepValues.length;i>0;i--)tabindex="-1"==tabindex||inite>=stepValues[i-1]?"-1":"0",$(sliderDivId).append(''),nextPosition+=widthDiff;tabindex="-1"==tabindex||inite>=minValue?"-1":"0",$(sliderDivId).append('')}else{for(var value in tabindex="-1"==tabindex||inite>=minValue?"-1":"0",$(sliderDivId).append(''),stepValues)tabindex="-1"==tabindex||inite>=stepValues[value]?"-1":"0",$(sliderDivId).append(''),nextPosition+=widthDiff;tabindex="-1"==tabindex||inite>=maxValue?"-1":"0",$(sliderDivId).append('')}if(showValue)if(0!=$(sliderDivId).find('a[elname="sliderPointFirst"]').length)for(var value in stepValues)$(sliderDivId).find('a[elname="sliderPoint'+value+'"]').append('
    |'+stepValues[value]+"
    ");else if(isRtlEnabled)for(i=stepValues.length;i>0;i--)tabindex="-1"==tabindex||inite>=nextPosition?"-1":"0",$(sliderDivId).append('
    |'+stepValues[i-1]+"
    "),nextPosition+=widthDiff;else for(var value in stepValues)tabindex="-1"==tabindex||inite>=nextPosition?"-1":"0",$(sliderDivId).append('
    |'+stepValues[value]+"
    "),nextPosition+=widthDiff}}else if(showPoints||showValue){for(stepValues=[],count=0,i=minValue+stepValue;i10);i+=stepValue)stepValues.push(i);if(count>10)return;var widthDiff;nextPosition=widthDiff=100*stepValue/(maxValue-minValue);if(showPoints)if(isRtlEnabled){$(sliderDivId).append('');for(i=stepValues.length;i>0;i--)$(sliderDivId).append(''),nextPosition+=widthDiff;$(sliderDivId).append('')}else{for(var value in $(sliderDivId).append(''),stepValues)$(sliderDivId).append(''),nextPosition+=widthDiff;$(sliderDivId).append('')}if(showValue)if(0!=$(sliderDivId).find('a[elname="sliderPointFirst"]').length)for(var value in stepValues)$(sliderDivId).find('a[elname="sliderPoint'+value+'"]').append('
    |'+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;i0){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()});