使用jquery和fancybox发布表单以弹出窗体 [英] Posting a form to popup form using jquery and fancybox

查看:130
本文介绍了使用jquery和fancybox发布表单以弹出窗体的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我试图从一个表单发布到另一个表单中( http://fancybox.net/

例如,我有一个表格上带有复选框的城市列表。



用户点击第一个表单上的提交,我希望fancybox窗口出现在另一个表单中。新表单上会有一个文本框,它将隐藏在表单元素中的前一个表单上的城市ID隐藏起来。



我遇到的问题是在提交表单时弹出fancybox窗口。



我最终重定向用户第二种形式完全或弹出式窗口不是一个fancybox窗口。

我到目前为止最接近的是使用我在另一个网站上找到的一些代码。弹出窗口是一个普通的浏览器窗口。

 < form id =myformaction =.. 。method =post> 
<! - 表单字段等 - >
< / form>
$ b $(document).ready(function(){
$('#myform')。submit(function(){
window.open('','formpopup ','width = 400,height = 400,resizeable,scrollbars');
this.target ='formpopup';
});
});

预先致谢。

解决方案

使用jQuery Form Plugin解决方案( http://malsup.com/jquery/表格/ )。

从表单输入类型=submit打开Fancybox(或equiv)



谢谢

I am trying to post from a form to another form in a fancybox ( http://fancybox.net/ ) window.

For example I have a list of cities with tickboxes on a form.

When the user clicks submit on the first form, I am hoping for the fancybox window to appear with another form in. There will be a textbox on the new form that has the city ids selected on the previous form hidden as form elements.

The problem I am having is popping up the fancybox window when the form is submitted.

I either end up redirecting the user to the second form completely or the popup window isn't a fancybox window.

The closest I have come so far was using some code I found on another site. The problem with this is the popup is a normal browser window.

<form id="myform" action="..." method="post">
<!-- form fields etc here -->
</form>

$(document).ready(function() {
    $('#myform').submit(function() {
        window.open('', 'formpopup', 'width=400,height=400,resizeable,scrollbars');
        this.target = 'formpopup';
    });
});

Thanks in advance.

解决方案

Resolved using the jQuery Form Plugin (http://malsup.com/jquery/form/).

Open Fancybox (or equiv) from Form input type="submit"

Thanks

这篇关于使用jquery和fancybox发布表单以弹出窗体的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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