我试图提交一个HTML格式的文本字段。目前,我的代码看起来是这样的:提交文本类型字段OnChange
echo("<form name=\"editAgendaItem" . $this->Id . "\" id=\"editAgendaItem" . $this->Id . "\" method=\"post\" action=\"./?module=meetings&preload=edit&function=editAgendaItem&agendaitem=" . $this->Id . "\">\n");
echo("<table width=\"100%\" border=0>\n");
echo("<tr><td width=\"20px\">" . $this->Index . "</td><td><input type=\"text\" value=\"" . $this->Title . "\" name=\"agendaItemTitle" . $this->Id . "\" onChange=\"javascript:document.forms['editAgendaItem" . $this->Id . "'].submit();\" />");
echo("</td>\n");
...
计算结果为
<form name="editAgendaItem19" id="editAgendaItem19" method="post" action="./?module=meetings&preload=edit&function=editAgendaItem&agendaitem=19">
<table width="100%" border=0>
<tr><td width="20px">1</td><td><input type="text" value="" name="agendaItemTitle19" onChange="javascript:document.forms['editAgendaItem19'].submit()" /></td>
...
但更重要的是
<form name="editAgendaItem19" id="editAgendaItem19" method="post" action="...">
<input type="text" value="" name="agendaItemTitle19" onChange="javascript:document.forms['editAgendaItem19'].submit()" />
...
- 这是一个标签,最终终止了。我的问题是,修改字段并放弃焦点时,表单不会提交。
在此先感谢您的帮助。
编辑:
我在onChange事件使用的主代码这种方法,而不是也试过:
<script type="text/javascript">
function submitForm(FormName)
{
document.forms[FormName].submit();
}
</script>
编辑:
走上使用下面的代码的建议:
<script>
$(document).ready(function(){
$('#agendaItemTitle24').live('blur',function()
$('#editAgendaItem24').submit();
});
});
</script>
在我的头上,并
<form name="editAgendaItem24" id="editAgendaItem24" method="post" action="...">
<input type="text" value="" name="agendaItemTitle24" id="agendaItemTitle24" />
</form>
在我的内容中。仍然没有骰子。
您是否获得在JavaScript控制台的任何错误或警告?如果是这样,你可以在这里发布吗? – octern 2012-03-02 00:48:00
我不是octern。 – DigitalJedi805 2012-03-02 07:31:38
不,我是octern。这就是为什么“ - octern”出现在我的评论结尾。 – octern 2012-03-02 16:59:32