diff --git a/src/main/webapp/WEB-INF/jsp/mng/lcltt/lclttRegist.jsp b/src/main/webapp/WEB-INF/jsp/mng/lcltt/lclttRegist.jsp
index 21d099b..4727345 100644
--- a/src/main/webapp/WEB-INF/jsp/mng/lcltt/lclttRegist.jsp
+++ b/src/main/webapp/WEB-INF/jsp/mng/lcltt/lclttRegist.jsp
@@ -40,11 +40,26 @@
-
+
+ <%-- 광주, 전남 통합: 두 지역 코드 미리 조회 --%>
+
+
+
+
+
+
+
|
@@ -217,22 +232,59 @@ $(document).ready(function() {
}
if($('#hiddenAreaCode').val() != null && $('#hiddenAreaCode').val() != ''){
- $('form#insertForm select[name=areaCode]').val($('#hiddenAreaCode').val()).prop('selected', true);
+ var initAreaCode = $('#hiddenAreaCode').val();
+ // '전남광주' 통합 옵션(콤마로 조합된 값)에 속하는 코드인지 확인해 있으면 통합 옵션을 선택
+ var mergedOption = $('#areaCodeSel option').filter(function(){
+ var v = $(this).val();
+ return v.indexOf(',') > -1 && (','+v+',').indexOf(','+initAreaCode+',') > -1;
+ });
+ if(mergedOption.length > 0){
+ $('#areaCodeSel').val(mergedOption.val()).prop('selected', true);
+ }else{
+ $('#areaCodeSel').val(initAreaCode).prop('selected', true);
+ }
}
- fnAreaSubCodeList($('#areaCode').val(), $('#hiddenAreaSubCode').val());
+ fnAreaSubCodeList($('#areaCodeSel').val(), $('#hiddenAreaSubCode').val());
});
-$('#areaCode').on('change', function(){
+$('#areaCodeSel').on('change', function(){
fnAreaSubCodeList($(this).val(), '');
});
+$('#areaSubCode').on('change', function(){
+ fnResolveAreaCode();
+});
+
+// '전남광주' 처럼 지역이 콤마로 통합된 상태일 때, 실제 저장할 단일 AREA_CODE를
+// 선택된 구.군 코드(예: GJ001, JN008)의 앞 2자리에서 유추해 hidden #areaCode에 반영한다.
+function fnResolveAreaCode(){
+ var selVal = $('#areaCodeSel').val();
+
+ if(selVal == null || selVal == ''){
+ $('#areaCode').val('');
+ return;
+ }
+
+ if(selVal.indexOf(',') > -1){
+ var subVal = $('#areaSubCode').val();
+ if(subVal != null && subVal.length >= 2){
+ $('#areaCode').val(subVal.substring(0, 2));
+ }else{
+ $('#areaCode').val('');
+ }
+ }else{
+ $('#areaCode').val(selVal);
+ }
+}
+
function fnAreaSubCodeList(areaCode, selectedAreaSubCode){
$('#areaSubCode option').remove();
if(areaCode == null || areaCode == ''){
+ $('#areaCode').val('');
return;
}
@@ -248,6 +300,7 @@ function fnAreaSubCodeList(areaCode, selectedAreaSubCode){
if(selectedAreaSubCode != null && selectedAreaSubCode != ''){
$('#areaSubCode').val(selectedAreaSubCode).prop('selected', true);
}
+ fnResolveAreaCode();
},
error: function(){
//전송에 실패하면 실행될 코드;
@@ -272,9 +325,9 @@ function fnLclttSave(){
return false;
}
- if($('#areaCode').val() == null || $('#areaCode').val() == ''){
+ if($('#areaCodeSel').val() == null || $('#areaCodeSel').val() == ''){
alert('지역을 선택해 주세요.');
- $('#areaCode').focus();
+ $('#areaCodeSel').focus();
return false;
}
@@ -284,6 +337,12 @@ function fnLclttSave(){
return false;
}
+ if($('#areaCode').val() == null || $('#areaCode').val() == ''){
+ alert('지역/구.군 조합이 올바르지 않습니다. 구.군을 다시 선택해 주세요.');
+ $('#areaSubCode').focus();
+ return false;
+ }
+
if($('#adres1').val() == null || $('#adres1').val() == ''){
alert('주소를 입력해 주세요.');
$('#adres1').focus();
@@ -334,10 +393,11 @@ function jusoCallBack(roadFullAddr,roadAddrPart1,addrDetail,roadAddrPart2,engAdd
$(this).prop('selected', true);
}
});
+ fnResolveAreaCode();
}
}
function fnList(){
$('form#gotoListForm').submit();
}
-
\ No newline at end of file
+
|