diff options
author | Zachary Sloan | 2012-10-10 17:45:25 -0500 |
---|---|---|
committer | Zachary Sloan | 2012-10-10 17:45:25 -0500 |
commit | af76cb26cba75684928fb817f9486883fad11eb9 (patch) | |
tree | 60f976a3ae8884ed63bc0048d6a047f9a277af18 /wqflask | |
parent | f10e832037fabc718eb24d12c01c6dacd77967b7 (diff) | |
download | genenetwork2-af76cb26cba75684928fb817f9486883fad11eb9.tar.gz |
Finished the remove samples by index validation
Diffstat (limited to 'wqflask')
-rw-r--r-- | wqflask/wqflask/static/new/javascript/validation.coffee | 15 |
1 files changed, 10 insertions, 5 deletions
diff --git a/wqflask/wqflask/static/new/javascript/validation.coffee b/wqflask/wqflask/static/new/javascript/validation.coffee index a2036c1d..f28e9bd7 100644 --- a/wqflask/wqflask/static/new/javascript/validation.coffee +++ b/wqflask/wqflask/static/new/javascript/validation.coffee @@ -1,18 +1,23 @@ $ -> remove_samples_is_valid = (input)-> + #Validate if input is empty or just white spaces + if _.trim(input).length == 0 + return true splats = input.split(",") new_splats = (_.trim(input) for input in splats) console.log("new_splats:", new_splats) - pattern = /^\d+\s*(?:-\s*\d+)?\s*$/ + pattern = /^\d+\s*(?:-\s*\d+)?\s*$/ #Pattern like 3, 10-15, 24 for splat in new_splats console.log("splat is:", splat) if not splat.match(pattern) return false return true - - + validate_remove_samples = -> + ### + Check if input for the remove samples function is valid and notify the user if not + ### input = $('#remove_samples_field').val() console.log("input is:", input) if remove_samples_is_valid(input) @@ -21,6 +26,6 @@ $ -> else console.log("input isn't valid") $('#remove_samples_invalid').show() - - + + $('#remove_samples_field').change(validate_remove_samples)
\ No newline at end of file |