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

스크립트 문의 드립니다. 채택완료

sosososo 4년 전 조회 3,844

</p>

<p><script>

    $(document).ready(function() {

            $("#btn_submit").on('click', function(){

            if (document.getElementById("qa_category").value==''){

                alert("분류를 선택하세요.");

            }else{

                alert("성공적으로 발송되었습니다.");

            }

        });

    });

    </script></p>

<p>

 

위의 스크립트중 모두(분류)빼고  필수항목 입력 완료후 작성완료시

  alert("성공적으로 발송되었습니다.");

로 하고싶은데 도와주세요!!

 

 

 

 

위에 이미지 처럼 분류 팝업을 띄울 의미가 없는거 같습니다.  분류미선택시 작성완료를 누르면 "!목목에서 항목을 선택하세요" 라고 뜨기 때문입니다.

 

문제는 다음인데요... 필수항목 ( 이메일 , 제목 )을 입력 안해도 

alert("성공적으로 발송되었습니다.");  창을 띄웁니다.   ( 저장은 안됨)

 

 

 

 

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

답변 1개

이진영
4년 전

전체 소스를 올려 주세요

수정해 드리겠습니다.

 

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

답변에 대한 댓글 3개

s
sosososo
4년 전
[code]
<?php
if (!defined('_GNUBOARD_')) exit; // 개별 페이지 접근 불가

