form 질문 좀 드리겠습니다.
본문
안녕하세요 질문좀 드리겠습니다.
현재 셀렉트 박스 선택 후 검색까지 눌러야만 되는데
검색없이 셀렉트 박스 선택하면 셀렉트 값으로 넘어가게 할려면 어떻게 해야할까요`?
<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" value="wr_11">
<div class="vox">
<p>담당자</p>
<select name="wr_11" id="wr_11_select" onchange="updateWr9Options()" style="width: 150px;">
<option value="">전체</option>
<option value="1" <?php echo ($_GET['wr_11'] == '1') ? 'selected' : ''; ?>>1</option>
</select>
</div>
<div class="vox">
<p>담당부서</p>
<select name="wr_12" id="wr_12_select" style="width: 150px;">
<option value="">전체</option>
<option value="4" <?php echo ($_GET['wr_12'] == '4') ? 'selected' : ''; ?>>4</option>
</select>
</div>
<div class="vox">
<p>고객사유형</p>
<select name="wr_13" id="wr_13_select" style="width: 120px;">
<option value="">전체</option>
<option value="2" <?php echo ($_GET['wr_13'] == '2') ? 'selected' : ''; ?>>2</option>
</select>
</div>
<div class="vox">
<p>고객사구분</p>
<select name="wr_14" id="wr_14_select" style="width: 150px;">
<option value="">전체</option>
<option value="1" <?php echo ($_GET['wr_14'] == '1') ? 'selected' : ''; ?>>1</option>
</select>
</div>
<div class="vox">
<p>거래실적</p>
<select name="wr_15" id="wr_15_select" style="width: 100px;">
<option value="">전체</option>
<option value="VL" <?php echo ($_GET['wr_15'] == 'VL') ? 'selected' : ''; ?>>VL</option>
</select>
</div>
<button type="submit" value="검색" class="sch_btn">
<i class="fa fa-search" aria-hidden="true"></i><span class="sound_only">검색</span>
</button>
</form>
답변 4
담당부서를 변경 했을 경우 submit 하는 방법입니다.
<select name="wr_12" id="wr_12_select" style="width: 150px;" onchange="aaa();" >
<option value="">전체</option>
<option value="4" <?php echo ($_GET['wr_12'] == '4') ? 'selected' : ''; ?>>4</option>
</select>
<script>
function aaa(){
var form = document.fsearch;
form.submit();
}
</script>
<script>
$(function() {
$(document).on("change","#wr_12_select",function() {
$('[name="fsearch"]').trigger("submit");
});
});
</script>
f12 누르셔서 콘솔탭 에러 채크하세요.
자바스크립트의 경우 선행 오류가 있으면 후행 명령어가 다 죽어버립니다.
답변을 작성하시기 전에 로그인 해주세요.