Warning: file_get_contents(/data/phpspider/zhask/data//catemap/2/jquery/81.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Struts2 Jquery构象_Jquery_Struts2 Jquery_Struts2 Json Plugin_Struts2_Struts2 Jquery Grid - Fatal编程技术网

Struts2 Jquery构象

Struts2 Jquery构象,jquery,struts2-jquery,struts2-json-plugin,struts2,struts2-jquery-grid,Jquery,Struts2 Jquery,Struts2 Json Plugin,Struts2,Struts2 Jquery Grid,我在我的应用程序中使用struts2 jquery插件,我使用它的sj:a组件提交表单 这是我的密码 <s:iterator value="countryList" var="country"> <s:form id="frm%{countryID}" action="add_country_save"> <s:textfield name="country.countryName" size="40" id="txt%{country

我在我的应用程序中使用struts2 jquery插件,我使用它的sj:a组件提交表单

这是我的密码

 <s:iterator value="countryList" var="country">
     <s:form id="frm%{countryID}"  action="add_country_save">
        <s:textfield name="country.countryName" size="40" id="txt%{countryID}"/>
</s:form>

<sj:a id="ah%{countryID}" formIds="frm%{countryID}"
 targets="add_country" button="true" > Delete </sj:a>

 </s:iterator>

删除
一切正常,直到有人要求我在提交表单之前必须显示一个确认对话框

这实际上是我试图实现的

如果用户单击“确定”,则将提交表单提交。 如果用户单击“取消”,则表单提交将被取消

如果有人有解决办法,请与我分享


Thank's

您已指定id由服务器端生成,因此您无法轻松选择其id,因为它会因数据库上的不同结果而有所不同

实现目标最简单的方法就是这样

<form onsubmit="return confirm('Do You Want to Submit the Form?');">
<s:form id="frm%{countryID}" name ="myform" action="add_country_save">
     <s:textfield name="country.countryName" size="40" id="txt%{countryID}"/>
$('form[name ="myform"]').click(function(){
     if(confirm('Do you want to submit the form?')){
        $(this).submit();
     }
 });