테스트 사이트 - 개발 중인 베타 버전입니다

회원가입시 이용약관 폼체크 채택완료

돼지코구뇽 9년 전 조회 4,321

</strong><font color="#7f7f7f" face="돋움, Dotum, sans-serif"><span style="font-size: 12px; line-height: normal;"><b><div class="login_body_check"></b></span></font></p><p><font color="#7f7f7f" face="돋움, Dotum, sans-serif"><span style="font-size: 12px; line-height: normal;"><b><span class="Apple-tab-span" style="white-space:pre">		</span><input type="checkbox" name="agree" value="1" id="law_agree"></b></span></font></p><p><font color="#7f7f7f" face="돋움, Dotum, sans-serif"><span style="font-size: 12px; line-height: normal;"><b><span class="Apple-tab-span" style="white-space:pre">		</span><label for="law_agree">이용약관에 동의</label></b></span></font></p><p><font color="#7f7f7f" face="돋움, Dotum, sans-serif"><span style="font-size: 12px; line-height: normal;"><b><span class="Apple-tab-span" style="white-space: pre;">	</span></div></b></span></font><strong style="color: rgb(127, 127, 127); font-family: 돋움, Dotum, sans-serif; font-size: 12px; line-height: normal;">
 

 

이와같이 이용약관 체크박스에 name값 agree로 하고 검사스크립트쪽

 

</strong></p><p><strong style="color: rgb(127, 127, 127); font-family: 돋움, Dotum, sans-serif; font-size: 12px; line-height: normal;"><script></strong></p><p><font color="#7f7f7f" face="돋움, Dotum, sans-serif"><span style="font-size: 12px; line-height: normal;"><b>// submit 최종 폼체크</b></span></font></p><p><font color="#7f7f7f" face="돋움, Dotum, sans-serif"><span style="font-size: 12px; line-height: normal;"><b>    function fregisterform_submit(f)</b></span></font></p><p><font color="#7f7f7f" face="돋움, Dotum, sans-serif"><span style="font-size: 12px; line-height: normal;"><b>    {</b></span></font></p><p><span class="Apple-tab-span" style="white-space: pre; font-size: 12px; line-height: normal;"><font color="#7f7f7f" face="돋움, Dotum, sans-serif"><b>		</b></font></span></p><p><font color="#7f7f7f" face="돋움, Dotum, sans-serif"><span style="font-size: 12px; line-height: normal;"><b>        // 약관 체크검사</b></span></font></p><p><font color="#7f7f7f" face="돋움, Dotum, sans-serif"><span style="font-size: 12px; line-height: normal;"><b>  if (!f.agree.checked) {</b></span></font></p><p><font color="#7f7f7f" face="돋움, Dotum, sans-serif"><span style="font-size: 12px; line-height: normal;"><b>            alert("회원가입약관의 내용에 동의하셔야 회원가입 하실 수 있습니다.");</b></span></font></p><p><font color="#7f7f7f" face="돋움, Dotum, sans-serif"><span style="font-size: 12px; line-height: normal;"><b>            f.agree.focus();</b></span></font></p><span style="color: rgb(127, 127, 127); font-family: 돋움, Dotum, sans-serif; font-size: 12px; font-weight: bold; line-height: normal;">                return false;</span><p><font color="#7f7f7f" face="돋움, Dotum, sans-serif"><span style="font-size: 12px; line-height: normal;"><b>        }</b></span></font></p><p><font color="#7f7f7f" face="돋움, Dotum, sans-serif"><span style="font-size: 12px; line-height: normal;"><b>    if (!f.agree2.checked) {</b></span></font></p><p><font color="#7f7f7f" face="돋움, Dotum, sans-serif"><span style="font-size: 12px; line-height: normal;"><b>            alert("개인정보처리방침안내의 내용에 동의하셔야 회원가입 하실 수 있습니다.");</b></span></font></p><p><font color="#7f7f7f" face="돋움, Dotum, sans-serif"><span style="font-size: 12px; line-height: normal;"><b>            f.agree2.focus();</b></span></font></p><span style="color: rgb(127, 127, 127); font-family: 돋움, Dotum, sans-serif; font-size: 12px; font-weight: bold; line-height: normal;">                return false;</span><p><font color="#7f7f7f" face="돋움, Dotum, sans-serif"><span style="font-size: 12px; line-height: normal;"><b>        }</b></span></font></p><p><font color="#7f7f7f" face="돋움, Dotum, sans-serif"><span style="font-size: 12px; line-height: normal;"><b>        // 회원아이디 검사</b></span></font></p><p><font color="#7f7f7f" face="돋움, Dotum, sans-serif"><span style="font-size: 12px; line-height: normal;"><b>        if (f.w.value == "") {</b></span></font></p><p><font color="#7f7f7f" face="돋움, Dotum, sans-serif"><span style="font-size: 12px; line-height: normal;"><b>            var msg = reg_mb_id_check();</b></span></font></p><p><font color="#7f7f7f" face="돋움, Dotum, sans-serif"><span style="font-size: 12px; line-height: normal;"><b>            if (msg) {</b></span></font></p><p><font color="#7f7f7f" face="돋움, Dotum, sans-serif"><span style="font-size: 12px; line-height: normal;"><b>                alert(msg);</b></span></font></p><p><font color="#7f7f7f" face="돋움, Dotum, sans-serif"><span style="font-size: 12px; line-height: normal;"><b>                f.mb_id.select();</b></span></font></p><p><font color="#7f7f7f" face="돋움, Dotum, sans-serif"><span style="font-size: 12px; line-height: normal;"><b>                return false;</b></span></font></p><p><font color="#7f7f7f" face="돋움, Dotum, sans-serif"><span style="font-size: 12px; line-height: normal;"><b>            }</b></span></font></p><p> </p><p><font color="#7f7f7f" face="돋움, Dotum, sans-serif"><span style="font-size: 12px; line-height: normal;"><b>        }</b></span></font></p><p><strong style="color: rgb(127, 127, 127); font-family: 돋움, Dotum, sans-serif; font-size: 12px; line-height: normal;"></script></strong></p><p><strong style="color: rgb(127, 127, 127); font-family: 돋움, Dotum, sans-serif; font-size: 12px; line-height: normal;">
  

 

