diff --git a/app/assets/javascripts/protocols/steps.js.erb b/app/assets/javascripts/protocols/steps.js.erb index 26f282996..0ad08a5ee 100644 --- a/app/assets/javascripts/protocols/steps.js.erb +++ b/app/assets/javascripts/protocols/steps.js.erb @@ -545,11 +545,29 @@ var $tinyMCEInput = TinyMCE.getContent(); var descriptionValid = textValidator(ev, $descrTextarea, 0, <%= Constants::TEXT_MAX_LENGTH %>, false, $tinyMCEInput); - + var tableNamesValidArray = []; + // iterate over table titles and validate their length + $form.find(".table_name").each(function(index , tableName) { + if (tableName.value.length > 0) { + tableNamesValidArray[index] = textValidator(ev, tableName, 1, + <%= Constants::NAME_MAX_LENGTH %> ); + } else { + tableNamesValidArray[index] = true; + } + }); + var tableNamesValid = true; + // passes if all table names are valid + for (var i=0;i