cef4ec8869e96456661e41f17a2b68b0a73fe0e9
chmalee
  Thu Feb 26 13:45:31 2026 -0800
Warn user they have no tracks selected in download dialog, refs #36802

diff --git src/hg/js/hgTracks.js src/hg/js/hgTracks.js
index ead861ccdc1..435d1d773af 100644
--- src/hg/js/hgTracks.js
+++ src/hg/js/hgTracks.js
@@ -5746,30 +5746,34 @@
                 downloadCurrentTrackData.downloadData = {};
             }
         }
     },
 
     startDownload: function() {
         trackList = [];
         $(".downloadTrackName:checked").each(function(i, elem) {
             trackName = elem.id;
             if (getDb().startsWith("hub_")) {
                 // when we are working with assembly hubs, we undecorate the name
                 trackName = undecoratedTrack(elem.id);
             }
             trackList.push(trackName);
         });
+        if (trackList.length == 0) {
+            alert("At least one track must be selected");
+            return;
+        }
         chrom = hgTracks.chromName;
         start = hgTracks.winStart;
         end = hgTracks.winEnd;
         db = getDb();
         apiUrl = "../cgi-bin/hubApi/getData/track?";
         apiUrl += "chrom=" + chrom;
         apiUrl += ";start=" + start;
         apiUrl += ";end=" + end;
         apiUrl += ";genome=" + db;
         apiUrl += ";jsonOutputArrays=1";
         apiUrl += ";track=" + trackList.join(',');
         var xmlhttp = new XMLHttpRequest();
         downloadCurrentTrackData.currentRequests[apiUrl] = true;
         xmlhttp.onreadystatechange = function() {
             if (4 === this.readyState && 200 === this.status) {