2013-02-28 72 views
0

我需要爲我的表添加一個函數,所以當通過複選框選中多行並按下「select」按鈕時,應該彈出另一個JSP頁面來提交選定的行。我想要「選擇」按鈕來選擇行並彈出提交頁面進行提交。提交選中的複選框

enter image description here enter image description here

表JSP:

<table id="summaryTable" class="tablesorter" > 
<thead> 
<tr> 
<th>&nbsp;</th> 
<th>Bar Code</th> 
<th>Origin</th> 
<th>Sender Name</th> 
<th>Recipient Name</th> 
<th>Receipt Date</th> 
<th>Load Date</th> 
<th>Forecast ISC</th> 
<th>Actual ISC</th> 
<th>Country</th> 
<th>Source</th> 
<th><input type="submit" name="selectCheckBox" value="Select"></th> 
</tr> 
</thead> 
<tbody> 
<tr> 
<c:forEach items="${summary}" var="summary"> 

<tr> 
<td><c:out value="${summary.eventDesc}" /></td> 
<td><c:out value="${summary.labelNbr}" /></td> 
<td><c:out value="${summary.origin}" /></td> 
<td><c:out value="${summary.senderName}" /></td> 
    <td><c:out value="${summary.receiverName}" /></td> 
    <td><c:out value="${summary.receiptDate}" /></td> 
    <td><c:out value="${summary.loadDate}" /></td> 
<td><c:out value="${summary.forecastIsc}" /></td> 
    <td><c:out value="${summary.actualIsc}" /></td> 
    <td><c:out value="${summary.country}" /></td> 
    <td><c:out value="${summary.source}" /></td> 
    <td><input type="checkbox" value=""></td> 
    </tr> 
    </c:forEach> 

回答

0

你好,這是檢查選擇框的代碼,但我不明白,你到底要以後做什麼。

  $.each($("input[type=checkbox]:checked"),function(){ 
       //your code here 
      }); 
+0

謝謝您的回答一樣。如果你發現我在複選框列標題選擇按鈕。我需要該選擇按鈕來選擇表格中的所有選中框,然後將其提交到另一個jsp頁面以供最終提交。 – Fahad 2013-02-28 20:51:56

0

您能否清除'popup submit page'部分? 對於第一部分的代碼應該是這個

$('[name="selectCheckBox"]').on('click', function() { 
    $('[type="checkbox"]').prop('checked', true); 
    //$.ajax call here if you just want to post it to the backend 
}); 
+0

好的..我添加了我的提交頁面的圖像(驗證決定)。當用戶選中一個框並按下選擇按鈕時,應該彈出提交頁面。在Verification Decision頁面上,用戶爲所有選定的行(通過按下表上的選擇按鈕選擇)選擇一個單選按鈕並提交表單。我希望它不要太混亂。 – Fahad 2013-02-28 21:23:46

+0

所以基本選擇按鈕應該只選中複選框,並彈出驗證決策頁面,最終提交Verification選擇頁面中的選定行。 – Fahad 2013-02-28 21:29:17