2012-09-12 4 views
0

도와주세요.동일한 버튼 열기 모델을 클릭하고 양식을 제출하십시오.

제출 버튼이있는 양식이 있습니다. 이제이 버튼의 클릭 이벤트에서 모달 창을 열고 싶습니다. 모달에서 나는 DB에 2 개의 버튼 (Cancel과 Push)을 삽입하기위한 텍스트 상자를 보여줄 필요가있다. 푸시를 클릭하면 DB에 데이터를 삽입하고 제출할 양식이 필요합니다. 은 어떻게 든 내가 부트 스트랩 - modal.js 하지만 난이 직면하고있는 문제는 내 양식 포인트 x.php하는 것입니다을 사용하고이

<form action="post_data.php" method="post"> 
    <!-- some elements --> 
    <input type ="submit" value = "Push data">  
</form> 

을 달성 할 수없는 나는 지금은 다음 부트 스트랩 모델을 열 필요가 있다면 내 제출 버튼에 대해 href = "mymodal_id"및 data-toggle = "modal"속성을 제공해야합니다. 난 내 페이지가 절대적으로 아무것도 :(하지 않습니다 그렇게한다면 :( 어떤 도움을 주시면 감사 줘야 제발 도와주세요 감사합니다 사전에

+0

을 당신은이 작업을 수행하기 위해 자바 스크립트를 사용할 필요가 당신을 도울 수 많은 프레임 워크가있다 즉 jQuery를 + 부트 스트랩이 좋은 일을이 :) 일 – Philipp

답변

3

사용 <a>이 모달 트리거 :. 제출하여 넣어 다음

<a href="#myModal" role="button" class="btn" data-toggle="modal">Launch demo modal</a> 

을 그리고 그 모달 내에서 취소 버튼 :

<div class="modal" id="myModal" tabindex="-1" role="dialog" aria-labelledby="myModalLabel" aria-hidden="true"> 
    <div class="modal-header"> 
     <button type="button" class="close" data-dismiss="modal" aria-hidden="true">×</button> 
     <h3 id="myModalLabel">Pushing to DB</h3> 
    </div> 
    <div class="modal-body"> 
     <p>You are going to push data</p> 
    </div> 
    <div class="modal-footer"> 
     <button type="button" class="btn" data-dismiss="modal" aria-hidden="true">Cancel</button> 
     <button type="submit" class="btn btn-primary" value="Push data">Push data</button> 
    </div> 
</div> 
+0

감사 할 :).. – Aditi

관련 문제