프로토~ 4

This commit is contained in:
doyeon 2025-10-20 14:51:56 +09:00
parent 0f1ac11982
commit c6621ff151
4 changed files with 11 additions and 4 deletions

Binary file not shown.

After

Width:  |  Height:  |  Size: 44 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 51 KiB

View File

@ -144,9 +144,10 @@
id="businessNumber" id="businessNumber"
name="businessNumber" name="businessNumber"
class="form-input" class="form-input"
placeholder="123-45-67890" placeholder="숫자만 입력하세요 (예: 1234567890)"
required required
maxlength="12" maxlength="12"
inputmode="numeric"
style="flex: 1;" style="flex: 1;"
autocomplete="off" autocomplete="off"
> >
@ -160,6 +161,9 @@
검증하기 검증하기
</button> </button>
</div> </div>
<div class="body-s text-muted" style="margin-top: 4px;">
숫자만 입력하시면 자동으로 형식이 맞춰집니다
</div>
<div id="verifyResult" style="margin-top: 8px;"></div> <div id="verifyResult" style="margin-top: 8px;"></div>
</div> </div>
</section> </section>

View File

@ -509,8 +509,8 @@
} }
} }
// 사업자번호 필드 // 사업자번호 필드 (name이 businessNumber인 경우도 처리)
if (input.name === 'business_number' && input.value) { if ((input.name === 'business_number' || input.name === 'businessNumber') && input.value) {
// 자동 하이픈 추가 // 자동 하이픈 추가
let value = input.value.replace(/[^0-9]/g, ''); let value = input.value.replace(/[^0-9]/g, '');
if (value.length > 3 && value.length <= 5) { if (value.length > 3 && value.length <= 5) {
@ -520,13 +520,16 @@
} }
input.value = value; input.value = value;
// 검증 // 검증 (완전한 형식일 때만)
if (value.length === 12) { if (value.length === 12) {
if (!window.FormValidator.isValidBusinessNumber(value)) { if (!window.FormValidator.isValidBusinessNumber(value)) {
window.FormValidator.showError(input, '올바른 사업자번호 형식을 입력하세요.'); window.FormValidator.showError(input, '올바른 사업자번호 형식을 입력하세요.');
} else { } else {
window.FormValidator.clearError(input); window.FormValidator.clearError(input);
} }
} else {
// 입력 중일 때는 에러 제거
window.FormValidator.clearError(input);
} }
} }
}); });