게시판 리스트 검색부분인데요~ 채택완료
</p>
<p> <fieldset class="bo_sch">
<form name="fsearch" method="get">
<input type="hidden" name="bo_table" value="<?php echo $bo_table ?>">
<input type="hidden" name="sca" value="<?php echo $sca ?>">
<input type="hidden" name="sop" value="and">
<input type="hidden" name="sfl" id="sfl" value="wr_subject||wr_content">
<div class="sch_bar">
<input type="text" name="stx" value="<?php echo stripslashes($stx) ?>" required id="stx" class="sch_input" size="25" maxlength="20" placeholder=" 검색어를 입력해주세요">
<button type="submit" value="검색" class="sch_btn"><i class="fa fa-search" aria-hidden="true"></i><span class="sound_only">검색</span></button>
</div>
</form>
</fieldset></p>
<p>
게시판 리스트페이지 상단에 제목+내용 선택하는 셀렉트박스 없이 히든값으로 처리하고
검색을 하면 자동으로 제목+내용에서 검색이 되게끔 하고 싶은데요.
찾아보고 히든값으로 했는데 이렇게 하니
undefined할 게시물을 하나 이상 선택하세요. 이렇게 나와요ㅠㅠ
셀렉트박스 부분을 <input type="hidden" name="sfl" id="sfl" value="wr_subject||wr_content"> 이렇게 처리했는데 밸류값이 적용이 안되는것 같아요~
이렇게 하면 안되는건가요?ㅠㅠㅠ
답변 4개
<option value="wr_subject||wr_content">제목+내용</option>
본래 select 로 위와 같이 되어잇는 것을 input hidden으로 만들어서 문제가 생긴 것이 아닙니다
undefined할 게시물을 하나 이상 선택하세요 <--이것은 복사나 삭제 버튼을 눌렀을 때
하단 자바스크립트에서 나오는 메세지이니 hidden으로 값을 넣어서 생긴 것이 아닙니다
서버에 sfl 값이 넘어오지않아서 생긴 에러가 아닙니다
다른 원인을 찾아보세요
답변에 대한 댓글 1개
댓글을 작성하려면 로그인이 필요합니다.
<div class="sch_bar">
<input type="text" name="stx" value="<?php echo stripslashes($stx) ?>" required id="stx" class="sch_input" size="25" maxlength="20" placeholder="검색어를 입력해주세요">
<select id="search_select">
<option value="wr_subject||wr_content">제목+내용</option>
<option value="wr_subject">제목</option>
<option value="wr_content">내용</option>
</select>
<button type="submit" value="검색" class="sch_btn"><i class="fa fa-search" aria-hidden="true"></i><span class="sound_only">검색</span></button>
</div>
select 해줘야 하지 않을까요?
답변에 대한 댓글 1개
<script>
document.getElementById('search_select').addEventListener('change', function () {
var selectedOption = this.value;
document.getElementById('sfl').value = selectedOption;
});
</script>
댓글을 작성하려면 로그인이 필요합니다.
답변에 대한 댓글 1개
function all_checked(sw) {
var f = document.fboardlist;
for (var i=0; i<f.length; i++) {
if (f.elements[i].name == "chk_wr_id[]")
f.elements[i].checked = sw;
}
}
function fboardlist_submit(f) {
var chk_count = 0;
for (var i=0; i<f.length; i++) {
if (f.elements[i].name == "chk_wr_id[]" && f.elements[i].checked)
chk_count++;
}
if (!chk_count) {
alert(document.pressed + "할 게시물을 하나 이상 선택하세요.");
return false;
}
if(document.pressed == "선택복사") {
select_copy("copy");
return;
}
if(document.pressed == "선택이동") {
select_copy("move");
return;
}
if(document.pressed == "선택삭제") {
if (!confirm("선택한 게시물을 정말 삭제하시겠습니까?\n\n한번 삭제한 자료는 복구할 수 없습니다\n\n답변글이 있는 게시글을 선택하신 경우\n답변글도 선택하셔야 게시글이 삭제됩니다."))
return false;
f.removeAttribute("target");
f.action = g5_bbs_url+"/board_list_update.php";
}
return true;
}
// 선택한 게시물 복사 및 이동
function select_copy(sw) {
var f = document.fboardlist;
if (sw == "copy")
str = "복사";
else
str = "이동";
var sub_win = window.open("", "move", "left=50, top=50, width=500, height=550, scrollbars=1");
f.sw.value = sw;
f.target = "move";
f.action = g5_bbs_url+"/move.php";
f.submit();
}
// 게시판 리스트 관리자 옵션
jQuery(function($){
$(".btn_more_opt.is_list_btn").on("click", function(e) {
e.stopPropagation();
$(".more_opt.is_list_btn").toggle();
});
$(document).on("click", function (e) {
if(!$(e.target).closest('.is_list_btn').length) {
$(".more_opt.is_list_btn").hide();
}
});
});
</script>
[/code]
해당 리스트스킨 페이지 스크립트 부분입니다^^
댓글을 작성하려면 로그인이 필요합니다.
그렇게 하면 서버에서 sfl 네임으로 넣어온 값이 wr_subject||wr_content 일테니, 서버측에서 explode 함수 이용해 || 기준으로 쪼개서 배열로 만든 후 해당 배열값을 이용해 구현하는 작업을 따로 하셔야 할 듯....
답변에 대한 댓글 5개
지금은 얼럿이 하실 항목을 하나 이상 선택하세요. 라고 나오거든요~
그 얼럿부분을 또 주석처리하고 해보니 그 아래있는
올바른 방법으로 이용해 주세요. 라고 나오고ㅠㅠㅠ
bbs/board_list_update.php가 아래와 같은데
$post_btn_submit 이 변수 문제인거같은데
이변수가 게시판 글이 선택이 안되었다는걸까요?ㅠㅠㅠ
보통 게시판내에서 검색 할 때 선택하고 하지는 않는데..
어떤 부분이 잘못된건지 모르겠어요ㅠㅠ
어느부분을 더 살펴봐야할까요?
아 참고로 카테고리 분류값이 있어요~ 게시판내에~
이게 문제가 될 수도 있을것 같아서요~
[code]
<?php
include_once('./_common.php');
$count = (isset($_POST['chk_wr_id']) && is_array($_POST['chk_wr_id'])) ? count($_POST['chk_wr_id']) : 0;
$post_btn_submit = isset($_POST['btn_submit']) ? clean_xss_tags($_POST['btn_submit'], 1, 1) : '';
if(!$count) {
alert(addcslashes($post_btn_submit, '"\\/').' 하실 항목을 하나 이상 선택하세요.');
}
if($post_btn_submit === '선택삭제') {
include './delete_all.php';
} else if($post_btn_submit === '선택복사') {
$sw = 'copy';
include './move.php';
} else if($post_btn_submit === '선택이동') {
$sw = 'move';
include './move.php';
} else {
alert('올바른 방법으로 이용해 주세요.');
}
[/code]
아마, 리스트스킨이면 /bbs/list.php 파일 하단으로 인클루드 될테고,
/bbs/list.php 파일 상단에서 하지 않을까 싶네요.
댓글을 작성하려면 로그인이 필요합니다.
답변을 작성하려면 로그인이 필요합니다.
로그인
폼 액션에 있는 bbs/board_list_update.php에 있는 내용이 맞네요~
지금은 얼럿이 하실 항목을 하나 이상 선택하세요. 라고 나오거든요~
그 얼럿부분을 또 주석처리하고 해보니 그 아래있는
올바른 방법으로 이용해 주세요. 라고 나오고ㅠㅠㅠ
bbs/board_list_update.php가 아래와 같은데
$post_btn_submit 이 변수 문제인거같은데
이변수가 게시판 글이 선택이 안되었다는걸까요?
보통 게시판내에서 검색 할 때 선택하고 하지는 않는데..
어떤 부분이 잘못된건지 모르겠어요ㅠㅠ
어느부분을 더 살펴봐야할까요?
아 참고로 카테고리 분류값이 있어요~ 게시판내에~
이게 문제가 될 수도 있을것 같아서요~
[code]
<?php
include_once('./_common.php');
$count = (isset($_POST['chk_wr_id']) && is_array($_POST['chk_wr_id'])) ? count($_POST['chk_wr_id']) : 0;
$post_btn_submit = isset($_POST['btn_submit']) ? clean_xss_tags($_POST['btn_submit'], 1, 1) : '';
if(!$count) {
alert(addcslashes($post_btn_submit, '"\\/').' 하실 항목을 하나 이상 선택하세요.');
}
if($post_btn_submit === '선택삭제') {
include './delete_all.php';
} else if($post_btn_submit === '선택복사') {
$sw = 'copy';
include './move.php';
} else if($post_btn_submit === '선택이동') {
$sw = 'move';
include './move.php';
} else {
alert('올바른 방법으로 이용해 주세요.');
}
[/code]