mirror of https://github.com/fspc/BikeShed-1.git
Ilya Konanykhin
8 years ago
3 changed files with 87 additions and 51 deletions
@ -1,8 +1,10 @@ |
|||
function displayFormErrors(data){ |
|||
function displayFormErrors(data, form){ |
|||
if(form){ |
|||
$(form).find(".form-group.has-error").removeClass("has-error").find(".help-block").html(""); |
|||
} |
|||
if(data.errors != undefined ){ |
|||
$.each(data.errors, function(field, errorMsg) { |
|||
$("#"+field).closest(".form-group").addClass("has-error"); |
|||
$("#"+field).siblings(".help-block").html(errorMsg.join(", ")); |
|||
$("#"+field).closest(".form-group").addClass("has-error").find(".help-block").html(errorMsg.join(", ")); |
|||
}); |
|||
} |
|||
} |
|||
|
Loading…
Reference in new issue