diff --git a/client/app/controllers/tableController.js b/client/app/controllers/tableController.js index e55f2aac..56e6174e 100644 --- a/client/app/controllers/tableController.js +++ b/client/app/controllers/tableController.js @@ -1,4 +1,4 @@ -define(['jquery', 'Handsontable', 'table_template', 'filesaver', 'alertify', 'qtip'], function ($, Handsontable, table_template, filesaver, alertify) { +define(['jquery','controllers/usabilityController', 'Handsontable', 'table_template', 'filesaver', 'alertify', 'qtip'], function ($, usabilityController, Handsontable, table_template, filesaver, alertify) { 'use strict'; @@ -567,11 +567,13 @@ define(['jquery', 'Handsontable', 'table_template', 'filesaver', 'alertify', 'qt beforeChange: function (changes, source) { return !(this.readOnly); }, - afterSetDataAtCell: function (changes, source) { - //update_width(this); - }, - afterChange: function (row, column) { - //update_width(this); + afterSetDataAtCell: function (changes) { + var cellInput = changes[0][3]; + if (cellInput === '') { + usabilityController.addValidationError('EMPTY_CELL'); + } else if (isNaN(parseInt(cellInput))) { + usabilityController.addValidationError('INVALID_CELL'); + } } }; diff --git a/client/app/controllers/usabilityController.js b/client/app/controllers/usabilityController.js index bfac60ad..83fe672b 100644 --- a/client/app/controllers/usabilityController.js +++ b/client/app/controllers/usabilityController.js @@ -79,6 +79,10 @@ define(['table_template'], function (table_template) { } function addValidationError(err) { + + if (analytics.validation_errors[err] === undefined) { + return; + } analytics.validation_errors[err] += 1; } diff --git a/client/app/data/pacesetters.js b/client/app/data/pacesetters.js index 3008be2e..f746e157 100644 --- a/client/app/data/pacesetters.js +++ b/client/app/data/pacesetters.js @@ -221,8 +221,8 @@ define([], function () { 'GENERIC_TABLE_ERR', 'SERVER_ERR', 'GENERIC_SUBMISSION_ERR', - 'NAN_EMPTY_CELLS', - 'SEMANTIC_CELLS', + 'EMPTY_CELL', + 'INVALID_CELL', 'CELL_ERROR' ] }