우편번호를 v1에서 v2 로수정했는대...
본문
우편번호를 v1에서 v2 로수정했는대 우편번호는 잘 들어오는대 주소가 undefined 씩으로 들어 오지가 않네요. 알려주시면 감사하겠습니다.
v1에서는 작동이 잘되었습니다.
register_form.skin.php---------------------------
<table width="100%" border="0" cellspacing="0" cellpadding="0">
<tr>
<td height="25">
<input type="hidden" name="mb_addr_jibeon" value="<?=$member['mb_addr_jibeon']; ?>">
<input class=ed type=text name='mb_zip1' size=4 maxlength=3 <?=$config[cf_req_addr]?'required':'';?> itemname='우편번호 앞자리' value='<?=$member[mb_zip1]?>' style="vertical-align:middle">
-
<input class=ed type=text name='mb_zip2' size=4 maxlength=3 <?=$config[cf_req_addr]?'required':'';?> itemname='우편번호 뒷자리' value='<?=$member[mb_zip2]?>' style="vertical-align:middle">
<a href="javascript:;" onclick="win_zip('fregisterform', 'mb_zip1', 'mb_zip2', 'mb_addr1', 'mb_addr2', 'mb_addr3', 'mb_addr_jibeon');" align=absmiddle><img width="74" height="20" src="<?=$member_skin_path?>/img/post_search_btn.gif" border=0 align=absmiddle></a></td>
</tr>
<tr>
<td height="25" colspan="2"><input class=ed type=text name='mb_addr1' size=60 <?=$config[cf_req_addr]?'required':'';?> itemname='기본주소' value='<?=$member[mb_addr1]?>'> 기본주소</td>
</tr>
<tr>
<td height="25" colspan="2"><input class=ed type=text name='mb_addr2' size=60 <?=$config[cf_req_addr]?'required':'';?> itemname='상세주소' value='<?=$member[mb_addr2]?>'> 상세주소</td>
</tr>
<tr>
<td height="25" colspan="2"><input class=ed type=text name='mb_addr3' size=60 readonly itemname='참고항목' value='<?=$member[mb_addr3]?>'> 참고항목</td>
</tr>
</table>
zip.php-------------------------------------
<?
include_once("./_common.php");
$g4[title] = "다음 주소 검색";
include_once("$g4[path]/head.sub.php");
if(isset($_SERVER['HTTPS']) && $_SERVER['HTTPS']=='on') { //https 통신
echo '<script src="'.PHP_EOL">https://spi.maps.daum.net/imap/map_js_init/postcode.v2.js"></script>'.PHP_EOL;
} else { //http 통신
echo '<script src="'.PHP_EOL">http://dmaps.daum.net/map_js_init/postcode.v2.js"></script>'.PHP_EOL;
}
echo '<script src="'.$g4['path'].'/js/zip.js"></script>'.PHP_EOL;
?>
<style>
#daum_juso_wrap{position:absolute;left:0;top:0;width:100%;height:100%}
</style>
<div id="daum_juso_wrap" class="daum_juso_wrap"></div>
<script>
function put_data2(zip1, zip2, addr1, addr2, addr3, jibeon)
{
var of = window.opener.document.<?php echo $frm_name; ?>;
of.<?php echo $frm_zip1; ?>.value = zip1;
of.<?php echo $frm_zip2; ?>.value = zip2;
of.<?php echo $frm_addr1; ?>.value = addr1;
of.<?php echo $frm_addr2; ?>.value = addr2;
of.<?php echo $frm_addr3; ?>.value = addr3;
if( jibeon ){
if(of.<?php echo $frm_jibeon; ?> !== undefined){
of.<?php echo $frm_jibeon; ?>.value = jibeon;
}
}
of.<?php echo $frm_addr2; ?>.focus();
window.close();
}
</script>
<?
include_once("$g4[path]/tail.sub.php");
?>
commons.js-----------------------------
// 우편번호 창
function win_zip(frm_name, frm_zip1, frm_zip2, frm_addr1, frm_addr2, frm_addr3, frm_jibeon)
{
url = g4_path + "/" + g4_bbs + "/zip.php?frm_name="+frm_name+"&frm_zip1="+frm_zip1+"&frm_zip2="+frm_zip2+"&frm_addr1="+frm_addr1+"&frm_addr2="+frm_addr2+"&frm_addr3="+frm_addr3+"&frm_jibeon="+frm_jibeon;
win_open(url, "winZip", "left=50,top=50,width=616,height=460,scrollbars=1");
}
zip.js-----------------------------
$(function() {
var el_id = document.getElementById("daum_juso_wrap");
new daum.Postcode({
oncomplete: function(data) {
var address1 = data.address1,
address2 = "";
if(data.addressType == "R"){ //도로명이면
address2 = data.address2;
}
put_data2(data.postcode1, data.postcode2, address1, "", address2, data.addressType);
},
width : "100%",
height : "100%"
}).embed(el_id);
});
답변 1
그누보드5 common.js 의 379줄 win_zip 부분을 참고하시거나
다음우편번호 서비스 가이드페이지(http://postcode.map.daum.net/guide#upgrade|v1)
예제를 참고하시어 수정하시면 될 듯 합니다.