From: Coleman Watts Date: Sat, 25 Apr 2015 18:16:28 +0000 (-0600) Subject: CRM-16275 - Workaround for race conditions X-Git-Url: https://vcs.fsf.org/?a=commitdiff_plain;h=6af6e28c2c0d07d6c6793fb8f20e4d8a0098ab62;p=civicrm-core.git CRM-16275 - Workaround for race conditions --- diff --git a/templates/CRM/Event/Form/Search/Common.tpl b/templates/CRM/Event/Form/Search/Common.tpl index 8e1208f803..fa72a9f4f5 100644 --- a/templates/CRM/Event/Form/Search/Common.tpl +++ b/templates/CRM/Event/Form/Search/Common.tpl @@ -88,13 +88,11 @@ CRM.$(function($) { function toggleRecurrigCheckbox() { var isRepeating = false; if ($(this).val()) { - // In case select2 widget hasn't been initialized yet, we have to get the data from the dom - // FIXME: waiting for select2 initialization would be better, but not sure how - if ($(this).data('select2')) { - isRepeating = $(this).select2('data').extra.is_recur; - } else { - isRepeating = $(this).data('entityValue')[0].extra.is_recur; + // Workaround: In some cases this code gets called before the select2 initialization. + if (!$(this).data('select2')) { + $(this).crmEntityRef(); } + isRepeating = $(this).select2('data').extra.is_recur; } if (isRepeating) { $('.crm-event-form-block-event_include_repeating_events').show();