我有一个弹出表单的模式,允许管理员编辑/更新新闻报道。它工作正常,更新数据库和所有内容,在模态窗口中只有“故事”部分出现在textarea框之外。
一些照片将说明我的观点和困惑。
添加一个新故事
新故事现在在数据库中,但在模态
中的textarea框下面
但在实际的表单页面上,它应该是
我已经检查并重新检查了我的代码,但我唯一的想法是jquery-UI以某种方式干扰了textarea,因为根据定义,模态中的代码与Edit News表单中的代码相同。
这是故事元素的表单代码
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');
}
})
})
})
});
这里发生了什么?
如果有人有任何想法,请按我的方式折腾他们。它可能是一个非常糟糕的编程错误,我会优雅地接受它。
答案 0 :(得分:4)
在将文字打印到其中之前,您正在关闭<textarea>
标记。修正:
<textarea name="edit_story"><?php print $row['story'];?></textarea>