이와같이 했는데 체크가 안되어있을경우 팝업창이 뜨긴하는데 가입완료로 넘어가버립니다.

 

뭐가 잘못되었나요?

 

 

댓글을 작성하려면 로그인이 필요합니다.

답변 3개

채택된 답변
+20 포인트
9년 전

form 코딩이 되어 있는 부분의 소스를 올려주세요!

submit 버튼 코딩까지요.

보통 <input type="submit" ... 이렇게 하면 이상이 없는 부분인데 <input type="submit" onclick="fregisterform_submit(document.form)" ... 이런식으로 하면 당연히 문제가 되니까요. 

로그인 후 평가할 수 있습니다

답변에 대한 댓글 1개

돼지코구뇽
9년 전
<form id="fregisterform" name="fregisterform" action="<?php echo $register_action_url ?>" onsubmit="return fregisterform_submit(this);" method="post" enctype="multipart/form-data" autocomplete="off">
<input type="hidden" name="w" value="<?php echo $w ?>">
<input type="hidden" name="url" value="<?php echo $urlencode ?>">
<input type="hidden" name="agree" value="<?php echo $agree ?>">
<input type="hidden" name="agree2" value="<?php echo $agree2 ?>">
<input type="hidden" name="cert_type" value="<?php echo $member['mb_certify']; ?>">
<input type="hidden" name="cert_no" value="">
<?php if (isset($member['mb_sex'])) { ?><input type="hidden" name="mb_sex" value="<?php echo $member['mb_sex'] ?>"><?php } ?>
<?php if (isset($member['mb_nick_date']) && $member['mb_nick_date'] > date("Y-m-d", G5_SERVER_TIME - ($config['cf_nick_modify'] * 86400))) { // 닉네임수정일이 지나지 않았다면 ?>
<input type="hidden" name="mb_nick_default" value="<?php echo $member['mb_nick'] ?>">
<input type="hidden" name="mb_nick" value="<?php echo $member['mb_nick'] ?>">
<?php } ?>







<div class="btn_confirm" style="text-align:center; margin-top:30px;">
<input type="submit" value="<?php echo $w==''?'가입하기':'정보수정'; ?>" id="btn_submit" class="btn_submit" accesskey="s">
</div>
</div>
</form>

이와같은 형식입니다. 통소스는 안올라가네요

댓글을 작성하려면 로그인이 필요합니다.

9년 전

