about summary refs log tree commit diff
diff options
context:
space:
mode:
authorFrederick Muriuki Muriithi2025-01-15 16:57:12 -0600
committerFrederick Muriuki Muriithi2025-01-15 16:58:41 -0600
commit3bd420a976ddb54d9e0bacbe49f88950c1b8e7dd (patch)
tree17b1af0af287c61bc97e0ef3494be8f31d35c837
parenteabd73ccb930d19cdb29fb6677e0cde0490f36ad (diff)
downloadgn-uploader-3bd420a976ddb54d9e0bacbe49f88950c1b8e7dd.tar.gz
Only create the necessary objects.
Some of the file input elements might not exist in the form,
therefore, only show uploader for those that do.
-rw-r--r--uploader/templates/phenotypes/add-phenotypes-raw-files.html7
1 files changed, 6 insertions, 1 deletions
diff --git a/uploader/templates/phenotypes/add-phenotypes-raw-files.html b/uploader/templates/phenotypes/add-phenotypes-raw-files.html
index 15c2da8..103500a 100644
--- a/uploader/templates/phenotypes/add-phenotypes-raw-files.html
+++ b/uploader/templates/phenotypes/add-phenotypes-raw-files.html
@@ -590,6 +590,9 @@
       var the_form = $("#" + form_id);
       var file_input = $("#" + file_input_id);
       var submit_button = the_form.find("input[type=submit]");
+      if(file_input.length != 1) {
+          return false;
+      }
       var r = errorHandler(
           fileSuccessHandler(
               uploadStartHandler(
@@ -630,13 +633,15 @@
       return r;
   };
 
-  resumables = [
+  var resumables = [
       ["frm-add-phenotypes", "finput-phenotype-descriptions", "resumable-phenotype-descriptions", "tbl-preview-pheno-desc"],
       ["frm-add-phenotypes", "finput-phenotype-data", "resumable-phenotype-data", "tbl-preview-pheno-data"],
       ["frm-add-phenotypes", "finput-phenotype-se", "resumable-phenotype-se", "tbl-preview-pheno-se"],
       ["frm-add-phenotypes", "finput-phenotype-n", "resumable-phenotype-n", "tbl-preview-pheno-n"],
   ].map((row) => {
       return makeResumableObject(row[0], row[1], row[2], row[3]);
+  }).filter((val) => {
+      return Boolean(val);
   });
 
   $("#frm-add-phenotypes input[type=submit]").on("click", (event) => {