在Onsubmithandler Javascript中添加额外的验证

时间:2015-07-21 00:19:38

标签: javascript

当用户点击提交按钮时;当需要删除任何孤立记录时,我需要调用一个“DeleteOrphanRecords”函数来提示用户删除它们。原始代码仅显示孤立记录的错误消息,并阻止用户进一步处理。

<form  onsubmit="return onSubmitHandler()" action="/admin/changesrecorded.html"  method="POST" id="submitForm">

我在onSubmitHandler函数中添加了这样的附加功能 -

function onSubmitHandler()
    {
        DeleteOrphanRecords();
    // more blackbox code that only displays the alert but does not allow the user to delete the orphan records. 
    return true;
    }

DeleteOrphanRecords函数工作正常,但我有一个“加载”窗口,阻止用户在找到任何孤立记录时单击主页面上的“是/否”按钮。因此页面最终会显示警报。 我应该如何调用DeleteOrphanRecords以便删除记录并同时提交表单。 提前谢谢!

0 个答案:

没有答案