提交表单,重新加载父组和关闭子组 [英] submit form, reload parent, and close child

查看:83
本文介绍了提交表单,重新加载父组和关闭子组的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个跨IE问题,不一定是跨浏览器问题。

I have an issue with a cross-IE issue, not necessarily a cross-browser one.

我试图打开一个子窗口,提交表单。提交时,应调用PHP脚本以加载子表单数据。然后,孩子应该重新加载包含在子窗体中添加的一些内容的父窗口,并关闭子窗体...

I am trying to open a child window, where a user would submit a form. On submission, a PHP script should be called to load the child form data. The child then should reload the parent window containing some of the content that was added in the child form, and also close the child form...

用户不会有任何其他浏览器使用除IE以外,但不同的版本(我宁愿使这完全符合,但我会解决与不同的IE)。我在IE10没有麻烦这个,但我不能让它工作在IE8。有些用户必须使用IE8(由于其他软件不能在7或8上运行,所以它们停留在XP上)。

Users will not have any other browser in use other than IE, but different versions (I would prefer to make this fully compliant, but I will settle with different IEs). I have had no trouble with this in IE10, but I can't get it to work in IE8. There are users that must use IE8 (they are stuck on XP due to other software that won't run on 7 or 8).

我尝试过: p>

I have tried this:

<form name="parts" id="parts" action="tableaddrow_nw.php" method="get" onsubmit="window.opener.document.location.href='q.php?q=<?php echo $q; ?>&memberid=<?php echo $memberid; ?>'; self.close();">

我尝试过:

<form name="parts" id="parts" action="tableaddrow_nw.php" method="get">
<input type="button" value="Save & Close Window" class="submit" onclick="validateRow(this.form);"

其中 validateRow(this.form); function is:

where the validateRow(this.form); function is :

function validateRow(frm)
{
  frm.submit();
  window.opener.document.location.href='q.php?q=<?php echo $q; ?>&memberid=<?php echo $memberid; ?>';
  this.window.close();
}



我也已经撤销了提交和重新加载, ,但它不适用于我。

I've also reversed the submit and reload, which I read on on posting, but it doesn't work for me.

PHP代码工作正常,因为它在IE10版本很好。基本上,它删除以前的条目,然后读取发送的数组,并检查以验证索引是否有效,并重新加载数组数据。

The PHP code works just fine, since it's good in the IE10 version. Basically, it removes previous entries, then reads the array sent in, and checks to verify that the indexes are valid, and loads the array data in again.

如果我不关闭窗口,它在两个版本都很好。所以我想我希望有人可以帮助我仍然关闭提交窗口,但也许等待足够长时间,以验证提交成功。

If I don't close the window, it works fine in both versions. So I guess I'm hoping someone can help me still close the window on the submit, but maybe wait long enough to verify that the submit was successful.

提前感谢任何帮助。

推荐答案

我设法在我的AHA解决这个问题!

I managed to solve this in one of my AHA! moments.

我只是使用

if ( $.browser.msie ) {
    if ( $.browser.version == "10.0" ) {
        this.window.close();
    }
}

,以告诉IE10只是关闭窗口。

in order to tell IE10 just to close the window.

在脚本中,表单动作(tableaddrow_nw.php)实际上输出了输入到数据库的数据,我添加了一个关闭窗口按钮。

And in the script that is the form action (tableaddrow_nw.php) that actually spits out the data that is entered into the database, I added a "close window" button.

<form method="post">
    <input type="button" value="Close Window" onclick="window.close()" />
</form>

所以如果是IE8,窗口不会关闭,但他们得到一个关闭按钮。在1E10中,窗口刚刚关闭。这是IE8用户再一次点击,但没有什么我可以做,直到工业工具(我不会提到的名称)的MAJOR供应商得到他们的软件到一些更现代的东西。

So if it's IE8, the window doesn't close, but they get a close button. In 1E10, the window just closes. It's one more click for the IE8 users, but there is nothing I can do until the MAJOR supplier of industrial tools (who I won't mention by name) gets their software into something a little more modern.

这篇关于提交表单,重新加载父组和关闭子组的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