通过另一个框架提交表格 [英] submitting a form through another frame

查看:47
本文介绍了通过另一个框架提交表格的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在支持ASP遗留应用程序,需要实施

autosave功能。我有两个框架,一个用于保存标签

显示用户可以选择的不同页面,另一个用于保存页面内容本身的
。如果用户单击另一个选项卡而没有单击提交按钮,我想为他们提交当前表单

并进行进一步处理。

问题是top.framename.formname.submit()只能偶尔使用
。有时页面框架的文档对象不存在
。有没有办法保证?文件对象将存在吗?

有没有人遇到过这个问题或有任何建议?

解决方案

threeflush写道:

我支持ASP遗留应用程序,需要实现
autosave功能。我有两个框架,一个用于显示用户可以选择的不同页面的选项卡,另一个用于保存页面内容本身。如果用户点击另一个标签而没有单击提交按钮,我想为他们提交当前表单
并进行进一步处理。
问题是top.framename.formname。 submit()只能零星工作。有时页面框架的文档对象不存在。有没有办法保证?文档对象是否存在?
有没有人遇到过这个问题或有任何建议?







首先尝试提交表单,然后用新内容替换窗口。

我猜你的设置有时因为竞争条件而有效:有时候

在整个页面被替换之前提交表单。


有几种方法可以解决这个问题。

我要尝试的第一件事就是使用onUnload事件在页面中提交

提交,或者至少发出警告。


我对onUnload处理程序没有太多经验。 (当我第一次检查它时,它是一个错误的,但那是Stoneage)


如果这没有帮助,请尝试替换中的超链接框架,

用javascript替换你的formframe,所以肯定你先提交,

然后替换。

然而这可能是很多工作,取决于超链接的数量。


顺便说一句:那些人不提交表格,但要求你

保存无论如何,也许,IT经理?

(''WORD做到了,为什么我们的应用程序不做呢?修复那个bug'')

Dilbert?

相当不合理的请求恕我直言....


无论如何,这没有用。

祝你好运!


问候,

Erwin Moller


threeflush写道:

我支持ASP遗留应用程序,需要实现
自动保存功能。我有两个框架,一个用于显示用户可以选择的不同页面的选项卡,另一个用于保存页面内容本身。如果用户点击另一个标签而没有单击提交按钮,我想为他们提交当前表单
并进行进一步处理。
问题是top.framename.formname。 submit()只能零星工作。有时页面框架的文档对象不存在。有没有办法保证?文档对象是否存在?
有没有人遇到过这个问题或有任何建议?



听起来你想要使用标准的body卸载事件而不是

试图创建一个tab-click活动。


在表格页面上:< body onunload =" document.forms [0] .submit()">


这就是你要问的吗?


感谢您的回复。我试过< body> onunload和onbeforeunload

事件,但就这个规范而言都有缺陷。

onunload在我有机会提交之前销毁表格。

onbeforeunload与从另一个框架访问submit()

事件具有相同的零星行为,更不用说它在IE中仅支持

这一事实。 。

或许还有其他任何想法吗?


**喜欢那些框架!!!!! **


I''m supporting an ASP legacy application and need to implement
"autosave" functionality. I have two frames, one that holds tabs
displaying different pages a user can select, and the other that holds
the page content itself. If a user clicks on another tab without
clicking the Submit button, I want to submit the current form for them
and do some further processing.
The problem is that top.framename.formname.submit() only works
sporadically. Sometimes the document object of the page frame does not
exist. Is there any way to "guarantee" that the document object will
exist?
Has anyone ever encountered this problem or have any suggestions?

解决方案

threeflush wrote:

I''m supporting an ASP legacy application and need to implement
"autosave" functionality. I have two frames, one that holds tabs
displaying different pages a user can select, and the other that holds
the page content itself. If a user clicks on another tab without
clicking the Submit button, I want to submit the current form for them
and do some further processing.
The problem is that top.framename.formname.submit() only works
sporadically. Sometimes the document object of the page frame does not
exist. Is there any way to "guarantee" that the document object will
exist?
Has anyone ever encountered this problem or have any suggestions?



Hi,

Try FIRST to submit the form, then to replace the window with new content.
I guess your setup works sometimes because of raceconditions: Sometimes the
form is submitted before the whole page is replaced.

There are several ways to fix this.
The first thing I would try is to use the onUnload event in the page to do
the submitting, or at least give a warning.

I do not have a lot of experience with the onUnload handler. (It was
erractic when I first examined it, but that was Stoneage)

If that doesn''t help, try to replace the hyperlinks in the frame that
replaces you formframe with javascript, so are are sure you first submit,
then replace.
This however can be a lot of work, depending on the number of hyperlinks.

By the way: Are that people that DON''t submit the form, but demand that you
save it anyhow, perhaps, IT-managers?
(''WORD does it, so why doesn''t our app do it? Fix that bug please'')
Dilbert?
Quite an unreasonable request IMHO....

Anyway, that doesn''t help.
Good luck!

Regards,
Erwin Moller


threeflush wrote:

I''m supporting an ASP legacy application and need to implement
"autosave" functionality. I have two frames, one that holds tabs
displaying different pages a user can select, and the other that holds
the page content itself. If a user clicks on another tab without
clicking the Submit button, I want to submit the current form for them
and do some further processing.
The problem is that top.framename.formname.submit() only works
sporadically. Sometimes the document object of the page frame does not
exist. Is there any way to "guarantee" that the document object will
exist?
Has anyone ever encountered this problem or have any suggestions?


It sounds like you want to use the standard body unload event instead of
trying to create a "tab-click" event.

On the form page: <body onunload="document.forms[0].submit()">

Is that what you''re asking?


Thanks for replies. I''ve tried the <body> onunload and onbeforeunload
events but both have flaws as far as this specification is concerned.
onunload destroys the form BEFORE I have a chance to submit.
onbeforeunload has the same sporadic behavior as accessing the submit()
event from another frame not to mention the fact that it''s only
supported in IE...
Any other ideas perhaps?

**gotta love those frames!!!!!**


这篇关于通过另一个框架提交表格的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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