在 Win7 64 位上的 IE8 中,一次操作中的多个提交不起作用

发布于 2024-11-01 18:03:38 字数 2440 浏览 0 评论 0原文

我的页面上有 2 个框架,其中第 1 帧调用第 2 帧上的 Javascript 方法。在第 2 帧中,我们进行了一次提交,但没有发生。当我们返回到第 1 帧时,它会执行自己的提交并且工作正常。两次提交都将数据 POST 到服务器。

FRAME1.HTM

function doSubmit(selectedTab)
{
    if (checkFieldsChanged() == true) 
       {
        ...
        if(selectedTab >= 0)
                    document.forms[0].action="WebDesk?op=dm&id=11097DETH000000&FormNo=" + selectedTab;
        document.forms[0].submit();
    }
}

function checkFieldsChanged()
{
    ...
        if (confirm("Do you want to save the changes you have made?"))
        {
            // try to submit the form.
            try
            {
                return parent.frames[1].doSubmit();
            }
            catch (e)
            {
                ...
            }
        }
    return true;
}
...
    <FORM METHOD="POST" ACTION="WebDesk?op=dm&id=11097DETH000000&FormNo=" TARGET="WorkitemContents11097DETH000000">

FRAME2.HTM

function doSubmit()
{
    ...
        **// Nothing happens here on this submit
        document.forms[0].submit();** 
        return true;
}
...
   <form METHOD='POST' ACTION='WebDesk?' onsubmit="return ReqdFieldChk();">
       <input TYPE='hidden' NAME='op' VALUE='f'/>
       <input TYPE='hidden' NAME='id' VALUE='11097DETH000000'/>
       <input TYPE='hidden' id='FormNo' NAME='FormNo' VALUE='3'/>
       <input TYPE='hidden' id='send' NAME='send' VALUE='false'/>

因此,FRAME1 的 doSubmit 由 onclick 处理程序调用,该处理程序调用 checkFieldsChanged,后者在 FRAME2 上执行 doSubmit。当我们在 FRAME2 中调用 Submit 时,什么也没有发生。然后当我们返回到 FRAME1 时,就会发生提交并且总是工作正常。

我怀疑不允许将这两个提交链接在一起以进行一个用户操作。或者,IE8不喜欢这样并且不允许这样做。

我已经做了很多调试:

  • 这在 XP 上的 IE6 中可以正常工作。
  • 我知道提交例程实际上被调用,因为我在它周围调用了 console.log 并且它总是被调用。
  • 如果我在 IE 调试器内的提交行上设置断点并按 F10 跨过该行,则提交会起作用。但是,如果我按 F5 继续脚本的其余部分,则它不起作用。因此,这似乎表明
  • 我放入异步调用以稍后进行提交的时间问题,但这并没有帮助
  • FRAME2.HTM 是由某些代码内联生成的,并且存在一些 HTML 验证问题。我已经修复了这些问题,但问题仍然存在
  • 。在 Firefox 3.6.8 中,有时有效,有时无效。我还没弄清楚什么时候有效,什么时候无效。
  • 我运行了一个程序,HTTP 分析器,它查看 IE 的输出,并且没有显示任何来自错误提交的结果。它显示了第二次提交的正确输出。当我按 F10 跳过提交(并且工作正常)时,从服务器返回的响应被截断。第二次提交的响应(也有效)是正常的。实际上,您不会注意到这里有任何问题,因为第二次提交替换了 FRAME2,所以这不是问题。但这可能是第一次提交被截断的症状。
  • 我尝试过兼容性视图,但这并没有帮助
  • 我进行了大量的谷歌搜索,但没有得到任何具体的结果。

我可以提供原始 HTML,但我不想为这个已经很大的问题添加更多内容。

它实际上归结为:我们可以通过一个用户操作将这些多个提交链接在一起吗?多年来它在 IE6 上运行良好,但现在在 IE8 上就崩溃了。

