【发布时间】:2011-06-08 17:02:47
【问题描述】:
我有一个弹出表单的模式,允许管理员编辑/更新新闻报道。它工作得很好,更新了数据库和所有内容,当在模式窗口中时,只有“故事”部分出现在文本区域框之外。
几张图可以说明我的观点和困惑。
'Look YAY' 是当前故事,被拉入文本区域下方的区域
添加新故事
新故事现在在数据库中,但在模式中的文本区域框下方
然而在实际的表单页面上它是它应该在的地方
我已经检查并重新检查了我的代码,但我唯一的想法是 jquery-UI 以某种方式干扰了文本区域,因为根据定义,模态中的代码等同于编辑新闻表单中的代码。
这是故事元素的表单代码
Story<br/>
<textarea name="edit_story"/><?php print $row['story'];?></textarea>
以及弹出它的 jquery
$('.edit').click(function(event){
//don't follow the link
event.preventDefault();
var $link = $(this).parent();
//load in the html from the form at edit_news
var formDOM = $("<div />").load($link.attr('href')+' #edit_form', function() {
//clear the dialog box
$('#dialog-edit').empty();
// Append to the page
$('#dialog-edit').append(formDOM);
//make the dialog
$('#dialog-edit').dialog({
autoOpen:false,
title:$link.attr('title'),
width:530,
height:465
})
//open it up
$('#dialog-edit').dialog('open');
$('#edit_form').submit(function(event){
//knock out its form processing
event.preventDefault();
$.ajax({
type : "post",
url : $link.attr('href'),
data : $(this).serialize(),
success : function() {
//close dialog
$('#dialog-edit').dialog('close');
}
})
})
})
});
这是怎么回事?
如果有人有任何想法,请按我的方式提出。这很可能是一个 n00bish 编程错误,我会优雅地接受。
【问题讨论】:
标签: jquery html jquery-ui textarea