T

게시판관리 그룹아이디 자동입력 기능

게시판관리에서 검색시 셀렉트 박스 그룹 아이디 선택시 그룹아이디가 기억안날때가 많은대요..
그부분을 셀렉트 박스로 처리하여 선택시 자동 입력 할수있게 바꿔봤습니다.

adm/board_list.php 파일

html 부분

<!-- 수정전 -->
<form name=fsearch method=get>
<tr>
    <td width=50% align=left><?=$listall?> (게시판수 : <?=number_format($total_count)?>개)</td>
    <td width=50% align=right>
        <select name=sfl>
            <option value='bo_table'>TABLE</option>
            <option value='bo_subject'>제목</option>
            <option value='a.gr_id'>그룹ID</option>
        </select>
        <input type=text name=stx required itemname='검색어' value='<?=$stx?>'>
        <input type=image src='<?=$g4[admin_path]?>/img/btn_search.gif' align=absmiddle></td>
</tr>
</form>

<!-- 수정후 -->
<form name=fsearch method=get>
<tr>
    <td width=50% align=left><?=$listall?> (게시판수 : <?=number_format($total_count)?>개)</td>
    <td width=50% align=right>
        <select name=sfl onchange="gr_select_visibility(this.value);">
            <option value='bo_table'>TABLE</option>
            <option value='bo_subject'>제목</option>
            <option value='a.gr_id'>그룹ID</option>
        </select>
  <?=get_group_select("sca",$sca," id=\"sca\" onchange=\"gr_input_get(this.value);\"");?>
        <input type=text id=stx name=stx required itemname='검색어' value='<?=$stx?>'>
        <input type=image src='<?=$g4[admin_path]?>/img/btn_search.gif' align=absmiddle></td>
</tr>
</form>




하단 scr<!- XSS Filter -->ipt 부분

// 수정전

function board_copy(bo_table) {
    window.open("./board_copy.php?bo_table="+bo_table, "BoardCopy", "left=10,top=10,width=500,height=200");
}

// 수정후

if(document.getElementById('sfl').value != "a.gr_id"){
 document.getElementById('sca').disabled = "disabled";
}
function gr_select_visibility(v){
 if(v == "a.gr_id"){
  document.getElementById('sca').disabled = "";
  document.getElementById('stx').value = document.getElementById('sca').options[0].value;
  document.getElementById('sca').options[0].selected = true;
 }else{
  document.getElementById('sca').disabled = "disabled";
  document.getElementById('stx').value = "";
 }
}
function gr_input_get(v){
 document.getElementById('stx').value = v;
}
function board_copy(bo_table) {
    window.open("./board_copy.php?bo_table="+bo_table, "BoardCopy", "left=10,top=10,width=500,height=200");
}

|

댓글 1개

좋은 팁이네요 감사합니다.

댓글 작성

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

로그인하기
🐛 버그신고