function scJQGeneralAdd() { scLoadScInput('input:text.sc-js-input'); scLoadScInput('input:password.sc-js-input'); scLoadScInput('input:checkbox.sc-js-input'); scLoadScInput('input:radio.sc-js-input'); scLoadScInput('select.sc-js-input'); scLoadScInput('textarea.sc-js-input'); } // scJQGeneralAdd function scFocusField(sField) { var $oField = $('#id_sc_field_' + sField); if (0 == $oField.length) { $oField = $('input[name=' + sField + ']'); } if (0 == $oField.length && document.F1.elements[sField]) { $oField = $(document.F1.elements[sField]); } if ($("#id_ac_" + sField).length > 0) { if ($oField.hasClass("select2-hidden-accessible")) { if (false == scSetFocusOnField($oField, sField)) { setTimeout(function() { scSetFocusOnField($oField, sField); }, 500); } } else { if (false == scSetFocusOnField($oField, sField)) { if (false == scSetFocusOnField($("#id_ac_" + sField, sField))) { setTimeout(function() { scSetFocusOnField($("#id_ac_" + sField, sField)); }, 500); } } else { setTimeout(function() { scSetFocusOnField($oField, sField); }, 500); } } } else { setTimeout(function() { scSetFocusOnField($oField, sField); }, 500); } } // scFocusField function scSetFocusOnField($oField, sField) { if ($oField.length > 0 && $oField[0].offsetHeight > 0 && $oField[0].offsetWidth > 0 && !$oField[0].disabled) { if (sField == 'recurrence' || sField == 'period' || sField == 'category') { $oField.select2('open'); } else { $oField[0].focus(); } return true; } return false; } // scSetFocusOnField function scEventControl_init(iSeqRow) { scEventControl_data["contact_id" + iSeqRow] = {"blur": false, "change": false, "autocomp": false, "original": "", "calculated": ""}; scEventControl_data["client_id" + iSeqRow] = {"blur": false, "change": false, "autocomp": false, "original": "", "calculated": ""}; scEventControl_data["title" + iSeqRow] = {"blur": false, "change": false, "autocomp": false, "original": "", "calculated": ""}; scEventControl_data["category" + iSeqRow] = {"blur": false, "change": false, "autocomp": false, "original": "", "calculated": ""}; scEventControl_data["id_api" + iSeqRow] = {"blur": false, "change": false, "autocomp": false, "original": "", "calculated": ""}; scEventControl_data["event_color" + iSeqRow] = {"blur": false, "change": false, "autocomp": false, "original": "", "calculated": ""}; scEventControl_data["start_date" + iSeqRow] = {"blur": false, "change": false, "autocomp": false, "original": "", "calculated": ""}; scEventControl_data["end_date" + iSeqRow] = {"blur": false, "change": false, "autocomp": false, "original": "", "calculated": ""}; scEventControl_data["start_time" + iSeqRow] = {"blur": false, "change": false, "autocomp": false, "original": "", "calculated": ""}; scEventControl_data["end_time" + iSeqRow] = {"blur": false, "change": false, "autocomp": false, "original": "", "calculated": ""}; scEventControl_data["__calend_all_day__" + iSeqRow] = {"blur": false, "change": false, "autocomp": false, "original": "", "calculated": ""}; scEventControl_data["recurrence" + iSeqRow] = {"blur": false, "change": false, "autocomp": false, "original": "", "calculated": ""}; scEventControl_data["period" + iSeqRow] = {"blur": false, "change": false, "autocomp": false, "original": "", "calculated": ""}; scEventControl_data["recur_info" + iSeqRow] = {"blur": false, "change": false, "autocomp": false, "original": "", "calculated": ""}; } function scEventControl_active(iSeqRow) { if (scEventControl_data["contact_id" + iSeqRow] && scEventControl_data["contact_id" + iSeqRow]["blur"]) { return true; } if (scEventControl_data["contact_id" + iSeqRow] && scEventControl_data["contact_id" + iSeqRow]["change"]) { return true; } if (scEventControl_data["client_id" + iSeqRow] && scEventControl_data["client_id" + iSeqRow]["blur"]) { return true; } if (scEventControl_data["client_id" + iSeqRow] && scEventControl_data["client_id" + iSeqRow]["change"]) { return true; } if (scEventControl_data["title" + iSeqRow] && scEventControl_data["title" + iSeqRow]["blur"]) { return true; } if (scEventControl_data["title" + iSeqRow] && scEventControl_data["title" + iSeqRow]["change"]) { return true; } if (scEventControl_data["category" + iSeqRow] && scEventControl_data["category" + iSeqRow]["blur"]) { return true; } if (scEventControl_data["category" + iSeqRow] && scEventControl_data["category" + iSeqRow]["change"]) { return true; } if (scEventControl_data["id_api" + iSeqRow] && scEventControl_data["id_api" + iSeqRow]["blur"]) { return true; } if (scEventControl_data["id_api" + iSeqRow] && scEventControl_data["id_api" + iSeqRow]["change"]) { return true; } if (scEventControl_data["event_color" + iSeqRow] && scEventControl_data["event_color" + iSeqRow]["blur"]) { return true; } if (scEventControl_data["event_color" + iSeqRow] && scEventControl_data["event_color" + iSeqRow]["change"]) { return true; } if (scEventControl_data["start_date" + iSeqRow] && scEventControl_data["start_date" + iSeqRow]["blur"]) { return true; } if (scEventControl_data["start_date" + iSeqRow] && scEventControl_data["start_date" + iSeqRow]["change"]) { return true; } if (scEventControl_data["end_date" + iSeqRow] && scEventControl_data["end_date" + iSeqRow]["blur"]) { return true; } if (scEventControl_data["end_date" + iSeqRow] && scEventControl_data["end_date" + iSeqRow]["change"]) { return true; } if (scEventControl_data["start_time" + iSeqRow] && scEventControl_data["start_time" + iSeqRow]["blur"]) { return true; } if (scEventControl_data["start_time" + iSeqRow] && scEventControl_data["start_time" + iSeqRow]["change"]) { return true; } if (scEventControl_data["end_time" + iSeqRow] && scEventControl_data["end_time" + iSeqRow]["blur"]) { return true; } if (scEventControl_data["end_time" + iSeqRow] && scEventControl_data["end_time" + iSeqRow]["change"]) { return true; } if (scEventControl_data["__calend_all_day__" + iSeqRow] && scEventControl_data["__calend_all_day__" + iSeqRow]["blur"]) { return true; } if (scEventControl_data["__calend_all_day__" + iSeqRow] && scEventControl_data["__calend_all_day__" + iSeqRow]["change"]) { return true; } if (scEventControl_data["recurrence" + iSeqRow] && scEventControl_data["recurrence" + iSeqRow]["blur"]) { return true; } if (scEventControl_data["recurrence" + iSeqRow] && scEventControl_data["recurrence" + iSeqRow]["change"]) { return true; } if (scEventControl_data["period" + iSeqRow] && scEventControl_data["period" + iSeqRow]["blur"]) { return true; } if (scEventControl_data["period" + iSeqRow] && scEventControl_data["period" + iSeqRow]["change"]) { return true; } if (scEventControl_data["recur_info" + iSeqRow] && scEventControl_data["recur_info" + iSeqRow]["blur"]) { return true; } if (scEventControl_data["recur_info" + iSeqRow] && scEventControl_data["recur_info" + iSeqRow]["change"]) { return true; } return false; } // scEventControl_active function scEventControl_onFocus(oField, iSeq) { var fieldId, fieldName; fieldId = $(oField).attr("id"); fieldName = fieldId.substr(12); scEventControl_data[fieldName]["blur"] = true; if ("contact_id" + iSeq == fieldName) { scEventControl_data[fieldName]["blur"] = false; } if ("client_id" + iSeq == fieldName) { scEventControl_data[fieldName]["blur"] = false; } if ("category" + iSeq == fieldName) { scEventControl_data[fieldName]["blur"] = false; } if ("recurrence" + iSeq == fieldName) { scEventControl_data[fieldName]["blur"] = false; } if ("period" + iSeq == fieldName) { scEventControl_data[fieldName]["blur"] = false; } if ("client_id" + iSeq == fieldName) { scEventControl_data[fieldName]["change"] = true; scEventControl_data[fieldName]["original"] = $(oField).val(); scEventControl_data[fieldName]["calculated"] = $(oField).val(); return; } if ("contact_id" + iSeq == fieldName) { scEventControl_data[fieldName]["change"] = true; scEventControl_data[fieldName]["original"] = $(oField).val(); scEventControl_data[fieldName]["calculated"] = $(oField).val(); return; } scEventControl_data[fieldName]["change"] = false; } // scEventControl_onFocus function scEventControl_onBlur(sFieldName) { scEventControl_data[sFieldName]["blur"] = false; if (scEventControl_data[sFieldName]["change"]) { if (scEventControl_data[sFieldName]["original"] == $("#id_sc_field_" + sFieldName).val() || scEventControl_data[sFieldName]["calculated"] == $("#id_sc_field_" + sFieldName).val()) { scEventControl_data[sFieldName]["change"] = false; } } } // scEventControl_onBlur function scEventControl_onChange(sFieldName) { scEventControl_data[sFieldName]["change"] = false; } // scEventControl_onChange function scEventControl_onAutocomp(sFieldName) { scEventControl_data[sFieldName]["autocomp"] = false; } // scEventControl_onChange var scEventControl_data = {}; function scJQEventsAdd(iSeqRow) { $('#id_sc_field_title' + iSeqRow).bind('blur', function() { setTimeout(function() {sc_calendar_overview_title_onblur('#id_sc_field_title' + iSeqRow, iSeqRow, event);}, 300) }) .bind('focus', function() { sc_calendar_overview_title_onfocus(this, iSeqRow, event) }); $('#id_sc_field_start_date' + iSeqRow).bind('blur', function() { setTimeout(function() {sc_calendar_overview_start_date_onblur('#id_sc_field_start_date' + iSeqRow, iSeqRow, event);}, 300) }) .bind('focus', function() { sc_calendar_overview_start_date_onfocus(this, iSeqRow, event) }); $('#id_sc_field_start_time' + iSeqRow).bind('blur', function() { sc_calendar_overview_start_time_onblur('#id_sc_field_start_time' + iSeqRow, iSeqRow, event) }) .bind('focus', function() { sc_calendar_overview_start_time_onfocus(this, iSeqRow, event) }); $('#id_sc_field_end_date' + iSeqRow).bind('blur', function() { sc_calendar_overview_end_date_onblur('#id_sc_field_end_date' + iSeqRow, iSeqRow, event) }) .bind('focus', function() { sc_calendar_overview_end_date_onfocus(this, iSeqRow, event) }); $('#id_sc_field_end_time' + iSeqRow).bind('blur', function() { sc_calendar_overview_end_time_onblur('#id_sc_field_end_time' + iSeqRow, iSeqRow, event) }) .bind('focus', function() { sc_calendar_overview_end_time_onfocus(this, iSeqRow, event) }); $('#id_sc_field_recurrence' + iSeqRow).bind('select2:close', function() { sc_calendar_overview_recurrence_onblur('#id_sc_field_recurrence' + iSeqRow, iSeqRow, event) }) .bind('change', function() { sc_calendar_overview_recurrence_onchange(this, iSeqRow, event) }) .bind('focus', function() { sc_calendar_overview_recurrence_onfocus(this, iSeqRow, event) }); $('#id_sc_field_period' + iSeqRow).bind('select2:close', function() { sc_calendar_overview_period_onblur('#id_sc_field_period' + iSeqRow, iSeqRow, event) }) .bind('focus', function() { sc_calendar_overview_period_onfocus(this, iSeqRow, event) }); $('#id_sc_field_category' + iSeqRow).bind('select2:close', function() { sc_calendar_overview_category_onblur('#id_sc_field_category' + iSeqRow, iSeqRow, event) }) .bind('focus', function() { sc_calendar_overview_category_onfocus(this, iSeqRow, event) }); $('#id_sc_field_id_api' + iSeqRow).bind('blur', function() { sc_calendar_overview_id_api_onblur('#id_sc_field_id_api' + iSeqRow, iSeqRow, event) }) .bind('focus', function() { sc_calendar_overview_id_api_onfocus(this, iSeqRow, event) }); $('#id_sc_field_recur_info' + iSeqRow).bind('blur', function() { sc_calendar_overview_recur_info_onblur('#id_sc_field_recur_info' + iSeqRow, iSeqRow, event) }) .bind('focus', function() { sc_calendar_overview_recur_info_onfocus(this, iSeqRow, event) }); $('#id_sc_field_event_color' + iSeqRow).bind('blur', function() { sc_calendar_overview_event_color_onblur('#id_sc_field_event_color' + iSeqRow, iSeqRow, event) }) .bind('focus', function() { sc_calendar_overview_event_color_onfocus(this, iSeqRow, event) }); $('#id_sc_field___calend_all_day__' + iSeqRow).bind('blur', function() { sc_calendar_overview___calend_all_day___onblur('#id_sc_field___calend_all_day__' + iSeqRow, iSeqRow, event) }) .bind('click', function() { sc_calendar_overview___calend_all_day___onclick(this, iSeqRow, event) }) .bind('focus', function() { sc_calendar_overview___calend_all_day___onfocus(this, iSeqRow, event) }); $('#id_sc_field_client_id' + iSeqRow).bind('blur', function() { sc_calendar_overview_client_id_onblur('#id_sc_field_client_id' + iSeqRow, iSeqRow, event) }) .bind('change', function() { sc_calendar_overview_client_id_onchange(this, iSeqRow, event) }) .bind('focus', function() { sc_calendar_overview_client_id_onfocus(this, iSeqRow, event) }); $('#id_sc_field_contact_id' + iSeqRow).bind('blur', function() { sc_calendar_overview_contact_id_onblur('#id_sc_field_contact_id' + iSeqRow, iSeqRow, event) }) .bind('change', function() { sc_calendar_overview_contact_id_onchange(this, iSeqRow, event) }) .bind('focus', function() { sc_calendar_overview_contact_id_onfocus(this, iSeqRow, event) }); $('.sc-ui-checkbox-__calend_all_day__' + iSeqRow).on('click', function() { scMarkFormAsChanged(); }); } // scJQEventsAdd Upload_Cancel = false; function sc_calendar_overview_title_onblur(oThis, iSeqRow, event) { do_ajax_calendar_overview_mob_validate_title(); scCssBlur(oThis); } function sc_calendar_overview_title_onfocus(oThis, iSeqRow, event) { scEventControl_onFocus(oThis, iSeqRow); scCssFocus(oThis); } function sc_calendar_overview_start_date_onblur(oThis, iSeqRow, event) { do_ajax_calendar_overview_mob_validate_start_date(); scCssBlur(oThis); } function sc_calendar_overview_start_date_onfocus(oThis, iSeqRow, event) { scEventControl_onFocus(oThis, iSeqRow); scCssFocus(oThis); } function sc_calendar_overview_start_time_onblur(oThis, iSeqRow, event) { do_ajax_calendar_overview_mob_validate_start_time(); scCssBlur(oThis); } function sc_calendar_overview_start_time_onfocus(oThis, iSeqRow, event) { scEventControl_onFocus(oThis, iSeqRow); scCssFocus(oThis); } function sc_calendar_overview_end_date_onblur(oThis, iSeqRow, event) { do_ajax_calendar_overview_mob_validate_end_date(); scCssBlur(oThis); } function sc_calendar_overview_end_date_onfocus(oThis, iSeqRow, event) { scEventControl_onFocus(oThis, iSeqRow); scCssFocus(oThis); } function sc_calendar_overview_end_time_onblur(oThis, iSeqRow, event) { do_ajax_calendar_overview_mob_validate_end_time(); scCssBlur(oThis); } function sc_calendar_overview_end_time_onfocus(oThis, iSeqRow, event) { scEventControl_onFocus(oThis, iSeqRow); scCssFocus(oThis); } function sc_calendar_overview_recurrence_onblur(oThis, iSeqRow, event) { do_ajax_calendar_overview_mob_validate_recurrence(); scCssBlur(oThis); } function sc_calendar_overview_recurrence_onchange(oThis, iSeqRow, event) { sc_recurrence_onchange(); } function sc_calendar_overview_recurrence_onfocus(oThis, iSeqRow, event) { scEventControl_onFocus(oThis, iSeqRow); scCssFocus(oThis); } function sc_calendar_overview_period_onblur(oThis, iSeqRow, event) { do_ajax_calendar_overview_mob_validate_period(); scCssBlur(oThis); } function sc_calendar_overview_period_onfocus(oThis, iSeqRow, event) { scEventControl_onFocus(oThis, iSeqRow); scCssFocus(oThis); } function sc_calendar_overview_category_onblur(oThis, iSeqRow, event) { do_ajax_calendar_overview_mob_validate_category(); scCssBlur(oThis); } function sc_calendar_overview_category_onfocus(oThis, iSeqRow, event) { scEventControl_onFocus(oThis, iSeqRow); scCssFocus(oThis); } function sc_calendar_overview_id_api_onblur(oThis, iSeqRow, event) { do_ajax_calendar_overview_mob_validate_id_api(); scCssBlur(oThis); } function sc_calendar_overview_id_api_onfocus(oThis, iSeqRow, event) { scEventControl_onFocus(oThis, iSeqRow); scCssFocus(oThis); } function sc_calendar_overview_recur_info_onblur(oThis, iSeqRow, event) { do_ajax_calendar_overview_mob_validate_recur_info(); scCssBlur(oThis); } function sc_calendar_overview_recur_info_onfocus(oThis, iSeqRow, event) { scEventControl_onFocus(oThis, iSeqRow); scCssFocus(oThis); } function sc_calendar_overview_event_color_onblur(oThis, iSeqRow, event) { do_ajax_calendar_overview_mob_validate_event_color(); scCssBlur(oThis); } function sc_calendar_overview_event_color_onfocus(oThis, iSeqRow, event) { scEventControl_onFocus(oThis, iSeqRow); scCssFocus(oThis); } function sc_calendar_overview___calend_all_day___onblur(oThis, iSeqRow, event) { do_ajax_calendar_overview_mob_validate___calend_all_day__(); scCssBlur(oThis); } function sc_calendar_overview___calend_all_day___onclick(oThis, iSeqRow, event) { sc___calend_all_day___onclick(); } function sc_calendar_overview___calend_all_day___onfocus(oThis, iSeqRow, event) { scEventControl_onFocus(oThis, iSeqRow); scCssFocus(oThis); } function sc_calendar_overview_client_id_onblur(oThis, iSeqRow, event) { do_ajax_calendar_overview_mob_validate_client_id(); scCssBlur(oThis); } function sc_calendar_overview_client_id_onchange(oThis, iSeqRow, event) { do_ajax_calendar_overview_mob_event_client_id_onchange(); } function sc_calendar_overview_client_id_onfocus(oThis, iSeqRow, event) { scEventControl_onFocus(oThis, iSeqRow); scCssFocus(oThis); } function sc_calendar_overview_contact_id_onblur(oThis, iSeqRow, event) { do_ajax_calendar_overview_mob_validate_contact_id(); scCssBlur(oThis); } function sc_calendar_overview_contact_id_onchange(oThis, iSeqRow, event) { do_ajax_calendar_overview_mob_event_contact_id_onchange(); } function sc_calendar_overview_contact_id_onfocus(oThis, iSeqRow, event) { scEventControl_onFocus(oThis, iSeqRow); scCssFocus(oThis); } function displayChange_block(block, status) { if ("0" == block) { displayChange_block_0(status); } if ("1" == block) { displayChange_block_1(status); } if ("2" == block) { displayChange_block_2(status); } } function displayChange_block_0(status) { displayChange_field("contact_id", "", status); displayChange_field("client_id", "", status); displayChange_field("title", "", status); displayChange_field("category", "", status); displayChange_field("id_api", "", status); displayChange_field("event_color", "", status); } function displayChange_block_1(status) { displayChange_field("start_date", "", status); displayChange_field("end_date", "", status); displayChange_field("start_time", "", status); displayChange_field("end_time", "", status); displayChange_field("__calend_all_day__", "", status); } function displayChange_block_2(status) { displayChange_field("recurrence", "", status); displayChange_field("period", "", status); displayChange_field("recur_info", "", status); } function displayChange_row(row, status) { displayChange_field_contact_id(row, status); displayChange_field_client_id(row, status); displayChange_field_title(row, status); displayChange_field_category(row, status); displayChange_field_id_api(row, status); displayChange_field_event_color(row, status); displayChange_field_start_date(row, status); displayChange_field_end_date(row, status); displayChange_field_start_time(row, status); displayChange_field_end_time(row, status); displayChange_field___calend_all_day__(row, status); displayChange_field_recurrence(row, status); displayChange_field_period(row, status); displayChange_field_recur_info(row, status); } function displayChange_field(field, row, status) { if ("contact_id" == field) { displayChange_field_contact_id(row, status); } if ("client_id" == field) { displayChange_field_client_id(row, status); } if ("title" == field) { displayChange_field_title(row, status); } if ("category" == field) { displayChange_field_category(row, status); } if ("id_api" == field) { displayChange_field_id_api(row, status); } if ("event_color" == field) { displayChange_field_event_color(row, status); } if ("start_date" == field) { displayChange_field_start_date(row, status); } if ("end_date" == field) { displayChange_field_end_date(row, status); } if ("start_time" == field) { displayChange_field_start_time(row, status); } if ("end_time" == field) { displayChange_field_end_time(row, status); } if ("__calend_all_day__" == field) { displayChange_field___calend_all_day__(row, status); } if ("recurrence" == field) { displayChange_field_recurrence(row, status); } if ("period" == field) { displayChange_field_period(row, status); } if ("recur_info" == field) { displayChange_field_recur_info(row, status); } } function displayChange_field_contact_id(row, status) { var fieldId; } function displayChange_field_client_id(row, status) { var fieldId; } function displayChange_field_title(row, status) { var fieldId; } function displayChange_field_category(row, status) { var fieldId; if ("on" == status) { Ctrl_Disabled = false; if ("all" == row) { var fieldList = $(".css_category__obj"); for (var i = 0; i < fieldList.length; i++) { $($(fieldList[i]).attr("id")).select2("destroy"); } } else { if ($('#select2-id_sc_field_category' + row + '-container').hasClass('scFormInputDisabled')) { Ctrl_Disabled = true; } $("#id_sc_field_category" + row).select2("destroy"); } scJQSelect2Add(row, "category"); if (Ctrl_Disabled) { $('#select2-id_sc_field_category' + row + '-container').addClass('scFormInputDisabled') } } } function displayChange_field_id_api(row, status) { var fieldId; } function displayChange_field_event_color(row, status) { var fieldId; } function displayChange_field_start_date(row, status) { var fieldId; } function displayChange_field_end_date(row, status) { var fieldId; } function displayChange_field_start_time(row, status) { var fieldId; } function displayChange_field_end_time(row, status) { var fieldId; } function displayChange_field___calend_all_day__(row, status) { var fieldId; } function displayChange_field_recurrence(row, status) { var fieldId; if ("on" == status) { Ctrl_Disabled = false; if ("all" == row) { var fieldList = $(".css_recurrence__obj"); for (var i = 0; i < fieldList.length; i++) { $($(fieldList[i]).attr("id")).select2("destroy"); } } else { if ($('#select2-id_sc_field_recurrence' + row + '-container').hasClass('scFormInputDisabled')) { Ctrl_Disabled = true; } $("#id_sc_field_recurrence" + row).select2("destroy"); } scJQSelect2Add(row, "recurrence"); if (Ctrl_Disabled) { $('#select2-id_sc_field_recurrence' + row + '-container').addClass('scFormInputDisabled') } } } function displayChange_field_period(row, status) { var fieldId; if ("on" == status) { Ctrl_Disabled = false; if ("all" == row) { var fieldList = $(".css_period__obj"); for (var i = 0; i < fieldList.length; i++) { $($(fieldList[i]).attr("id")).select2("destroy"); } } else { if ($('#select2-id_sc_field_period' + row + '-container').hasClass('scFormInputDisabled')) { Ctrl_Disabled = true; } $("#id_sc_field_period" + row).select2("destroy"); } scJQSelect2Add(row, "period"); if (Ctrl_Disabled) { $('#select2-id_sc_field_period' + row + '-container').addClass('scFormInputDisabled') } } } function displayChange_field_recur_info(row, status) { var fieldId; } function scRecreateSelect2() { displayChange_field_category("all", "on"); displayChange_field_recurrence("all", "on"); displayChange_field_period("all", "on"); } function scResetPagesDisplay() { $(".sc-form-page").show(); } function scHidePage(pageNo) { $("#id_calendar_overview_mob_form" + pageNo).hide(); } function scCheckNoPageSelected() { if (!$(".sc-form-page").filter(".scTabActive").filter(":visible").length) { var inactiveTabs = $(".sc-form-page").filter(".scTabInactive").filter(":visible"); if (inactiveTabs.length) { var tabNo = $(inactiveTabs[0]).attr("id").substr(32); } } } $(function() { $("#id_sc_field_period").on("change", function() { scCalendarPeriodChange(); }); scCalendarPeriodChange(); }); function scCalendarPeriodChange() { var selectedPeriod = $("#id_sc_field_period").val(); if ("D" == selectedPeriod) { $("#id_rinf_repeatin_recur_info").hide(); $("#id_rinf_repeat_label_recur_info").html("