diff options
author | Zachary Sloan | 2012-10-10 15:50:16 -0500 |
---|---|---|
committer | Zachary Sloan | 2012-10-10 15:50:16 -0500 |
commit | 1c6fd4dea9a4650966ae1b902897fb75a67d287c (patch) | |
tree | 870feca87bacd1677d1e4e1038568f428b25dde0 /wqflask | |
parent | 8c91843b58e7534ea0070357ca53e28d6beb84d2 (diff) | |
download | genenetwork2-1c6fd4dea9a4650966ae1b902897fb75a67d287c.tar.gz |
Got a rudimentary version of the validation code for block samples by index completed
Diffstat (limited to 'wqflask')
-rw-r--r-- | wqflask/wqflask/static/new/javascript/show_trait.coffee | 31 | ||||
-rw-r--r-- | wqflask/wqflask/static/new/javascript/show_trait.js | 14 | ||||
-rw-r--r-- | wqflask/wqflask/static/new/javascript/validation.coffee | 19 | ||||
-rw-r--r-- | wqflask/wqflask/templates/base.html | 6 | ||||
-rw-r--r-- | wqflask/wqflask/templates/show_trait.html | 13 |
5 files changed, 33 insertions, 50 deletions
diff --git a/wqflask/wqflask/static/new/javascript/show_trait.coffee b/wqflask/wqflask/static/new/javascript/show_trait.coffee index 9498a1bb..a22a3beb 100644 --- a/wqflask/wqflask/static/new/javascript/show_trait.coffee +++ b/wqflask/wqflask/static/new/javascript/show_trait.coffee @@ -9,7 +9,7 @@ $ -> for x in [start..10] $("#stats_tabs" + x).hide() - hide_tabs(1) + #hide_tabs(1) # Changes stats table between all, bxd only and non-bxd, etc. stats_mdp_change = -> @@ -17,7 +17,7 @@ $ -> hide_tabs(0) $("#stats_tabs" + selected).show() - $(".stats_mdp").change(stats_mdp_change) + #$(".stats_mdp").change(stats_mdp_change) change_stats_value = (sample_sets, category, value_type, decimal_places)-> id = "#" + process_id(category, value_type) @@ -238,33 +238,6 @@ $ -> $('#Other_'+index.toString()).find('.trait_value_input').val("x") $('#block_by_index').click(block_by_index) - - #validate_block_index = -> - # $('#remove_samples_field').valid( - # rules: - # field: - # required: true - # number: true - # messages: - # field: - # "Please check that your input is valid." - # ) - - $('#trait_data_form').validate() - - $('#remove_samples_field').valid( - rules: - field: - required: true - number: true - messages: - field: - "Please check that your input is valid." - ) - - #$('#remove_samples_field').change(validate_block_index) - - ##End Block Samples By Index Code diff --git a/wqflask/wqflask/static/new/javascript/show_trait.js b/wqflask/wqflask/static/new/javascript/show_trait.js index 5704e183..d6c5226f 100644 --- a/wqflask/wqflask/static/new/javascript/show_trait.js +++ b/wqflask/wqflask/static/new/javascript/show_trait.js @@ -20,14 +20,12 @@ } return _results; }; - hide_tabs(1); stats_mdp_change = function() { var selected; selected = $(this).val(); hide_tabs(0); return $("#stats_tabs" + selected).show(); }; - $(".stats_mdp").change(stats_mdp_change); change_stats_value = function(sample_sets, category, value_type, decimal_places) { var current_value, id, in_box, the_value; id = "#" + process_id(category, value_type); @@ -281,18 +279,6 @@ return _results; }; $('#block_by_index').click(block_by_index); - $('#trait_data_form').validate(); - $('#remove_samples_field').valid({ - rules: { - field: { - required: true, - number: true - } - }, - messages: { - field: "Please check that your input is valid." - } - }); hide_no_value = function() { var _this = this; return $('.value_se').each(function(index, element) { diff --git a/wqflask/wqflask/static/new/javascript/validation.coffee b/wqflask/wqflask/static/new/javascript/validation.coffee new file mode 100644 index 00000000..f389254e --- /dev/null +++ b/wqflask/wqflask/static/new/javascript/validation.coffee @@ -0,0 +1,19 @@ +$ -> + + remove_samples_is_valid = (input)-> + return $.isNumeric(input) + + #invalidate_block_by_index = -> + # $('#remove_samples_invalid').show() + + validate_remove_samples = -> + input = $('#remove_samples_field').val() + console.log("input is:", input) + $('#remove_samples_invalid').hide() + if remove_samples_is_valid(input) + console.log("input is valid") + else + console.log("input isn't valid") + $('#remove_samples_invalid').show() + + $('#remove_samples_field').change(validate_remove_samples)
\ No newline at end of file diff --git a/wqflask/wqflask/templates/base.html b/wqflask/wqflask/templates/base.html index 2e30b1b2..f52041b1 100644 --- a/wqflask/wqflask/templates/base.html +++ b/wqflask/wqflask/templates/base.html @@ -12,22 +12,22 @@ <META NAME="geo.region" CONTENT="US-TN"> <!--<LINK REL="stylesheet" TYPE="text/css" HREF='/css/general_flask.css'>--> + <LINK REL="stylesheet" TYPE="text/css" HREF='http://ajax.googleapis.com/ajax/libs/jqueryui/1.8/themes/base/jquery-ui.css'> <LINK REL="stylesheet" TYPE="text/css" HREF='/css/menu.css'> <link rel="stylesheet" media="all" type="text/css" href="/css/tabbed_pages.css" /> - <link rel="stylesheet" media="all" type="text/css" href="/static/new/css/table.css" /> + <link rel="stylesheet" media="all" type="text/css" href="/static/new/css/table.css" /> <LINK REL="apple-touch-icon" href="/images/ipad_icon3.png" /> - <link type="text/css" href='/css/custom-theme/jquery-ui-1.8.12.custom.css' rel='Stylesheet' /> <link type="text/css" href='/css/tab_style.css' rel='Stylesheet' /> <link REL="stylesheet" TYPE="text/css" href="/static/packages/bootstrap/css/bootstrap.min.css" /> <script src="https://ajax.googleapis.com/ajax/libs/jquery/1.8.2/jquery.min.js"></script> + <script src="//ajax.googleapis.com/ajax/libs/jqueryui/1.8/jquery-ui.min.js"></script> <script src="/static/packages/bootstrap/js/bootstrap.min.js"></script> <SCRIPT SRC="/javascript/webqtl.js"></SCRIPT> <SCRIPT SRC="/javascript/dhtml.js"></SCRIPT> <SCRIPT SRC="/javascript/tablesorter.js"></SCRIPT> <!--<SCRIPT SRC="/javascript/jqueryFunction.js"></SCRIPT>--> <script src="/javascript/tabbed_pages.js" type="text/javascript"></script> - <script src="/javascript/jquery-ui-1.8.12.custom.min.js" type="text/javascript"></script> <script type="text/javascript"> diff --git a/wqflask/wqflask/templates/show_trait.html b/wqflask/wqflask/templates/show_trait.html index 61d6275b..af7e555c 100644 --- a/wqflask/wqflask/templates/show_trait.html +++ b/wqflask/wqflask/templates/show_trait.html @@ -255,7 +255,7 @@ <script language="Javascript" type="text/javascript"> <!-- - $(function() { $("#stats_tabs0").tabs(); $("#stats_tabs1").tabs(); $("#stats_tabs2").tabs();}); + //$(function() { $("#stats_tabs0").tabs(); $("#stats_tabs1").tabs(); $("#stats_tabs2").tabs();}); //--> </script> @@ -817,7 +817,7 @@ <p id="sectionbody4"></p><script language="Javascript" type="text/javascript"> <!-- - $(function() { $("#mapping_tabs").tabs(); }); + //$(function() { $("#mapping_tabs").tabs(); }); //--> </script> @@ -1214,8 +1214,12 @@ <div style= "border: 3px solid #EEEEEE; -moz-border-radius: 10px; -webkit-border-radius: 10px; width: 625px; padding: 5px 5px 10px 8px; font-size: 12px; background: #DDDDDD;"> <span id="showHideOptions" style="line-height:225%;"><strong> Block samples by index: </strong> - <input type="text" id="remove_samples_field" style= - "background-color:white;border: 1px solid black;font-size: 14px;"> + <input type="text" id="remove_samples_field" + style="background-color:white;border: 1px solid black;font-size: 14px;"> + <div id="remove_samples_invalid" style="display:none;"> + Please check that your input is formatted correctly + </div> + <span id="blockMenuSpan"> <select id="block_group" size="1"> <option value="primary"> @@ -1367,6 +1371,7 @@ <script type="text/javascript" src="/static/new/javascript/stats.js"></script> <script type="text/javascript" src="/static/new/javascript/show_trait.js"></script> + <script type="text/javascript" src="/static/new/javascript/validation.js"></script> <!-- End of body --> |