b8441cbcbe608abd3fa526418f79c9d3f9cbc38c
chmalee
  Thu Sep 17 11:02:37 2026 -0700
Make hgCustom genome search box selection re-submit the form so you land on the management page if you already had custom tracks on the newly selected assemlby, refs #38372

diff --git src/hg/hgCustom/hgCustom.c src/hg/hgCustom/hgCustom.c
index 5b01d71963f..d1d422fbc89 100644
--- src/hg/hgCustom/hgCustom.c
+++ src/hg/hgCustom/hgCustom.c
@@ -203,31 +203,45 @@
     {
     /* Print genome search bar and selected genome label */
     puts("<TABLE id=\"genome-selection-table\" BORDER=0>\n");
     printf("<tr>\n");
     printf("<td class='searchCell' align=center>\n");
     // hgCustom requires this <input> be created to go along with form submission, we
     // will change it when a genome is selected in the search bar
     printf("<input name='db' value='%s' type='hidden'></input>\n", database);
     jsIncludeAutoCompleteLibs();
     char *searchBarId = "genomeSearch";
     printGenomeSearchBar(searchBarId, "Search any species, genome or assembly name", NULL, TRUE, "Change selected genome:", NULL);
     jsInlineF(
         "setupGenomeSearchBar({\n"
         "    inputId: '%s',\n"
         "    onSelect: function(item) {\n"
-        "        document.mainForm.db.value = item.genome;\n"
+        "        let db = dbFromRecentItem(item);\n"
+        "        if (item.hubUrl) {\n"
+        "            let hubUrlInp = document.createElement(\"input\");\n"
+        "            hubUrlInp.name = \"hubUrl\";\n"
+        "            hubUrlInp.type = \"hidden\";\n"
+        "            hubUrlInp.value = item.hubUrl;\n"
+        "            let genomeInp = document.createElement(\"input\");\n"
+        "            genomeInp.name = \"genome\";\n"
+        "            genomeInp.type = \"hidden\";\n"
+        "            genomeInp.value = item.genome;\n"
+        "            document.mainForm.appendChild(genomeInp);\n"
+        "            document.mainForm.appendChild(hubUrlInp);\n"
+        "        }\n"
+        "        document.mainForm.db.value = db;\n"
+        "        document.mainForm.submit();\n"
         "    }\n"
         "});\n"
         , searchBarId
     );
     printf("</td>\n");
     printf("<td class='searchCell' align=center>\n");
     char *dbLabel = getCurrentGenomeLabel(database);
     printf("Current Genome: <span id='genomeLabel'>%s</span>\n", dbLabel);
     printf("</td>\n");
     puts("</TR></TABLE>\n");
     }
 
 /* intro text */
 puts("<P>");
 if (isUpdateForm)