버튼클릭시 나타나지만 글수정시 유지가 되지 않네요.

버튼클릭시 나타나지만 글수정시 유지가 되지 않네요.

QA

버튼클릭시 나타나지만 글수정시 유지가 되지 않네요.

본문

안녕하세요. 눈팅으로 거의 해결했지만 아무리 해도 안되서 문의합니다.

 

영카트 문의글 보면서

입력필드테이블을 버튼으로 추가해서 추가인원이 있을경우 더 입력할 수 있게 버튼을 만들었습니다.

 

문제는 글을 수정하면 

버튼으로 추가한 테이블들은 다시 닫혀 있습니다. (내용은 유지됩니다. 다시 버튼을 눌러야 보입니다.)

 

버튼으로 추가해서 입력한 테이블에 내용이 있으면

글 수정시 추가한 테이블이 버튼을 누르지 않아도 보이게 할 수 없을까요?

 


<table class="div-table table">
  <col width="200">
<tbody>
  <tr>
    <th scope="row" >이름</th>
     <th><input name="wr_8" type="text" class="frm_input" value="<?=$wr_8?>" size="20">
</th></tr>
     
  <tr>
    <th scope="row" >연락처</th>
     <th><input name="wr_9" type="text" class="frm_input" value="<?=$wr_9?>" size="20">
</th></tr>    
        
  <tr>
    <th scope="row" >소속</th>
     <th><input name="wr_10" type="text" class="frm_input" value="<?=$wr_10?>" size="20">
</th></tr>         
 
  <tr><th colspan="2" bgcolor="#Ffffff" style="text-align:right;" scope="row">
 <button type="button" id="tg_Btn">인원 추가/닫기</button>
<script>
$(document).ready(function(){
$('#tg_Btn').click(function(){
$('#pro2').fadeToggle();  //버튼클릭시 나타나고 사라지고
});
});
</script></th></tr> 
 </tbody> 
</table>
 
 
<!-- 추가인원 --> 
<table id="pro2" style="display:none"  class="div-table table">
  <col width="200">
<tbody>
  <tr>
    <th scope="row" >이름</th>
     <th><input name="wr_11" type="text" class="frm_input" value="<?=$wr_11?>" size="20">
</th></tr>
     
  <tr>
    <th scope="row" >연락처</th>
     <th><input name="wr_12" type="text" class="frm_input" value="<?=$wr_12?>" size="20">
</th></tr>    
        
  <tr>
    <th scope="row" >소속</th>
     <th><input name="wr_13" type="text" class="frm_input" value="<?=$wr_13?>" size="20">
</th></tr>
  <tr><th colspan="2" bgcolor="#Ffffff" style="text-align:right;" scope="row">
 <button type="button" id="tg_Btn2">인원 추가/닫기</button>
<script>
$(document).ready(function(){
$('#tg_Btn2').click(function(){
$('#pro3').fadeToggle();  //버튼클릭시 나타나고 사라지고
});
});
</script></th></tr> 
 </tbody> 
</table>

이 질문에 댓글 쓰기 :

답변 2


<table id="pro2" style="<?php if($wr_11) echo "display:block;"; else echo "display:none";?> class="div-table table">

답변 감사합니다.
위 소스 적용해보니 수정할때는 잘되지만  처음 글쓰기할때도 추가입력필드가 보입니다.
처음 글쓰기 할때는 추가필드가 보이지 않다가 추가필드를 생성하거나 입력하면 글 수정시
보이게 할 수는 없나요?

볼피드님이 잘 해결해 주셨네요 .  

style="<?php if($wr_11) echo "display:block;"; else echo "display:none";?> 에 실수로 " 부분을 빠뜨리신듯합니다. 

style="<?php if($wr_11) echo "display:block;"; else echo "display:none";?>" ("만 넣어 주시면 되실듯합니다);

답변을 작성하시기 전에 로그인 해주세요.
전체 149
QA 내용 검색

회원로그인

(주)에스아이알소프트 / 대표:홍석명 / (06211) 서울특별시 강남구 역삼동 707-34 한신인터밸리24 서관 1404호 / E-Mail: admin@sir.kr
사업자등록번호: 217-81-36347 / 통신판매업신고번호:2014-서울강남-02098호 / 개인정보보호책임자:김민섭(minsup@sir.kr)
© SIRSOFT