I have 2 frames on a page where frame1 calls into a Javascript method on frame2. In frame2 we do a submit which doesn't happen. When we return to frame1, it does it's own submit and that works fine. Both submits are POSTing data to the server.

FRAME1.HTM

function doSubmit(selectedTab)
{
    if (checkFieldsChanged() == true) 
       {
        ...
        if(selectedTab >= 0)
                    document.forms[0].action="WebDesk?op=dm&id=11097DETH000000&FormNo=" + selectedTab;
        document.forms[0].submit();
    }
}

function checkFieldsChanged()
{
    ...
        if (confirm("Do you want to save the changes you have made?"))
        {
            // try to submit the form.
            try
            {
                return parent.frames[1].doSubmit();
            }
            catch (e)
            {
                ...
            }
        }
    return true;
}
...
    <FORM METHOD="POST" ACTION="WebDesk?op=dm&id=11097DETH000000&FormNo=" TARGET="WorkitemContents11097DETH000000">

FRAME2.HTM

function doSubmit()
{
    ...
        **// Nothing happens here on this submit
        document.forms[0].submit();** 
        return true;
}
...
   <form METHOD='POST' ACTION='WebDesk?' onsubmit="return ReqdFieldChk();">
       <input TYPE='hidden' NAME='op' VALUE='f'/>
       <input TYPE='hidden' NAME='id' VALUE='11097DETH000000'/>
       <input TYPE='hidden' id='FormNo' NAME='FormNo' VALUE='3'/>
       <input TYPE='hidden' id='send' NAME='send' VALUE='false'/>

So FRAME1's doSubmit is called by the onclick handler which calls checkFieldsChanged which does the doSubmit on FRAME2. When we call submit in FRAME2, nothing happens. Then when we return out to FRAME1, it's submit happens and that always works fine.

I suspect that chaining these 2 submits together for one user-action is not allowed. Or, IE8 doesn't like this and doesn't allow it.

I've done lots of debugging:

  • This works properly in IE6 on XP.
  • I know the submit routine is actually called because I put calls to console.log around it and it's always called
  • If I set a breakpoint on the submit line inside the IE debugger and hit F10 to step over the line, the submit works. However, if I hit F5 to just continue the rest of the script, it doesn't work. So, this might seem to indicate a timing issue
  • I put in an async call to do the submit at a later time but that didn't help
  • FRAME2.HTM is generated inline by some code and it had some HTML validation issues. I have fixed those and the problem still remains
  • In Firefox 3.6.8, sometimes it works, sometimes it doesn't. I haven't figured out when it works and when it doesn't.
  • I've run a program, HTTP Analyzer, which looks at the output from IE and it shows nothing coming out of the bad submit. It shows the correct output for the 2nd submit that does work. When I do the F10 to step over the submit (and it works properly), the response that comes back from the server is truncated. The response from the 2nd submit (that also works) is normal. In reality you wouldn't notice anything wrong here because the 2nd submit replaces FRAME2 so it's not a problem. But it might be a symptom that the first submit is truncated.
  • I've tried compatibility view but that hasn't helped
  • I've done tons of Google searches and come up with nothing concrete.

I can provide the raw HTML but I don't want to add more to this already large question.

It really boils down to: can we chain these multiple submits together from one user-action? It's worked fine for years on IE6 but now it breaks on IE8.

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

旧时光的容颜 2024-11-08 18:03:38

在frame2.htm doSubmit() 中试试这个:

function doSubmit()
{


  var frameId = document.getElementById('iframe_id');
    var frameWindow= frameId .contentWindow || frameId .contentDocument;

frameWindow.forms[0].submit();

}

in frame2.htm doSubmit() try this:

function doSubmit()
{


  var frameId = document.getElementById('iframe_id');
    var frameWindow= frameId .contentWindow || frameId .contentDocument;

frameWindow.forms[0].submit();

}
~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文