[TikiWiki-commits] [Git][tikiwiki/tiki][master] [FIX] calendar: Only attach event listener if the element is there in calendar plugin

"Jonny Bradley \(@jonnybradley\) via TikiWiki-cvs" <[email protected]>
Newsgroups gmane.comp.cms.tiki.cvs
Message-ID <698a2b581ec79_3b184c3c8418c@gitlab-sidekiq-low-urgency-cpu-bound-v2-5cbd64784f-gxp5w.mail>

Jonny Bradley pushed to branch master at Tiki Wiki CMS Groupware / Tiki


Commits:
79a76304 by Jonny Bradley at 2026-02-09T18:35:55+00:00
[FIX] calendar: Only attach event listener if the element is there in calendar plugin
---
* [FIX] calendar: Only attach event listener if the element is there in calendar plugin
(p.s. looks like you can only have one of these plugins per page - FIXME please?)

See merge request tikiwiki/tiki!9527

- - - - -


1 changed file:

- templates/wiki-plugins/wikiplugin_calendar.tpl


Changes:

=====================================
templates/wiki-plugins/wikiplugin_calendar.tpl
=====================================
@@ -15,11 +15,13 @@
             let returnUrlForPlugin = ('{{$returnURL}}');
             returnUrlForPlugin = returnUrlForPlugin.toString();
             $("#plugin-calendar").setupEventCalendar(content,  wikipluginCalendar, 'plugin-calendar', 'tiki-ajax_services.php?controller=calendar&action=list_items&calIds={{$pluginCalendarIds}}', returnUrlForPlugin);
-            elt.addEventListener('change', () => {
-                document.getElementById('plugin-calendar').innerHTML = "";
-                content['initialDate'] = $('#date-plugin-calendar').val();
-                $("#plugin-calendar").setupEventCalendar(content,  wikipluginCalendar, 'plugin-calendar', 'tiki-ajax_services.php?controller=calendar&action=list_items&calIds={{$pluginCalendarIds}}', returnUrlForPlugin);
-            })
+            if (elt) {
+                elt.addEventListener('change', () => {
+                    document.getElementById('plugin-calendar').innerHTML = "";
+                    content['initialDate'] = $('#date-plugin-calendar').val();
+                    $("#plugin-calendar").setupEventCalendar(content,  wikipluginCalendar, 'plugin-calendar', 'tiki-ajax_services.php?controller=calendar&action=list_items&calIds={{$pluginCalendarIds}}', returnUrlForPlugin);
+                });
+            }
             {{if $prefs.print_pdf_from_url neq 'none'}$("#plugin-calendar").addEventCalendarPrint('#calendar-pdf-btn', wikipluginCalendar[0]);{/if}}
         {/jq}
     {/if}



View it on GitLab: https://gitlab.com/tikiwiki/tiki/-/commit/79a763046c52b85dc990953d12805acfef13c992

-- 
View it on GitLab: https://gitlab.com/tikiwiki/tiki/-/commit/79a763046c52b85dc990953d12805acfef13c992
You're receiving this email because of your account on gitlab.com.

_______________________________________________
TikiWiki-cvs mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/tikiwiki-cvs
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.