From 4c99baf725bd9c60534856513e1ed350f3b8657f Mon Sep 17 00:00:00 2001
From: Isaac Connor <isaac@zoneminder.com>
Date: Sat, 22 May 2021 13:59:10 -0400
Subject: [PATCH] Use data-onclick instead of data-on-click-this.  Load form by
 id instead of passed in element.  Fixes #3250

---
 web/skins/classic/views/js/export.js | 12 ++++++++----
 1 file changed, 8 insertions(+), 4 deletions(-)

diff --git a/web/skins/classic/views/js/export.js b/web/skins/classic/views/js/export.js
index 5cad88629..b947c8b40 100644
--- a/web/skins/classic/views/js/export.js
+++ b/web/skins/classic/views/js/export.js
@@ -1,11 +1,15 @@
 var exportTimer = null;
 
-function configureExportButton(element) {
-  var form = element.form;
+function configureExportButton() {
+  var form = $j('#contentForm')[0];
+  if (!form) {
+    console.error("Form contentForm not found by jquery.");
+    return;
+  }
 
   var eventCount = 0;
   document.querySelectorAll('input[name="eids[]"]').forEach(function(el) {
-    if ( el.checked ) {
+    if (el.checked) {
       eventCount ++;
     }
   });
@@ -93,7 +97,7 @@ function getEventDetailModal(eid) {
 }
 
 function initPage() {
-  configureExportButton(this);
+  configureExportButton();
   if ( exportReady ) {
     setTimeout(startDownload, 1500, exportFile);
   }