js阻止表单重复提交

//校验表单的数据
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();"

 

posted @ 2016-02-18 20:56  牵牛花  阅读(240)  评论(0编辑  收藏  举报