d93220dc80a6f12eb516471427167283b20ccecd angie Wed May 31 14:40:58 2017 -0700 Don't name buttons "submit" when we're going to invoke the function document.formName.submit() because document.formName.submit will point to the button instead of the function. refs #18305 note-47 diff --git src/hg/lib/vcfUi.c src/hg/lib/vcfUi.c index 0ef5dde..fb656be 100644 --- src/hg/lib/vcfUi.c +++ src/hg/lib/vcfUi.c @@ -51,82 +51,82 @@ printf("\n"); if (isNotEmpty(thisChrom)) { // but we do have a candidate, so offer to make it the center: puts("\n"); } else printf("\n"); } else { // Describe the one specified in cart. int centerPos = cartUsualIntClosestToHome(cart, tdb, parentLevel, "centerVariantPos", -1); char *centerName = cartStringClosestToHome(cart, tdb, parentLevel, "centerVariantName"); if (isNotEmpty(thisChrom)) { // These form inputs are for either "use me" or clear: vcfCfgHaplotypeCenterHiddens(track, thisName, thisChrom, thisPos); // Is this variant the same as the center variant specified in cart? if (sameString(thisChrom, centerChrom) && sameString(thisName, centerName) && thisPos == centerPos) printf("this variant as anchor.\n"); else { // make a "use me" button printf("%s at %s:%d as anchor.\n\n"); } } else { // Form inputs (in case the clear button is clicked) vcfCfgHaplotypeCenterHiddens(track, centerName, centerChrom, centerPos); printf("%s at %s:%d as anchor.\n", nameOrDefault(centerName, "variant"), centerChrom, centerPos+1); } // Make a clear button that modifies the hiddens using onClick puts("\n"); } puts("
" "Haplotype sorting order: using "); char *centerChrom = cartOptionalStringClosestToHome(cart, tdb, parentLevel, "centerVariantChrom"); if (isEmpty(centerChrom)) { // Unspecified in cart -- describe the default action printf(VCF_HAPLOSORT_DEFAULT_DESC " as anchor.
"); vcfCfgHaplotypeCenterHiddens(track, thisName, thisChrom, thisPos); char label[256]; safef(label, sizeof(label), "Use %s", nameOrDefault(thisName, "this variant")); - cgiMakeButton("submit", label); + cgiMakeButton("setCenterSubmit", label); printf(" as anchor
To anchor the sorting to a particular variant, " "click on the variant in the genome browser, " "and then click on the 'Use this variant' button on the next page." "
\n", nameOrDefault(centerName, "variant"), centerChrom, centerPos+1); char label[256]; safef(label, sizeof(label), "Use %s", nameOrDefault(thisName, "this variant")); - cgiMakeButton("submit", label); + cgiMakeButton("replaceCenterSubmit", label); printf(" as anchor
"); struct dyString *onClick = dyStringNew(0); dyStringPrintf(onClick, "updateOrMakeNamedVariable(%s, '%s.centerVariantChrom', ''); ", formName, track); dyStringPrintf(onClick, "updateOrMakeNamedVariable(%s, '%s.centerVariantName', ''); ", formName, track); dyStringPrintf(onClick, "updateOrMakeNamedVariable(%s, '%s.centerVariantPos', 0);", formName, track); dyStringPrintf(onClick, "document.%s.submit(); return false;", formName); - cgiMakeButtonWithOnClick("submit", "Clear selection", NULL, onClick->string); + cgiMakeButtonWithOnClick("clearCenterSubmit", "Clear selection", NULL, onClick->string); printf(" (use " VCF_HAPLOSORT_DEFAULT_DESC ")
"); } } //TODO: share this code w/hgTracks, hgc in hg/lib/vcfFile.c static struct vcfFile *vcfHopefullyOpenHeader(struct cart *cart, struct trackDb *tdb) /* Defend against network errors and return the vcfFile object with header data, or NULL. */ { knetUdcInstall(); if (udcCacheTimeout() < 300) udcSetCacheTimeout(300); char *db = cartString(cart, "db"); char *table = tdb->table;