Wicket:模式窗口中的表单

发布于 2024-12-02 02:06:16 字数 251 浏览 0 评论 0原文

我写了一个支持文件/图像上传的面板。所以面板是一个简单的平面形式。该面板在正常的 Wicket 页面中工作。

我现在想做的事: 我想在模式窗口中使用该面板。面板显示正确。但是,当我提交/上传新文件时,我的浏览器会提示我是否要离开该页面。包含模式窗口 DIV 的页面本身就是一个表单。

我的研究没有发现有关模式窗口中表单的任何有趣信息,期望它必须是独立的(嵌套表单)。我认为这个先决条件已经满足。

有没有可用的信息,我做错了什么?有教程吗?

I have written an panel which supports file / image uploads. So the panel is a simple plain form. The panel works in a normal Wicket page.

What I would like to do now:
I would like to use the panel in a modal window. The panel is displayed correctly. However, when I submit it / upload a new file, my browser prompts whether or not I would like to leave the page. The page which contains the DIV of the modal window is a form itself.

My research didn't turn up any interesting information about forms in a modal window expect it has to be self contained (nested form). I think this prerequisit is met.

Is there any information available, what I have done wrong? Any tutorials?

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

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

发布评论

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

评论(2

冰雪之触 2024-12-09 02:06:16

您需要使用 AjaxSubmitButton(或 AjaxSubmitLink)来提交表单。问题是模态窗口需要Ajax通信。如果您使用窗口只是重新处理整个页面而不关心 Ajax,那么您可以重写 ModalWindow#getCloseJavaScript() 方法。

You need to use an AjaxSubmitButton (or AjaxSubmitLink) to submit your form. The problem is that the modal window requires Ajax communication. If you use the window to just reprocess a whole page and don't care about the Ajax'ness, then you can override the ModalWindow#getCloseJavaScript() method.

错爱 2024-12-09 02:06:16

正如 Martijn 指出的,模态窗口依赖于 AJAX 通信。因此,请使用 AjaxSubmitButton 或等效项。当模式窗口提交后需要更新主窗口中的组件时,可以通过将它们添加到AjaxRequestTarget来完成。

然而,当涉及多部分表单(文件上传)时,这不太有效。显然,多部分不能很好地与 AJAX 配合使用。必须执行 IFrame 技巧,如下所示:http://www.doorient.com/blog/2008/04/23/wicket-ajax-like-file-upload-on-a-modal-window/

As Martijn pointed out, the modal window relies on AJAX communication. So use AjaxSubmitButton or equivalents. When components in the main window need to be updated after the submit of the modal window, this can be done by adding them to the AjaxRequestTarget.

However when it comes to multi part forms (file uploads) this does not work quite. Apparently multi part doesn't play nicely with AJAX. One has to do an IFrame trick as pointed out e.g. here: http://www.dooriented.com/blog/2008/04/23/wicket-ajax-like-file-upload-on-a-modal-window/

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