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

답변글에 답변을 달면, Option값이 자동으로 변경되게 하려고 합니다. 채택완료

관리자 페이지에서 올라온 글에 답변을 달고, 버튼을 누르면

 

해당 OPTION태그의 값을 [접수중]에서 [답변완료]로 변경시키려고 합니다.

 

이런 경우 write.skin.php에서

 

fwrite_submit(f)에 f.ca_name.value = "답변완료"로 처리하면 되는거라 생각했는데

 

f.ca_name의 값을 지정해주기 전에는 ca_name.value가 변경 되지않고 submit버튼에 따라 리스트로 이동이 되었는데

 

지정해준 뒤에는 리스트로 이동이 되지 않습니다.

 

무엇때문에 페이지 이동이 되지 않는 건지 다른 분들의 조언 부탁드립니다.

 

</p><p>//write.skin.php
<?
$body_mode = "pop";
if (!defined("_GNUBOARD_")) exit; // 개별 페이지 접근 불가
if ($is_dhtml_editor) {
    include_once("$g4[path]/lib/cheditor4.lib.php");
    echo "<script src='$g4[cheditor4_path]/cheditor.js'></script>";
    echo cheditor1('wr_content', '100%', '250');
}
$updatetime=date('Y-m-d H:i:s');
?>

<script language='Javascript' src='<?=$board_skin_path?>/sms.js'></script>
        <form name="fwrite" method="post" onsubmit="return fwrite_submit(this);" enctype="multipart/form-data" target='hiddenframe'>
        <input type=hidden name=null> 
        <input type=hidden name=w        value="<?=$w?>">
        <input type=hidden name=bo_table value="<?=$bo_table?>">
        <input type=hidden name=wr_id    value="<?=$wr_id?>">
        <input type=hidden name=sca      value="<?=$sca?>">
        <input type=hidden name=sfl      value="<?=$sfl?>">
        <input type=hidden name=stx      value="<?=$stx?>">
        <input type=hidden name=spt      value="<?=$spt?>">
        <input type=hidden name=sst      value="<?=$sst?>">
        <input type=hidden name=sod      value="<?=$sod?>">
        <input type=hidden name=page     value="<?=$page?>">
        <input type=hidden name=secret     value="secret">
        <input type=hidden name=wr_1     value="<?=$write[wr_1]?>">
        <input type=hidden name=wr_4     value="<?=$write[wr_4]?>">
    <div style='float:left;width:300px;'>
        <table width="100%" border="0" cellspacing="0" cellpadding="0" class=brd_col>
            <colgroup width=80 />
            <colgroup width='' />
            <? if ($is_name) { ?>
            <tr>
                <td class=brd_col1><img src='/images/bbs/field_name.gif'></td>
                <td class=brd_col2><input class='box01' maxlength=20 size=15 name=wr_name itemname="이름" required value="<?=$name?>"></td>
            </tr>
            <? } ?>
            <? if ($is_category) { ?>
            <tr>
                <td class=brd_col1>상태</td>
                <td class=brd_col2><select name=ca_name required itemname="분류"><option value="">선택하세요<?=$category_option?></select></td>
            </tr>
            <? } ?>
            <tr style='display:none;'>
                <td class=brd_col1>나이</td>
                <td class=brd_col2><input class='box01' style="width:100%;" name=wr_1 id="wr_1" itemname="나이" required value="<?=$write[wr_1]?>"></td>
            </tr>
            <tr style='display:;'>
                <td class=brd_col1>핸드폰번호</td>
                <td class=brd_col2><input class='box01' style="width:100%;" name=wr_subject id="wr_subject" itemname="핸드폰번호" required value="<?=$subject?>" readonly></td>
            </tr>
            <tr style='display:;'>
                <td class=brd_col1>질문내용</td>
                <td class=brd_col2>
                    <div style='float:left;' class='box01'><textarea style='float:left;margin:10px;width:93px;height:93px;background-color:transparent;overflow:hidden;border:none;' name=wr_content id="wr_content" itemname="제목" required readonly><?=$content?></textarea></div>
                </td>
            </tr>
        </table>
    </div>
    <div style='float:left;width:150px;margin-left:15px;'>
        <div style="margin:auto; width:140px; background-color:#F8F8F8; border:1px solid #ccc; text-align:center; margin-bottom:5px;">
            <div style="margin:auto; background-image:url('/admin/sms_admin/img/smsbg.gif'); width:120px; height:120px; margin-top:8px;text-align:center;">
                <textarea id="wr_10" name="wr_10"  style="font-family:굴림체; color:#000; line-height:110%;margin:auto; margin-top:20px; overflow: hidden; width:116px; height:88px; font-size: 9pt; border:0; background-color:transparent;" cols="16" itemname="답변"  class='lcd' <? if(!$write[wr_10]){?>onclick='NSMS_doClear(this)' onselect='NSMS_doClear(this)' onkeyup='NSMS_calByte(this)'<?}else{?>readonly<?}?> 
            <? if ($write_min || $write_max) { ?>onkeyup="check_byte('wr_10', 'char_count');"<?}?>><?=$write[wr_10]?></textarea>
        
            </div>
            <div style="text-align:center; margin:5px 0 5px 0;"><span id=msgByte>0</span> / 80 byte</div>
        </div>
        <div style='float:left;width:145px;clear:both;'>
            <div>
                <b>회신번호</b>
                <input type=text name=wr_9 id=wr_9 required itemname='회신번호' style="width:90px;" maxlength=20 value="<?=$config[cf_1]?>" class='box02' readonly>
                <input type=text name=wr_8 id=wr_8 value="<?=$updatetime?>">
            </div>
            <? if(!$write[wr_10]){?>
            <div style="text-align:center; margin-top:5px;">
                <input type=submit id="btn_submit" class=btn1 tabindex=6 value='  전 송 하 기  ' style="width:100%; height:30px;" accesskey='s' align='absmiddle'>
            </div>
            <?}?>
        </div>
        <div class='board_button'>
            <input type=submit id="btn_submit" class=btn1 value='답변완료' accesskey='s' align='absmiddle'style="width:70px; height:30px;"> 
            <input type=button class=btn1 value='목록으로' align='absmiddle'style="width:70px; height:30px;" onClick='location.href="./board.php?bo_table=<?=$bo_table?>";'> 
        </div>
    </div>
