Browse Source

BS3: js validation errors.

master
Ilya Konanykhin 8 years ago
parent
commit
3c521eba15
  1. 6
      app/assets/javascripts/utils.js

6
app/assets/javascripts/utils.js

@ -1,7 +1,7 @@
function displayFormErrors(data){ function displayFormErrors(data){
if( data.errors != undefined ){ if(data.errors != undefined ){
$.each( data.errors, function( field, errorMsg) { $.each(data.errors, function(field, errorMsg) {
$("#"+field).parents(".control-group").addClass("error"); $("#"+field).closest(".form-group").addClass("has-error");
$("#"+field).siblings(".help-block").html(errorMsg); $("#"+field).siblings(".help-block").html(errorMsg);
}); });
} }

Loading…
Cancel
Save