未发送 Jquery UI 对话框中的输入? [英] Input inside Jquery UI Dialog not being sent?
问题描述
我的对话框中的输入字段没有被发布,我不知道为什么...
我已经在 mac firefox 和 safari 以及 windows IE & 上对其进行了测试.firefox 的结果相同,所以我不认为是浏览器的问题,如果我禁用对话框,这些字段可以正常发布.
我重新阅读了 jquery ui 文档,但找不到我做错了什么...对话框似乎不太可能不支持输入.
这是我正在使用的代码的精简版本:
<form method="POST" action="publish.php"><input type="button" id="publishSettings" value="发布设置"><div id="对话框">发布日期<input type="text" name="publishOn"><br>取消发布日期<input type="text" name="unPublishOn">
<input type="submit" name="pubArticle" value="Publish"></表单>
没什么特别的吧?为什么这对我不起作用!?
谢谢!
当 JQuery 打开对话框时,它会将它移到表单之外.
解决办法如下:
带有 ASP.NET 按钮回发的 jQuery UI 对话框
基本上在你的情况下:
var dlg = $("#dialog").dialog({自动打开:假,纽扣: {好":函数(){$(this).dialog('close');}}});dlg.parent().appendTo($("#yourformId"));
应该修复它.
The input fields in my dialog box aren't being posted, and i'm not sure why...
i've tested it on mac firefox and safari, and windows IE & firefox with the same results, so i don't think it's the browser, and the fields post fine if I disable the dialog box.
I've re-read the jquery ui docs and can't find what i'm doing wrong... It seems unlikely that the dialog box wouldn't support input.
here's a condensed version of the code i'm using:
<script type="text/javascript">
$(document).ready(function(){
$("#dialog").dialog({
autoOpen: false,
buttons: {
"OK": function() {
$(this).dialog('close');
}
}
});
$("#publishSettings").click(function(){
$("#dialog").dialog('open');
});
});
</script>
<form method="POST" action="publish.php">
<input type="button" id="publishSettings" value="Publish Settings">
<div id="dialog">
Publish Date
<input type="text" name="publishOn"><br>
Unpublish Date
<input type="text" name="unPublishOn">
</div>
<input type="submit" name="pubArticle" value="Publish">
</form>
Nothing out of the ordinary, right? Why won't this work for me!?
thanks!
When JQuery opens the dialog box , it moves it outside the form.
Here's the solution for that:
jQuery UI Dialog with ASP.NET button postback
basically in your case:
var dlg = $("#dialog").dialog({
autoOpen: false,
buttons: {
"OK": function() {
$(this).dialog('close');
}
}
});
dlg.parent().appendTo($("#yourformId"));
should fix it.
这篇关于未发送 Jquery UI 对话框中的输入?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!