9 print form for adding a single phenotype to a stock
13 Naama Menda <nm249@cornell.edu>
23 =item trait_ontology_db_name
24 the default db name for the server trait ontology
35 $trait_ontology_db_name
36 $uri => "/ajax/cvterm/autocomplete"
41 <& /util/import_javascript.mas, classes => [ 'jqueryui' ] &>
43 <script language="javascript">
48 //function test(message) {
53 jQuery("#trait_ontology_name").autocomplete({
54 source: '<% $uri %>' + '?db_name=' + '<% $trait_ontology_db_name %>'
58 function associate_phenotype() {
59 var trait = jQuery("#trait_ontology_name").val();
60 if (!trait) { alert("Must choose a trait name!"); return; }
61 var stock_id = '<% $stock_id %>';
62 var phenotype_value = jQuery("#phenotye_value").val();
64 url: '/ajax/stock/add_phenotype',
68 data: { 'stock_id' : stock_id, 'trait': trait, 'phenotype_value': phenotype_value },
69 //error: function(response) { alert("An error occurred. Please try again later!"+response); },
70 //parseerror: function(response) { alert("A parse error occurred. Please try again."+response); },
71 success: function(response) {
72 if (response.error) { alert(response.error); }
74 alert("The phenotype has been added. ["+response.error+"]");
75 //jQuery("#add_phenotype_form").dialog("close");
76 document.location.reload(); // reload the entire page, might be faster then rendering phenotype section with AJAX
84 <div id="add_phenotype_form">
85 <div id="phenotype_add">
86 <form name = "add_phenotype" >
87 <b>Trait name</b><input type="text" id="trait_ontology_name" name="trait_ontology_name" />
88 <b>Value</b> <input type="text" id="phenotype_value" />
89 <input type="hidden" id="stock_id" name="stock_id" value="<% $stock_id %>" />
90 <input type="button" name="associate_phenotype_button" id="associate_phenotype_button" value="Submit" onclick="javascript:associate_phenotype()" />