// add_stylesheet('css 구문', 출력순서); 숫자가 작을 수록 먼저 출력됨
add_stylesheet('<link rel="stylesheet" href="'.$qa_skin_url.'/style.css">', 0);
?>
<style>
body {min-width: 570px;}
#top_banner, .main_nav, #wrapper_title, #ft, #up_btn, #down_btn{display:none!important;}
#bo_w{width: 570px !important;}
</style>
<section id="bo_w">
<h2>1:1문의 작성</h2>
<!-- 게시물 작성/수정 시작 { -->
<form name="fwrite" id="fwrite" action="<?php echo $action_url ?>?end_check=1" onsubmit="return fwrite_submit(this);" method="post" enctype="multipart/form-data" autocomplete="off">
<input type="hidden" name="w" value="<?php echo $w ?>">
<input type="hidden" name="qa_id" value="<?php echo $qa_id ?>">
<input type="hidden" name="sca" value="<?php echo $sca ?>">
<input type="hidden" name="stx" value="<?php echo $stx ?>">
<input type="hidden" name="page" value="<?php echo $page ?>">
<?php
$option = '';
$option_hidden = '';
$option = '';

if ($is_dhtml_editor) {
$option_hidden .= '<input type="hidden" name="qa_html" value="1">';
} else {
$option .= "\n".'<input type="checkbox" id="qa_html" name="qa_html" onclick="html_auto_br(this);" value="'.$html_value.'" '.$html_checked.'>'."\n".'<label for="qa_html">html</label>';
}

echo $option_hidden;
?>

<div class="form_01">
<h3 style="font-size: 19px;">문의 보내기</h3>
<ul>
<?php if ($category_option) { ?>
<li class="bo_w_select write_div">
<label for="qa_category" class="sound_only">분류<strong>필수</strong></label>
<select name="qa_category" id="qa_category" required >
<option value="">분류를 선택하세요</option>
<?php echo $category_option ?>
</select>
</li>
<?php } ?>

<?php if ($is_email) { ?>
<li class="bo_w_mail chk_box">
<label for="qa_email" class="sound_only">이메일</label>
<input type="text" name="qa_email" value="<?php echo get_text($write['qa_email']); ?>" id="qa_email" <?php echo $req_email; ?> class="<?php echo $req_email.' '; ?>frm_input full_input email" size="50" maxlength="100" placeholder="이메일">
<input type="checkbox" name="qa_email_recv" id="qa_email_recv" value="1" <?php if($write['qa_email_recv']) echo 'checked="checked"'; ?> class="selec_chk">
<label for="qa_email_recv" class="frm_info"><span></span>답변받기</label>
</li/>
<?php } ?>

<?php if ($is_hp) { ?>
<li class="bo_w_hp chk_box">
<label for="qa_hp" class="sound_only">휴대폰</label>
<input type="text" name="qa_hp" value="<?php echo get_text($write['qa_hp']); ?>" id="qa_hp" <?php echo $req_hp; ?> class="<?php echo $req_hp.' '; ?>frm_input full_input" size="30" placeholder="휴대폰">
<?php if($qaconfig['qa_use_sms']) { ?>
<input type="checkbox" name="qa_sms_recv" id="qa_sms_recv" value="1" <?php if($write['qa_sms_recv']) echo 'checked="checked"'; ?> class="selec_chk">
<label for="qa_sms_recv" class="frm_info"><span></span>답변등록 SMS알림 수신</label>
<?php } ?>
</li>
<?php } ?>

<li class="bo_w_sbj">
<label for="qa_subject" class="sound_only">제목<strong class="sound_only">필수</strong></label>
<input type="text" name="qa_subject" value="<?php echo get_text($write['qa_subject']); ?>" id="qa_subject" required class="frm_input full_input required" size="50" maxlength="255" placeholder="제목">
</li>

<li class="qa_content_wrap <?php echo $is_dhtml_editor ? $config['cf_editor'] : ''; ?>">
<label for="qa_content" class="sound_only">내용<strong class="sound_only">필수</strong></label>
<?php echo $editor_html; // 에디터 사용시는 에디터로, 아니면 textarea 로 노출 ?>

</li>

<?php if ($option) { ?>
<!-- <li>
옵션
<?php echo $option; ?>
</li> -->
<?php } ?>

[/code]
s
sosososo
4년 전
[code]
<li class="bo_w_flie">
<div class="file_wr">
<label for="bf_file_1" class="lb_icon"><i class="fa fa-download" aria-hidden="true"></i><span class="sound_only"> 파일 #1</span></label>
<input type="file" name="bf_file[1]" id="bf_file_1" title="파일첨부 1 : 용량 <?php echo $upload_max_filesize; ?> 이하만 업로드 가능" class="frm_file">
<?php if($w == 'u' && $write['qa_file1']) { ?>
<input type="checkbox" id="bf_file_del1" name="bf_file_del[1]" value="1"> <label for="bf_file_del1"><?php echo $write['qa_source1']; ?> 파일 삭제</label>
<?php } ?>
</div>
</li>

<li class="bo_w_flie">
<div class="file_wr">
<label for="bf_file_2" class="lb_icon"><i class="fa fa-download" aria-hidden="true"></i><span class="sound_only"> 파일 #2</span></label>
<input type="file" name="bf_file[2]" id="bf_file_2" title="파일첨부 2 : 용량 <?php echo $upload_max_filesize; ?> 이하만 업로드 가능" class="frm_file">
<?php if($w == 'u' && $write['qa_file2']) { ?>
<input type="checkbox" id="bf_file_del2" name="bf_file_del[2]" value="1"> <label for="bf_file_del2"><?php echo $write['qa_source2']; ?> 파일 삭제</label>
<?php } ?>
</div>
</li>
</ul>
</div>

<div class="btn_confirm write_div">
<!-- <a href="<?php echo $list_href; ?>" class="btn_cancel btn">취소</a> -->
<button type="submit" id="btn_submit" accesskey="s" class="btn_submit btn" >작성완료</button>
<!-- <input type=button value=" close" onclick="opener.location.reload(); self.close(); "> -->

</form>

<script>
function html_auto_br(obj)
{
if (obj.checked) {
result = confirm("자동 줄바꿈을 하시겠습니까?\n\n자동 줄바꿈은 게시물 내용중 줄바뀐 곳을<br>태그로 변환하는 기능입니다.");
if (result)
obj.value = "2";
else
obj.value = "1";
}
else
obj.value = "";
}

function fwrite_submit(f)
{
<?php echo $editor_js; // 에디터 사용시 자바스크립트에서 내용을 폼필드로 넣어주며 내용이 입력되었는지 검사함 ?>

var subject = "";
var content = "";
$.ajax({
url: g5_bbs_url+"/ajax.filter.php",
type: "POST",
data: {
"subject": f.qa_subject.value,
"content": f.qa_content.value
},
dataType: "json",
async: false,
cache: false,
success: function(data, textStatus) {
subject = data.subject;
content = data.content;
}
});

if (subject) {
alert("제목에 금지단어('"+subject+"')가 포함되어있습니다");
f.qa_subject.focus();
return false;
}

if (content) {
alert("내용에 금지단어('"+content+"')가 포함되어있습니다");
if (typeof(ed_qa_content) != "undefined")
ed_qa_content.returnFalse();
else
f.qa_content.focus();
return false;
}

<?php if ($is_hp) { ?>
var hp = f.qa_hp.value.replace(/[0-9\-]/g, "");
if(hp.length > 0) {
alert("휴대폰번호는 숫자, - 으로만 입력해 주십시오.");
return false;
}
<?php } ?>

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

return true;

}

</script>


<!-- <script>
$(document).ready(function() {
$("#btn_submit").on('click', function(){
if (document.getElementById("qa_category").value==''){
alert("분류를 선택하세요.");
}else{
alert("성공적으로 발송되었습니다.");
}
});
});
</script> -->

</section>


<!-- } 게시물 작성/수정 끝 -->

[/code]
s
sosososo
4년 전
skin/qa/write.skin.php 에서

<script>
$(document).ready(function() {
$("#btn_submit").on('click', function(){
if (document.getElementById("qa_category").value==''){
alert("분류를 선택하세요.");
}else{
alert("성공적으로 발송되었습니다.");
}
});
});
</script>

입니다.

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

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

로그인