From a19b78dbca78b4f8d88461cfee7cf07277d3ae23 Mon Sep 17 00:00:00 2001 From: lucyq Date: Thu, 26 Oct 2017 13:47:35 -0400 Subject: [PATCH] checks for new participant number between 1 and 100 --- client/app/views/trackView.js | 15 +++++++++++++-- client/track.html | 11 +++++++++-- 2 files changed, 22 insertions(+), 4 deletions(-) diff --git a/client/app/views/trackView.js b/client/app/views/trackView.js index 49d85ecf..c17c2c46 100644 --- a/client/app/views/trackView.js +++ b/client/app/views/trackView.js @@ -1,4 +1,4 @@ -define(['jquery', 'controllers/analystController', 'Ladda', 'bootstrap'], function ($, analystController, Ladda) { +define(['jquery', 'controllers/analystController', 'Ladda', 'alertify', 'bootstrap'], function ($, analystController, Ladda, alertify) { function trackView() { @@ -104,14 +104,25 @@ define(['jquery', 'controllers/analystController', 'Ladda', 'bootstrap'], functi } + + + + // Generate new participation links $('#participants-submit').on('click', function (e) { e.preventDefault(); + var pc = parseInt($('#participants-count').val()); + + if (pc < 1.0 || pc > 100.00) { + alertify.alert('ErrorError!', "Please enter a valid number between 1 and 100"); + return; + } + var la = Ladda.create(document.getElementById('participants-submit')); la.start(); - analystController.generateUrls(session, password, $('#participants-count').val()) + analystController.generateUrls(session, password, pc) .then(function (urls) { var $newParticipants = $('#participants-new'); if ($newParticipants.html() !== '') { diff --git a/client/track.html b/client/track.html index 72189144..1f40a5ed 100644 --- a/client/track.html +++ b/client/track.html @@ -13,6 +13,13 @@ + + + + + @@ -111,8 +118,8 @@

Add participants

- +