Struts2 Jquery构象
我在我的应用程序中使用struts2 jquery插件,我使用它的sj:a组件提交表单 这是我的密码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
<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();
}
});