1

一旦用户单击显示:列中的删除按钮,我试图显示删除确认框。我有要显示的对话框,但是一旦用户确认他要删除该操作就不会被调用。该页面只是重新加载而不删除该行。如果没有删除确认,该行将被成功删除。我在确认时做错了什么。任何帮助将不胜感激,谢谢

我现在拥有的是:

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>
4

1 回答 1

0

您尚未在 html 中指定表单名称。您在表单标签中哪里提到了“myForm”名称?

<form name="myForm" .. >
于 2013-04-25T07:24:55.210 回答