회원가입 필수 항목 검증 강화:
- 입력/미충족 항목 구체적 수집 및 에러 메시지 개선 - 시나리오별/공통 항목 검증 로직 추가
This commit is contained in:
@@ -375,6 +375,35 @@
|
||||
return scenarioValidation && commonValidation;
|
||||
}
|
||||
|
||||
// 미입력/미충족 항목을 구체적으로 수집
|
||||
function collectFormErrors() {
|
||||
const errors = [];
|
||||
|
||||
// 시나리오별 항목
|
||||
if (registrationScenario === 'new') {
|
||||
const loginIdElement = document.getElementById('loginId');
|
||||
const userNameElement = document.getElementById('userName');
|
||||
|
||||
if (!(loginIdElement && isValidEmail(loginIdElement.value))) errors.push('이메일 아이디를 올바르게 입력해주세요.');
|
||||
if (!(userNameElement && userNameElement.value.trim() !== '')) errors.push('성명을 입력해주세요.');
|
||||
if (!isAuthVerified) errors.push('휴대폰 인증을 완료해주세요.');
|
||||
if (document.getElementById('isPasswordValid')?.value.trim() !== 'true') errors.push('비밀번호 조건을 확인해주세요.');
|
||||
if (document.getElementById('isPasswordMatch')?.value.trim() !== 'true') errors.push('비밀번호 확인이 일치하지 않습니다.');
|
||||
}
|
||||
|
||||
// 공통 항목
|
||||
const notificationConsentEl = document.getElementById('notificationConsent');
|
||||
if ($('#orgName').val().trim() === '') errors.push('회사명을 입력해주세요.');
|
||||
if ($('#compRegNo').val().trim() === '') errors.push('사업자등록번호를 올바르게 입력해주세요.');
|
||||
if ($('#corpRegNo').val().trim() === '') errors.push('법인등록번호를 올바르게 입력해주세요.');
|
||||
if ($('#compRegFile').val().trim() === '') errors.push('사업자등록증 파일을 첨부해주세요.');
|
||||
if (!$('#termsOfUse').prop('checked')) errors.push('이용약관에 동의해주세요.');
|
||||
if (!$('#privacyCollect').prop('checked')) errors.push('개인정보 수집·이용에 동의해주세요.');
|
||||
if (notificationConsentEl && !notificationConsentEl.checked) errors.push('알림 수신에 동의해주세요.');
|
||||
|
||||
return errors;
|
||||
}
|
||||
|
||||
let isSubmitting = false;
|
||||
|
||||
// 등록 버튼 클릭 이벤트
|
||||
@@ -426,7 +455,10 @@
|
||||
isPasswordMatch
|
||||
});
|
||||
|
||||
let errorMessage = '모든 필수 항목을 입력하고 약관에 동의해주세요.'
|
||||
const errors = collectFormErrors();
|
||||
let errorMessage = errors.length > 0
|
||||
? '아래 항목을 확인해주세요.<br><br>' + errors.map(e => '• ' + e).join('<br>')
|
||||
: '모든 필수 항목을 입력하고 약관에 동의해주세요.';
|
||||
customPopups.showAlert(errorMessage);
|
||||
|
||||
// Reset submission state since validation failed
|
||||
|
||||
Reference in New Issue
Block a user