From 3bd420a976ddb54d9e0bacbe49f88950c1b8e7dd Mon Sep 17 00:00:00 2001 From: Frederick Muriuki Muriithi Date: Wed, 15 Jan 2025 16:57:12 -0600 Subject: 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. --- uploader/templates/phenotypes/add-phenotypes-raw-files.html | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) (limited to 'uploader/templates/phenotypes/add-phenotypes-raw-files.html') 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) => { -- cgit v1.2.3