</form>

<script type="text/javascript">
<?
// 관리자라면 분류 선택에 '공지' 옵션을 추가함
if ($is_admin) 
{
    echo "
    if (typeof(document.fwrite.ca_name) != 'undefined')
    {
        document.fwrite.ca_name.options.length += 1;
        document.fwrite.ca_name.options[document.fwrite.ca_name.options.length-1].value = '공지';
        document.fwrite.ca_name.options[document.fwrite.ca_name.options.length-1].text = '공지';
    }";
} 
?>
with (document.fwrite) 
{
    if (typeof(wr_name) != "undefined")
        wr_name.focus();
    else if (typeof(wr_subject) != "undefined")
        wr_subject.focus();

    if (typeof(ca_name) != "undefined")
        if (w.value == "u")
            ca_name.value = "<?=$write[ca_name]?>";
}
function fwrite_submit(f) 
{
    if (document.getElementById('tx_wr_content')) {
        if (!ed_wr_content.outputBodyText()) { 
            alert('내용을 입력하십시오.'); 
            ed_wr_content.returnFalse();
            return false;
        }
    }
    

    var subject = "";
    var content = "";
    $.ajax({
        url: "<?=$board_skin_path?>/ajax.filter.php",
        type: "POST",
        data: {
            "subject": f.wr_subject.value,
            "content": f.wr_content.value
        },
        dataType: "json",
        async: false,
        cache: false,
        success: function(data, textStatus) {
            subject = data.subject;
            content = data.content;
        }
    });

    document.getElementById('btn_submit').disabled = true;
    //document.getElementById('btn_list').disabled = true;
    
    f.ca_name.value = "답변완료";
    
    <?
    if ($g4[https_url])
        echo "f.action = '$g4[https_url]/$g4[bbs]/write_update.php';";
    else
        echo "f.action = './write_update.php';";
    ?>
    return true;
}
</script>

<script language="JavaScript" src="<?="$g4[path]/js/board.js"?>"></script>
<script language="JavaScript"> window.onload=function() { drawFont(); } </script>
 </p><p>

 

</p><p>//write_update.skin.php</p><p>$sql = " update $write_table set ca_name = '답변완료'
                    $sql_password 
                     where wr_id = '$wr[wr_id]' "; 
    sql_query($sql);
    alert("답변이 완료되었습니다." /*. $qstr*/); </p><p>
 

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

답변 2개

채택된 답변
+20 포인트

 

id="ca_name"

 

추가해주시고.

 

 

 

f.ca_name.value = "답변완료";

 

 

docu​ment.getElementById("ca_name").value = "답변완료";

 

이렇게 해보세요.

 

 

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

답변에 대한 댓글 1개

write.skin.php에서 f.ca_name.value 나 docu​ment.getElementById("ca_name").value나

값은 박히는데, 그 뒤에 리스트 페이지로 정상 이동이 되질 않네요. 저 구문이 없었을 때는 리스트로 이동이 되었거든요

혹시 제가 놓치고 있는 게 있을까요?

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

write_update.skin.php

alert("답변이 완료되었습니다." ); 

 

 

메시지 출력후 뒤로 가기 입니다.

 

 

if ($g4[https_url])

    $https_url = "$g4[url]/$g4[bbs]";

else

    $https_url = "."; 

alert("답변이 완료되었습니다.", "{$https_url}/board.php?bo_table=$bo_table");

이렇게 해보세요. 

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

답변에 대한 댓글 1개

말씀해주신 대로 하니깐, write.skin.php에서는 정상 적용이 되는데

list.skin.php에서는 이전의 ca_name값을 그대로 가지고 있습니다.

리스트 페이지에서 ca_name 출력하는 곳은

<? if($list[$i][ca_name] == "접수중"){ echo "style='color:#cc0000;'";}else{ echo "style='color:#c0c0c0;'";}?>><?=$list[$i][ca_name]?>

단순히 이렇게만인데 이런 경우에 뭐가 문제여서 리스트에서 반영이 안 되는 걸까요?

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

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

로그인

전체 질문 목록

🐛 버그신고