src/hg/js/hgGateway.js 1.3
1.3 2010/03/10 00:19:06 larrym
support "type/paste gene name and click submit without choosing from autosuggest list"
Index: src/hg/js/hgGateway.js
===================================================================
RCS file: /projects/compbio/cvsroot/kent/src/hg/js/hgGateway.js,v
retrieving revision 1.2
retrieving revision 1.3
diff -b -B -U 4 -r1.2 -r1.3
--- src/hg/js/hgGateway.js 24 Feb 2010 22:10:04 -0000 1.2
+++ src/hg/js/hgGateway.js 10 Mar 2010 00:19:06 -0000 1.3
@@ -10,4 +10,22 @@
document.mainForm.position.value = obj.id;
}
});
});
+
+function submitButtonOnClick()
+{
+// onClick handler for the "submit" button.
+// Handles situation where user types a gene name into the gene box and immediately hits the submit button,
+// expecting the browser to jump to that gene.
+ var gene = $('#suggest').val();
+ var db = $('input[name=db]').val();
+ if(gene && gene.length > 0) {
+ var pos = lookupGene(db, gene);
+ if(!pos) {
+ // turn this into a full text search.
+ pos = gene;
+ }
+ $('input[name=position]').val(pos);
+ }
+ return true;
+}