我使用了以下代码:http://jsfiddle.net/SzW7q/
管理员将能够进入并创建新的howto文章,并一遍又一遍地输入新的步骤,直到特定任务有一篇关于如何执行所有操作的完整文章。当管理员想要添加新行时,一切都工作得很好,但我遇到的问题是,一旦表单提交,只有原始行会被发布,而所有的克隆都不会。例如,下面的tr将会post,但之后的所有克隆都不会
原始行过帐:
<tr><th>Step to complete</th><td><input type='hidden' name='stepnum1' /><input type='text' name='step_num_text1' style='width: 350px;'/></td></tr>未发布的克隆:
<tr><th>Step to complete</th><td><input type='hidden' name='stepnum2' /><input type='text' name='step_num_text2' style='width: 350px;'/></td></tr>
<tr><th>Step to complete</th><td><input type='hidden' name='stepnum3' /><input type='text' name='step_num_text3' style='width: 350px;'/></td></tr>有人能告诉我为什么这些新行没有发布吗?我能做些什么?
谢谢。
发布于 2012-08-25 04:32:56
将您的标记设置为
<form method="post">
<table width="60%" border='0' cellspacing='0' cellpadding='2' class='tform add_howto' id='add_howto'>
<tr class='header'>
<td colspan='2'>Add New HowTo Article</td>
</tr>
<tr>
<td>Article Name</td>
<td><input type='text' name='howto_name' /></td>
</tr>
<tr>
<td>Step to complete</td>
<td><input type='hidden' name='stepnum1' /><input type='text' name='step_num_text1' style='width: 350px;'/></td>
</tr>
</table>
<input type='submit' value='Submit HowTo' name='add_howto' class='button' />
</form>
<button id='newRowButton' class='button' style='float: left; padding: 2px 6px; margin-top: 2px;'>Add new step</button>http://jsfiddle.net/SzW7q/1/
我截取了帖子的信息:
add_howto Submit HowTo
howto_name asd
step_num_text1 sdf
step_num_text2 sdf
step_num_text3 sdf
stepnum1
stepnum2
stepnum3发布于 2012-08-25 04:47:55
根据jsfiddle的说法,HTML代码中有一堆乱七八糟的东西。而不是
<table>
<form>
....
</table>
</form>你一定有
<form>
<table>
...
</table>
</form>所以它基本上就是无效的HTML。
https://stackoverflow.com/questions/12115961
复制相似问题