您的位置:首页 > Web前端 > JavaScript

js阻止表单重复提交

2016-02-18 20:56 531 查看
//校验表单的数据
function newFatherModuleVerify()
{
var moduelName = $('#fatherModule_moduelName').val();
alert(moduelName);
return false;
}


<form:form commandName="fatherModule" action="saveFatherModule" onsubmit="return newFatherModuleVerify();" method="post">
<table class="au">
<tr>
<td>版块名称</td>
<td><form:input id='fatherModule_moduelName' path="moduelName"/></td>
<td>支持HTML代码</td>
</tr>
<tr>
<td>排序</td>
<td><form:input id='fatherModule_sort' path="sort"/></td>
<td>支持HTML代码</td>
</tr>
</table>
<input class="btn" style="cursor: pointer; margin-top: 10px"
type="submit" name="submit" value="添加">
</form:form>


关键在于要加上return

onsubmit="return newFatherModuleVerify();"
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签: