2014-05-07 63 views
1

我有一個刪除鏈接,爲此我使用引導模態窗口。這裏窗口顯示正常當我點擊窗口的yes按鈕時,記錄應該被刪除。所以我必須在yes按鈕中調用servlet以及參數Id,在這裏我可以調用servlet,但參數不通過。如何將參數傳遞給模式窗口的yes按鈕。這是它的代碼。將參數傳遞到引導模態按鈕

的引導模式,其中我打電話,

<td><a href="<%=request.getContextPath()%>/pages/teacher_details/teacher_info.jsp?teacherId=${teacher.getTeacherId()}">Edit</a> 
</td> 
<td> <a href="#" data-toggle="modal" data-target="#basicModal">Delete</a> 
</td> 
在同一個jsp頁面模式的標記是

<div class="modal fade" id="basicModal" tabindex="-1" role="dialog" aria-labelledby="basicModal" aria-hidden="true"> 
    <div class="modal-dialog"> 
    <div class="modal-content"> 
     <div class="modal-header"> 
     <button type="button" class="close" data-dismiss="modal" aria-hidden="true">&times;</button> 
     <h4 class="modal-title" id="myModalLabel">Delete Teacher Record</h4> 
     </div> 
     <div class="modal-body"> 
     <h3>Are you sure?</h3> 
     </div> 
     <div class="modal-footer"> 
     <button type="button" class="btn btn-default" data-dismiss="modal">No</button> 
     <!-- <button type="button" class="btn btn-primary">Save changes</button> --> 
     <a href="<%=request.getContextPath()%>/controller/TeacherManagementController?flowName=DELETE_TEACHER_INFO&teacherId=${teacherId.getTeacherId()}" 
        class="btn btn-primary">Yes</a> 
     </div> 
    </div> 
    </div> 
</div> 

我現在面臨的問題是進行模態出現,但戰績不能刪除,因爲無法通過teacherId。請任何人在這幫助我。

回答

0

我使用這樣的呼叫功能和值分配給隱藏字段

HTML:

<div id="add_button" > 
    <a data-toggle="modal" href="#myModal_new" onClick="pop_up('<?php echo  $section_value['subject_name']; ?>','<?php echo $section_value['section_id']; ?>')">Add Subjects</a> 
    </div> 





    <script> 
    function pop_up(name,id){ 
    var standard = document.getElementById("standard"); 
    var standard_id = document.getElementById("standard_id"); 
    var standard_id_new = document.getElementById("standard_id_new"); 

    standard.value = name; 
    standard_id.value = id; 
    standard_id_new.value = id; 
    } 
    </script> 



<div id="myModal_new" class="modal hide fade"> 
    <div class="modal-dialog"> 
     <div class="modal-content"> 
     <div class="modal-header"> 
      <button type="button" class="close" data-dismiss="modal">&times;</button> 
      <h3>Create Sections</h3> 
     </div><br><br> 
     <div id="errorContainers"> 
       <p>Please correct the errors and try again:</p> 
       <ul /> 
      </div> 
     <div class="modal-body" style="margin-left: 17%;"> 
      <!-- Modal Form Starts Here --> 
       <form name="modalForm" id="formss" method="post"> 
        <input type="hidden" name="standard" id="standard"> 
        <input type="hidden" name="standard_id" id="standard_id"> 
         <input type="hidden" name="standard_id_new" id="standard_id_new"> 
         <fieldset> 
          <div class="division_center"><div class="division_left"><label class="form-signin-signup" for="input1">Sections </label> </div> 
          <div class="division_right"> 
          &nbsp;<input type="text" name="standard_new" id="standard_new"> </div></div>        
          </fieldset> 

      <!-- Modal Form Ends Here --> 
     </div> 
     <div class="modal-footer"> 
      <a class="btn" data-dismiss="modal" >Close</a> 
      <input type="submit" name="newsubmit" class="btn btn-primary btn-large" value="Create"> 
     </div> 
     </form> 
     </div> 
     </div> 
     </div> 
+0

ķ。 。在我的情況下,我怎樣才能設置隱藏的字段值 – user3599482