2013-04-24 85 views
1

当用户单击display:列中的删除按钮时,我试图显示一个删除确认框。我有对话框显示出来,但一旦用户确认他想删除该操作没有被调用。该页面只是在不删除行的情况下重新加载。没有删除确认,该行将被成功删除。我做了错误的确认。任何帮助,将不胜感激,谢谢Struts 1使用jsp中的显示标签删除确认

我有现在的问题是:

的jQuery:

$(".btnShowDeleteConfirmation").click(function (e) 
      { 
      ShowDialog(true); 
      e.preventDefault(); 
      }); 

      $("#btnClose, #btnNo").click(function (e) 
      { 
      HideDialog(); 
      e.preventDefault(); 
      }); 

      $("#btnYes").click(function (e) 
      { 

      }); 

的Javascript:

function deleteEntry(rowId) 
    { 
    document.getElementById('rowId').value=rowId; 
    document.forms['myForm'].action='/myAction/deleteAction.action?method=deleteRow'; 
    document.forms['myForm'].submit;  
    } 

显示标签表:

<form action="" method="POST" id="mainForm" name="MyFormBean"> 

<display:table requestURIcontext="true" requestURI="/unavailability/loadUnavailability.action?method=loadForm" uid="myList" name="requestScope.unavailList" class="simple" pagesize="10" defaultsort="2" sort="list" cellspacing="0" excludedParams="*">  

<display:column property="startDate" title="Start Date" width="18%" decorator="com.mhngs.util.DisplayTagDateWrapper" sortable="true" headerClass="sortable"/> 
<display:column property="endDate" title="End Date" width="18%" decorator="com.mhngs.util.DisplayTagDateWrapper" sortable="true" headerClass="sortable" /> 
<display:column property="reason" title="Comments" width="30%" sortable="true" headerClass="sortable" /> 

<display:column media="html" width="10%" class="btnShowDeleteConfirmation"> 
<a href="#">Delete</a> 
</display:column> 


</display:table> 
<input type="hidden" name="rowId" id="rowId" /> 
</form> 

HTML :一旦用户点击删除按钮,就会显示此项

<div id="overlay" class="delete_overlay"></div> 

     <div id="dialog_delete" class="delete_overlay"> 
     <form method="post" action=""> 
      <table style="width: 100%; border: 0px;" cellpadding="3" cellspacing="0"> 
       <tr> 
        <td class="web_dialog_title">Delete Row Confirmation</td> 
        <td class="web_dialog_title align_right"><a href="#" id="btnClose">Close</a></td> 
       </tr> 
       <tr> 
        <td>&nbsp;</td> 
        <td>&nbsp;</td> 
       </tr> 
       <tr> 
        <td colspan="2" style="padding-left: 15px;"> 
         <label>You seleted a row to be deleted</label> 
        </td> 
       </tr> 
      <tr> 
      <td>&nbsp;</td> 
      <td>&nbsp;</td> 
      </tr> 
      <tr> 
      <td colspan="2" style="text-align: center;"> 
       <input id="btnYes" type="submit" value="Yes" onClick="javascript:deleteEntry('<c:out value="${myList.rowId}"/>')"/> 
       <input id="btnNo" type="button" value="No" /> 
      </td> 
      </tr> 
      </table> 
     </form> 
    </div> 

回答

0

您还没有在html中指定表单名称。你在表单标签中提到了“myForm”的名字?

<form name="myForm" .. >