http://designfusion.co.kr/index.php?module=Inquiry&action=SiteInquiry&iInquiryNo=1&sMode=INSERT_FORM
욕실공사 쪽에 보시면 체크박스와 셀렉트 입력폼 동시 적용하는 칸이있는데요 아무리 며칠을 해봐도 어려워서요ㅠ 도움 요청드립니다.
<div class="kboard-attr-row">
<label class="attr-name" for="kboard_option_inquiry_type">욕실공사</label>
<div class="attr-value">
<label>
<input type="hidden" name="kboard_option_type" value="">
<input type="checkbox" name="kboard_option_type" value="거실욕실"<?php if($content->option->type == '거실욕실'):?> checked<?php endif?>>거실욕실
<select id="kboard_option_inquiry_type" name="kboard_option_inquiry_type">
<option value="">선택하세요</option>
<option value="샤워부스"<?php if($content->option->inquiry_type == '샤워부스'):?> selected<?php endif?>>샤워부스</option>
<option value="파티션"<?php if($content->option->inquiry_type == '파티션'):?> selected<?php endif?>>파티션</option>
<option value="욕조"<?php if($content->option->inquiry_type == '욕조'):?> selected<?php endif?>>욕조</option>
</select>
<input type="checkbox" name="kboard_option_type" value="안방욕실"<?php if($content->option->type == '안방욕실'):?> checked<?php endif?>>안방욕실
<select id="kboard_option_inquiry_type02" name="kboard_option_inquiry_type02">
<option value="">선택하세요</option>
<option value="샤워부스"<?php if($content->option->inquiry_type02 == '샤워부스'):?> selected<?php endif?>>샤워부스</option>
<option value="파티션"<?php if($content->option->inquiry_type02 == '파티션'):?> selected<?php endif?>>파티션</option>
<option value="욕조"<?php if($content->option->inquiry_type02 == '욕조'):?> selected<?php endif?>>욕조</option>
<option value="설치공간없음"<?php if($content->option->inquiry_type02 == '설치공간없음'):?> selected<?php endif?>>설치공간없음</option>
</select>
</label>
</div>
</div>
editor.php 에는 위에처럼하고
<th>욕실공사</th>
<td><?php echo $content->option->type? '거실욕실' : '안방욕실'?>
<?php echo $content->option->inquiry_type?></td>
document.php 파일에는 위에처럼 했는데
안방욕실이 클릭안했는데 나오고 그러네요; 셀렉트는 먹는데 하나만 해서 하나만 먹고요ㅠㅠ
체크박스에 선택안하면 셀렉트박스가 비활성화 되고 이런기능 넣고싶은데 안되네요
혹시 도움주실수있으신가요^^
안녕하세요~^^
올려주신 코드 대신 아래의 코드를 활용해보시겠어요?
<style>
#kboard-default-editor select#kboard_option_inquiry_type,
#kboard-default-editor select#kboard_option_inquiry_type02 { display: none; }
#kboard-default-editor #kboard_option_inquiry_type.active,
#kboard-default-editor #kboard_option_inquiry_type02.active { display: inline; }
</style>
<script>
function kboard_checkbox_click(obj, id){
console.log(obj, id);
if(jQuery(obj).prop('checked')){
jQuery('#'+id).addClass('active');
}
else{
jQuery('#'+id).removeClass('active');
}
}
</script>
<div class="kboard-attr-row">
<label class="attr-name" for="kboard_option_inquiry_type">욕실공사</label>
<div class="attr-value">
<input type="hidden" name="kboard_option_type[]" value="">
<label>
<input type="checkbox" name="kboard_option_type[]" value="거실욕실"<?php if(in_array('거실욕실', $content->option->type)):?> checked<?php endif?> onclick="kboard_checkbox_click(this, 'kboard_option_inquiry_type');">거실욕실
</label>
<select id="kboard_option_inquiry_type" name="kboard_option_inquiry_type"<?php if(in_array('거실욕실', $content->option->type)):?> class="active"<?php endif?>>
<option value="">선택하세요</option>
<option value="샤워부스"<?php if($content->option->inquiry_type == '샤워부스'):?> selected<?php endif?>>샤워부스</option>
<option value="파티션"<?php if($content->option->inquiry_type == '파티션'):?> selected<?php endif?>>파티션</option>
<option value="욕조"<?php if($content->option->inquiry_type == '욕조'):?> selected<?php endif?>>욕조</option>
</select>
<label>
<input type="checkbox" name="kboard_option_type[]" value="안방욕실"<?php if(in_array('안방욕실', $content->option->type)):?> checked<?php endif?> onclick="kboard_checkbox_click(this, 'kboard_option_inquiry_type02');">안방욕실
</label>
<select id="kboard_option_inquiry_type02" name="kboard_option_inquiry_type02"<?php if(in_array('안방욕실', $content->option->type)):?> class="active"<?php endif?>>
<option value="">선택하세요</option>
<option value="샤워부스"<?php if($content->option->inquiry_type02 == '샤워부스'):?> selected<?php endif?>>샤워부스</option>
<option value="파티션"<?php if($content->option->inquiry_type02 == '파티션'):?> selected<?php endif?>>파티션</option>
<option value="욕조"<?php if($content->option->inquiry_type02 == '욕조'):?> selected<?php endif?>>욕조</option>
<option value="설치공간없음"<?php if($content->option->inquiry_type02 == '설치공간없음'):?> selected<?php endif?>>설치공간없음</option>
</select>
</div>
</div>
커뮤니티에서는 모든 코드를 일일이 만들어 드리긴 어렵습니다.
직접 코드를 작성하기 어려우시다면
프로젝트 의뢰에 상세 내용을 올려보세요.
https://www.cosmosfarm.com/project/
고맙습니다.