function CommonError() {
this.initialize.apply(this, arguments);
}
CommonError.prototype = {
initialize: function() {
},
execute: function(errorInfo, errorKBN) {
$('p[class="txt_error mt10"]').remove();
$('p[class="txt_error mt10 mb10"]').remove();
$('p[id="SKSAP000002"]').remove();
$('.input_error').removeClass('input_error');
$('.input_error_cb').removeClass('input_error_cb');
if (!errorInfo || !errorInfo.length) {
$('#elmContainer').hide();
viewNumber.off();
footer.on(3);
$('#errorMessage').html(Messages.get('SPSYSMSG001'));
$('#top_header_info').hide();
$('#messages').hide();
$('#errorPage').show();
return;
}
if (!errorKBN || 'L' == errorKBN) {
this._dispSelfError(errorInfo, errorKBN);
return;
}
$('#elmContainer').hide();
viewNumber.on("93err");
footer.on(3);
var errMsgs = [];
$.each((errorInfo || []),function(index, elem) {
errMsgs.push(elem.errorMsg);
});
$('#errorMessage').html(errMsgs.join('
'));
$('#top_header_info').hide();
$('#messages').hide();
$('#errorPage').show();
indicator.off();
},
_dispSelfError: function(errorInfo, errorKBN) {
// エラーメッセージを組み立てる
var error_messages = [];
error_messages.push('
');
// リンクしたエラーメッセージコードを組み立てる
$.each((errorInfo || []),function(index, info) {
if (pager.pageId == 'KSS0010' && 'L' == errorKBN) {
error_messages.push('- ●' + info.errorMsg + '
');
} else {
error_messages.push('- ●' + info.errorMsg + '
');
}
});
error_messages.push('
');
$.each((errorInfo || []),function(index, info) {
var errorP = $('').addClass('txt_error mt10').text(info.errorMsg);
if (pager.pageId == 'KSS0010' && info.errorCd == 'SKSAP000002') {
$('#goKSS0015').before($('').attr('id', 'SKSAP000002').addClass('txt_important').text(info.errorMsg));
}
$.each((info.positionIds || []),function(index, id) {
$('input[type=text]#' + id).parent().parent().before(errorP);
$('input[type=tel]#' + id).parent().parent().parent().before(errorP);
$('input[type=email]#' + id).parent().parent().before(errorP);
$('input[type=password]#' + id).parent().parent().before(errorP);
if (pager.pageId == 'KSS0050' && info.errorCd == 'SKSAS050001') {
$('input[type=radio]#' + id).parent().parent().parent().addClass('input_error');
} else {
$('input[type=radio]#' + id).parent().parent().parent().before(errorP).prev().addClass("mb10");
}
$('select#' + id).parent().before(errorP);
$('textarea#' + id).parent().parent().before(errorP).prev().addClass("mb10");
});
$.each((info.properties || []),function(index, prop) {
if(prop == ''){
return;
}
$('input[type=text]#' + prop).parent().addClass('input_error');
$('input[type=tel]#' + prop).parent().addClass('input_error');
$('input[type=email]#' + prop).parent().addClass('input_error');
$('input[type=password]#' + prop).parent().addClass('input_error');
$('select#' + prop).parent().addClass('input_error');
$('textarea#' + prop).parent().addClass('input_error');
$("input[type=radio][name=" + prop + "]").each(function(){
if (!$(this).parent().parent().hasClass('disabled')) {
$(this).parent().parent().parent().addClass('input_error');
}
});
$('input[type=checkbox]#' + prop).parent().addClass('input_error_cb');
});
});
// エラーメッセージを表示する
$('#messages').html(error_messages.join('')).show();
$('[id$=_Indicator]').hide();
// インジケータを非表示
indicator.off();
},
connectError: function(e, errName) {
if (!pager.pageId || pager.htmlFile == 'KSS0010.html' || errName == 'parsererror') {
commonError.execute();
indicator.off();
return;
}
alert(Messages.get('SPSYSMSG002'));
indicator.off();
}
};