当fancybox关闭时重新提交表单

时间:2016-02-17 11:40:41

标签: javascript jquery forms fancybox

我在fancybox中有三种不同的表单,当我点击任何表单的按钮时,将提交所有三个表单并关闭fancybox。 但是当fancybox关闭时,表单正在重新提交。

按钮的Javascript。

function submitForms() {
            groupRoleMapping();
            parent.jQuery.fn.fancybox.close();
            return false;
}
function groupUserMapping() {
           //loop to find checked checkbox
          en_Method_PostWithURL(formAction, {id: ${group.id}, rowId: array3, update: "group"});

}
function groupUpate() {
            var formAction = $("#updateGroup").attr("action");
            en_Method_PostWithURL(formAction, {id: ${group.id}, update: "group", status: "yes", groupName: document.getElementById('groupName').value, description: document.getElementById('description').value});

}
function groupRoleMapping() {
           groupUpate();
           groupUserMapping();
          en_Method_PostWithURL(formAction, {id: ${group.id}, rowId: array3, update: "groupToRole"});
}

jsp中的表单

 <form method="POST"  action="${contextPath}/updateGroup.htm" id="updateGroup" >
                <input type="hidden" id="id" name="id" class="form-control" type="text" value="${group.id}" required/>
                <div class="form-group">
                    <label for="userName">Group:</label>
                    <input id="groupName" name="groupName" class="form-control" type="text" value="${group.group}" required/>
                </div>
                <div class="form-group">
                    <label for="userName">Description:</label>
                    <input id="description" name="description" class="form-control" type="text" value="${group.description}" required/>
                </div>
                <button type="submit" id ="sendUpdate" onclick="return submitForms();" class="btn btn-default"  >Submit</button>
            </form>
        </div>
        <div id="tabs-2">
            <form id="groupUserMapping" method="POST"  action="${contextPath}/updateUserToGroup.htm">
                <table id="examplee" class="hover" width="100%">
                    <thead>
                        <tr>

                        </tr>
                    </thead>
                    <tbody>
                        <tr>


                        </tr>
                    </tbody>
                </table>
                <button type="submit" id ="sendUpdate" onclick="return submitForms()" class="btn btn-default" >Submit</button>
            </form>
        </div>
        <div id="tabs-3">
            <form id="groupRoleMapping" method="POST"  action="${contextPath}/updateRoleToGroup.htm">
                <table id="examples" class="hover" width="100%">
                    <thead>
                        <tr>

                        </tr>
                    </thead>
                    <tbody>
                        <tr>


                        </tr>
                    </tbody>
                </table>
                <button type="submit" class="btn btn-default" onclick="return submitForms()" >Submit</button>
            </form>

0 个答案:

没有答案