fixed error message duplication

This commit is contained in:
zmagod 2016-09-06 11:33:09 +02:00
parent b44a284b54
commit b672d85405
2 changed files with 9 additions and 5 deletions

View file

@ -93,12 +93,16 @@
}
})
.on('submit', function(ev) {
textValidator(ev, element.find("#experiment-name"), false);
textValidator(ev, element.find("#experiment-description"), true);
})
.clearFormErrors();
form.clearFormErrors();
});
$("#new-experiment-modal").on("hidden.bs.modal", function (){
form.clearFormErrors();
});
}
}
// Initialize no description edit link
function initEditNoDescription(){
var modal = "#edit-experiment-modal-";

View file

@ -21,7 +21,7 @@ class Experiment < ActiveRecord::Base
presence: true,
length: { minimum: 4, maximum: 50 },
uniqueness: { scope: :project, case_sensitive: false }
validates :description, length: { maximum: 255 }
validates :description, length: { maximum: 50 }
validates :project, presence: true
validates :created_by, presence: true
validates :last_modified_by, presence: true