스크립트에 오류가 있을 경우, 스크립트를 중단하지 않고 건너띄어 버리는 경우가 있습니다. 

 

중간중간에 alert 를 찍어서, 스크립트에 오류가 생기는 부분이 있는지 한번 확인해 보세요. 

로그인 후 평가할 수 있습니다

댓글을 작성하려면 로그인이 필요합니다.

9년 전

서브밋을 자바스크립트로 넘긴게 아닌가 확인해보세요. 

로그인 후 평가할 수 있습니다

답변에 대한 댓글 1개

돼지코구뇽
9년 전
[code]
<script>
$(function() {
$("#reg_zip_find").css("display", "inline-block");

<?php if($config['cf_cert_use'] && $config['cf_cert_ipin']) { ?>
// 아이핀인증
$("#win_ipin_cert").click(function() {
if(!cert_confirm())
return false;

var url = "<?php echo G5_OKNAME_URL; ?>/ipin1.php";
certify_win_open('kcb-ipin', url);
return;
});

<?php } ?>
<?php if($config['cf_cert_use'] && $config['cf_cert_hp']) { ?>
// 휴대폰인증
$("#win_hp_cert").click(function() {
if(!cert_confirm())
return false;

<?php
switch($config['cf_cert_hp']) {
case 'kcb':
$cert_url = G5_OKNAME_URL.'/hpcert1.php';
$cert_type = 'kcb-hp';
break;
case 'kcp':
$cert_url = G5_KCPCERT_URL.'/kcpcert_form.php';
$cert_type = 'kcp-hp';
break;
case 'lg':
$cert_url = G5_LGXPAY_URL.'/AuthOnlyReq.php';
$cert_type = 'lg-hp';
break;
default:
echo 'alert("기본환경설정에서 휴대폰 본인확인 설정을 해주십시오");';
echo 'return false;';
break;
}
?>

certify_win_open("<?php echo $cert_type; ?>", "<?php echo $cert_url; ?>");
return;
});
<?php } ?>
});

// submit 최종 폼체크
function fregisterform_submit(f)
{
// 약관 체크검사
if (!f.agree.checked) {
alert("회원가입약관의 내용에 동의하셔야 회원가입 하실 수 있습니다.");
f.agree.focus();
return false;
}
if (!f.agree2.checked) {
alert("개인정보처리방침안내의 내용에 동의하셔야 회원가입 하실 수 있습니다.");
f.agree2.focus();
return false;
}
// 회원아이디 검사
if (f.w.value == "") {
var msg = reg_mb_id_check();
if (msg) {
alert(msg);
f.mb_id.select();
return false;
}
}

if (f.w.value == "") {
if (f.mb_password.value.length < 3) {
alert("비밀번호를 3글자 이상 입력하십시오.");
f.mb_password.focus();
return false;
}
}

if (f.mb_password.value != f.mb_password_re.value) {
alert("비밀번호가 같지 않습니다.");
f.mb_password_re.focus();
return false;
}

if (f.mb_password.value.length > 0) {
if (f.mb_password_re.value.length < 3) {
alert("비밀번호를 3글자 이상 입력하십시오.");
f.mb_password_re.focus();
return false;
}
}

// 이름 검사
if (f.w.value=="") {
if (f.mb_name.value.length < 1) {
alert("이름을 입력하십시오.");
f.mb_name.focus();
return false;
}

/*
var pattern = /([^가-힣\x20])/i;
if (pattern.test(f.mb_name.value)) {
alert("이름은 한글로 입력하십시오.");
f.mb_name.select();
return false;
}
*/
}

if (typeof(f.mb_recommend) != "undefined" && f.mb_recommend.value) {
if (f.mb_id.value == f.mb_recommend.value) {
alert("본인을 추천할 수 없습니다.");
f.mb_recommend.focus();
return false;
}

var msg = reg_mb_recommend_check();
if (msg) {
alert(msg);
f.mb_recommend.select();
return false;
}
}

<?php echo chk_captcha_js(); ?>

document.getElementById("btn_submit").disabled = "disabled";

return true;
}
</script>
[/code]

간추린부분입니다

// submit 최종 폼체크
function fregisterform_submit(f)
{

안에 삽입하였는데 검사는 하되 넘겨버리는 현상입니다.

댓글을 작성하려면 로그인이 필요합니다.

답변을 작성하려면 로그인이 필요합니다.

로그인