aboutsummaryrefslogtreecommitdiff
path: root/wqflask
diff options
context:
space:
mode:
Diffstat (limited to 'wqflask')
-rw-r--r--wqflask/wqflask/static/new/javascript/validation.coffee15
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