动态插入的表单输入不会发布 [英] dynamically inserted form inputs aren't posted
问题描述
我通常不要求帮助,但是当我这样做时,相信我做了很好的研究,没有发现任何东西。
I don't usually actually ask for help, but when I do, believe me I did my research well and found nothing.
让它变得简单,但是相关。我有一个表格。其一部分是这样的:
Lets make it simple, but relevant.I have a form. Part of it goes like this:
<div class="list-model">
<div class="connected"><?=$items['connected']?></div>
<div class="items"><?=$items['items']?></div>
</div>
当有人点击输入
时,我想将其移动到另一个 div
。
我使用 jQuery
:
When somebody clicks an input
, i want to move it to another div
.
I use jQuery
for that:
$(".list-model").delegate(".item input", "change", function()
{
listModel = $(this).closest(".list-model");
item = $(this).closest(".item");
insertTo = $(this).is(":checked") ? "connected" : "items";
insertTo = listModel.find("."+insertTo);
$(insertTo).append(item);
});
jQuery
像魔术一样工作, .item
来回移动。
The jQuery
works like magic, .item
moves back and forth.
但是
一次我触摸实际的输入
,它不会 POST
!
Once I "touch" the actual input
, it won't POST
!
Chrome浏览器的开发工具不会在表单数据
中显示,也不会在服务器端显示。 >
It won't show in Chrome's Developer Tools under Form Data
, nor on the server side.
推荐答案
嗯,当然这是我的坏事。
Well... Of course it was my bad.
m使用超老框架,其中表单
元素在code表元素内卡住 code>< table> ,但在< tr>
之前。
I'm using an ultra-old framework, in which the form
element is "stuck" inside a table
element, after <table>
but before <tr>
.
我在< table> $之外的
< form>
,所以< form>
会正确包装< table>
罚款。
I took the <form>
outside the <table>
, so the <form>
would wrap the <table>
properly, and it worked just fine.
这篇关于动态插入的表单输入不会发布的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!