在jQueryUI对话框中包含表单的一部分 [英] Include part of form in jQueryUI dialog box

查看:92
本文介绍了在jQueryUI对话框中包含表单的一部分的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有如下代码:

<form id="MyForm" name="MyForm" method="post" action="index.php">

<input type="text" id="Input1" name="Input1">
<input type="text" id="Input2" name="Input2">

<div id="dialog">
<input type="text" id="Input3" name="Input3">
<input type="text" id="Input4" name="Input4">
</div>

<button type="button" onclick="$('#dialog').dialog('open');">Fill out 3 and 4</button>
<input type="submit" value="Submit">

</form>

我可以将表单的第二部分放在JQueryUI对话框Input3&中. Input4不会出现在POST数据中.可以这样做吗?

I can put the second part of the form in a JQueryUI dialog box, Input3 & Input4 do not appear in the POST data. Is it possible to do this?

推荐答案

编辑为不指定输入名称.

Edited to not specify input names.

$('#dialog').bind('dialogclose', function(event, ui) {
    $('#dialog :input').each(function(index) {

      $("#myForm").add('<input>').attr({
        type: 'hidden',
        id: $(this).attr('id')
      });
    });
});

这篇关于在jQueryUI对话框中包含表单的一部分的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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