首先介绍一下bug的情景:
我做了一个表单里面有好几组的radio,提交他。我用的是easyui1.3,里面有f方法,但是不能提交:
下面是easyui提供的表单提交的方法:
- $('#ff').form('submit', {
- url:...,
- onSubmit: function(){
- // do some check
- // return false to prevent submit;
- },
- success:function(data){
- alert(data)
- }
- });
- 下面是我的表单和我的提交方法:
- <form method="post" id="ethic_mark_form">
<input type="hidden" name="ethic.id" value="${ethic.id}"/>
<table width="1150" height="98" border="1">
<tr>
<td>001</td>
<td>爱国守法,热爱祖国</td>
<td>
10<input type="radio" name="score1" value="10" />
5<input type="radio" name="score1" value="5" />
1<input type="radio" name="score1" value="1" />
</td>
</tr>
<tr>
<td>002</td>
<td>爱岗敬业。忠诚于人民教育事业</td>
<td>
10<input type="radio" name="score2" value="10" />
5<input type="radio" name="score2" value="5" />
1<input type="radio" name="score2" value="1" />
</td>
</tr>
<tr>
<td>003</td>
<td>关爱学生</td>
<td>
10<input type="radio" name="score3" value="10" />
5<input type="radio" name="score3" value="5" />
1<input type="radio" name="score3" value="1" />
</td>
</tr>
<tr>
<td>004</td>
<td>教书育人</td>
<td>
10<input type="radio" name="score4" value="10" />
5<input type="radio" name="score4" value="5" />
1<input type="radio" name="score4" value="1" />
</td>
</tr>
<tr>
<td>005</td>
<td>为人师表</td>
<td>
10<input type="radio" name="score5" value="10" />
5<input type="radio" name="score5" value="5" />
1<input type="radio" name="score5" value="1" />
</td>
</tr>
<tr>
<td>006</td>
<td>终身学习</td>
<td>
10<input type="radio" name="score6" value="10" />
5<input type="radio" name="score6" value="5" />
1<input type="radio" name="score6" value="1" />
</td>
</tr>
<tr>
<td>007</td>
<td>廉洁从教</td>
<td>
10<input type="radio" name="score7" value="10" />
5<input type="radio" name="score7" value="5" />
1<input type="radio" name="score7" value="1" />
</td>
</tr>
</table>
</form>
-
下面是我的提交方法:
-
$(function(){
$("#ethic_mark_form").form({
url : '${pageContext.request.contextPath}/work/de_dianping.action',
onSubmit: function(){
return $("#ethic_mark_form").form("validate");
},
success:function(data){
var obj = eval("(" + data + ")"); //将字符串转为JSON对象
if(obj.success) {
//关闭对话框
parent.$.dialog.dialog("close"); //之所以可获取对话框对象,是因为我们提前存入至$对象上
//刷新表格数据
parent.$.dataGrid.datagrid("load");
parent.$.messager.show({title : "提示",msg : obj.msg});
} else {
parent.$.messager.alert("错误提示",obj.msg,"error");
}
}
});
});
-
----------------------------------------------
-
就是不能提交到url那个方法,怎么都不行,我去掉了form之前的body标签就好了,这个原因在于easyui1.3提供的min.js中的form方法对于body标签做了限制