내정보 > 비밀번호 확인 추가 + 값체크 추가.
This commit is contained in:
@@ -149,12 +149,34 @@ var ajaxUtil = {
|
||||
},
|
||||
422:function(rstData, status) {
|
||||
console.log(rstData)
|
||||
$(rstData.responseJSON).each((idx, oj) => {
|
||||
// TODO : form id? or body
|
||||
let target = $('body').find('[name=' + oj.field + ']');
|
||||
target.addClass('is-invalid');
|
||||
|
||||
target.parent().find('.invalid-feedback').text(oj.defaultMessage);
|
||||
let isResetDone = false;
|
||||
|
||||
$(rstData.responseJSON.fieldErrors).each((idx, oj) => {
|
||||
const target = $('[name="' + oj.field + '"]');
|
||||
|
||||
if (!isResetDone) {
|
||||
const formElement = target.closest('form');
|
||||
if (formElement.length > 0) {
|
||||
$(formElement).find('.component-input').removeClass('input-invalid');
|
||||
$(formElement).find('.input-info').each(function () {
|
||||
$(this).remove();
|
||||
});
|
||||
}
|
||||
isResetDone = true;
|
||||
}
|
||||
|
||||
if (target.length > 0) {
|
||||
const component = target.closest('.component-input');
|
||||
if(component){
|
||||
component.addClass('input-invalid');
|
||||
let infoBox = component.find('.input-info');
|
||||
if (infoBox.length === 0) {
|
||||
infoBox = $('<ul class="input-info"></ul>').appendTo(component);
|
||||
}
|
||||
infoBox.html('<li>' + oj.message + '</li>');
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
if ($('.invalid-feedback').length === 0) {
|
||||
|
||||
Reference in New Issue
Block a user