이지우 - 관리자 기소유예 대상자 등록 중복확인 시 생년월일 형태 (달력 > 셀렉트박스 ) 변경

This commit is contained in:
jiwoo 2024-02-29 11:06:27 +09:00
parent cfdf37a886
commit 953c53173b
2 changed files with 100 additions and 19 deletions

View File

@ -43,6 +43,9 @@
return false;
}
//생년월일 치환
$("#DBirth").val($("#birthYear").val()+$("#birthMonth").val()+$("#birthDay").val());
var data = new FormData(document.getElementById("createForm"));
// if(confirm("저장하시겠습니까?")){
@ -125,22 +128,23 @@
return true;
}
// 생년월일 검사
if($("#DBirth").val().trim() == ""){
alert("생년월일을 입력해주세요.");
$("#DBirth").focus();
return true;
}else{
$("#DBirth").val($("#DBirth").val().replaceAll('.',''))
}
//생년월일 자리수 검사
if($("#DBirth").val().length != 8){
alert("생년월일은 반드시 8자리를 맞춰주세요.\nex)20010102");
$("#DBirth").focus();
return true;
}
if($("#birthYear").val() == ''){
alert('생년월일 년도를 선택해주세요.');
$("#birthYear").focus();
return true;
};
if($("#birthMonth").val() == ''){
alert('생년월일 월을 선택해주세요.');
$("#birthMonth").focus();
return true;
};
if($("#birthDay").val() == ''){
alert('생년월일 일자를 선택해주세요.');
$("#birthDay").focus();
return true;
};
return false; // 모든 검사를 통과하면 false 반환
@ -152,6 +156,77 @@
listForm.submit();
}
function birthSelectBoxDraw(){
$('.birthYear').yearselect({
start : 1900,
end : new Date().getFullYear(),
emptyOption: true,
emptyText: '선택',
selected:'',
order:'desc'
})
// 년도를 바꾼다면 일자를 다시 선택하기
$('.birthYear').change(function(){
if($(this).next().next().next().next('select.birthDay')){
if(Number($(this).next().next().next().next('select.birthDay').val()) > 28){
dayDraw($(this).next().next().next().next('select.birthDay'));
}
}
});
$.each($(".birthMonth"), function(idx, elm){
var selectValue = $(this).attr('selectValue');
$(this).append($('<option>').text('선택').val(''));
for(var i=0; i < 12; i ++){
var option = $('<option/>');
var month = i+1;
month = month < 10 ? '0'+month : month;
option.val(month);
option.text(month+'월');
$(this).append(option);
}
if(isNotEmpty(selectValue)){
$(this).val(selectValue);
}
// 일자가 존재한다면..
if($(this).next().next('select.birthDay')){
$(this).change(function(){
dayDraw($(this).next().next('select.birthDay'));
});
}
});
$.each($(".birthDay"), function(idx, value){
dayDraw($(this));
});
}
function dayDraw(obj){
var selectValue = $(obj).attr('selectValue');
var selectMonth = $(obj).prev().prev('select.birthMonth').val();
var selectYear = $(obj).prev().prev().prev().prev('select.birthYear').val();
var lastDay = '';
if(isNotEmpty(selectMonth) && isNotEmpty(selectYear)){
lastDay = new Date(selectYear, selectMonth, 0).getDate();
}
$(obj).children('option').remove();
$(obj).append($('<option>').text('선택').val(''));
if(isNotEmpty(lastDay)){
for(var i=0; i < lastDay; i ++){
var option = $('<option/>');
var day = i+1;
day = day < 10 ? '0'+day : day;
option.val(day);
option.text(day+'일');
$(obj).append(option);
}
if(isNotEmpty(selectValue)){
$(obj).val(selectValue);
}
}
}
</script>
</head>
@ -162,6 +237,7 @@
<input type="hidden" name="sspnIdtmtTrgtOrd" id="sspnIdtmtTrgtOrd" value="" />
<input type="hidden" name="prcsAplctPrdOrdCmplt" id="prcsAplctPrdOrdCmplt" value="" />
<input type="hidden" name="cmptntAthrtNm" id="cmptntAthrtNm" value="" />
<input type="hidden" name="DBirth" id="DBirth" value="" />
<!-- cont -->
@ -222,9 +298,14 @@
</th>
<td>
<!-- <input type="text" name="DBirth" id="DBirth" placeholder="00000000" maxlength="8"/> -->
<div class="calendar_wrap">
<!-- <div class="calendar_wrap">
<input type="text" class="calendar" placeholder="생년월일" title="생년월일 선택" id="DBirth" name="DBirth" value="">
</div>
</div> -->
<select name="birthYear" id="birthYear" class="selType1 birthYear birth_da sel_type1" selectValue="${birthYear}"></select>
<label for="birthMonth" class="label">월 선택</label>
<select name="birthMonth" id="birthMonth" class="selType1 birthMonth birth_da sel_type1" selectValue="${birthMonth}"></select>
<label for="birthDay" class="label">일 선택</label>
<select name="birthDay" id="birthDay" class="selType1 birthDay birth_da sel_type1" selectValue="${birthDay}"></select>
</td>
</tr>
</tbody>

View File

@ -430,7 +430,7 @@
<div class="cont_wrap" id="sub" style="margin-top: 50px;">
<div class="tb_tit01">
<div class="tb_tit01_left">
<p>거래선 및 서약서 정보1</p>
<p>거래선 및 서약서 정보</p>
</div>
<div class="tb_tit01_right">
<div class="btn_wrap">