弹出窗口和父窗口之间进行通信
我正在使用 Codeigniter 框架开发 PHP/MySQL 项目。
用户填写了包含许多数据的表单,并为我提供了对其虚拟主机的 FTP 访问权限,我想在单击“浏览”按钮后将 FTP 详细信息发布到弹出窗口,用户将选择一个路径(我正在使用 Codeigniter FTP 类),然后用户单击“保存”或“关闭”按钮后,我将获取路径。
无论如何,有没有打开一个弹出窗口并向其发布数据,然后用户将选择一些内容,我将在关闭弹出窗口后得到用户从弹出窗口中选择的内容?
I'm working on a PHP/MySQL project using Codeigniter framework.
The user fill a form with many data, and give me also FTP access to his web hosting, I want to POST FTP details to a popup after clicking Browse button, user will select a path (I'm using Codeigniter FTP Class), then I'll grab the path after the user click Save, or Close button.
Is there anyway to open a popup and post data to it, then the user will select something and I'll get what the user selected from the popup after closing it?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
这看起来会做你想做的事:
http://www.phpbuilder.com /board/showthread.php?t=10321605
要点是将表单的操作设置为要在弹出窗口中打开的页面,然后将弹出窗口函数作为 onSubmit 处理程序返回 形式。
This looks like it will do what you want:
http://www.phpbuilder.com/board/showthread.php?t=10321605
The gist is to set your action of the form to the page you want opened up in the popup, then return the popup function as the onSubmit handler of the form.
有很多方法可以做到这一点,具体取决于输入应该结束的位置,但我会在弹出窗口中使用 Javascript 来完成此操作,该窗口可以将其父页面称为“opener”。
因此,在主页上设置一个空的隐藏表单变量 - 让我们将其称为“selectedvalue”,以称为“selectsaver”的形式 - 它将接收在弹出窗口中选择的任何值。在弹出窗口中,选择元素并单击“保存”或“关闭”按钮后,所选元素将被写入 selectedvalue 字段,其中
opener.selectsaver.selectedvalue.value = [selectedelementvalue]
Many ways to do this, depending on where the input is supposed to end up, but I'd do it with Javascript in the popup window, which can refer to its parent page as "opener".
So set up an empty, hidden form variable on the main page -- let's call it "selectedvalue", in a form called "selectsaver" -- that will receive the value of whatever is selected in the popup window. In the popup window, when the element has been selected and the Save or Close button is clicked, the selected element is written into the selectedvalue field with
opener.selectsaver.selectedvalue.value = [selectedelementvalue]