dynamically added input fields not submitting

左心房为你撑大大i 提交于 2019-12-12 16:14:56

问题


here's the jsFiddle. i'm sorry if it doesn't work properly; damn things rarely do for me... i hate jsFiddle, but it gets the code to you faster...

the php document it goes to simply does this:

<pre><?php
print_r($_POST);?>
</pre>

the rows add to the DOM just fine. but the values do not submit to the $_POST array.

what am i missing?

and yes i've read this and this and they don't help. using Mootools, btw, so please don't bother with any jQuery answers.


回答1:


In your code I see an HTML syntax error. Can you check this line:

<input class="catCell" name"catlist" id="catList" type="text" tabindex="345"
    value="none or name" onChange="markFilled('catList', this.value);">

The syntax error is on name attribute, that is essential to get form submission work...




回答2:


Having your form element inside a table element can also be a cause of this issue




回答3:


            $('nextStep').addEvent('click', function(e) {
                console.log('BAM! form intercepted!');
                $('clientDataForm').send();});

basicly all i did is add }); to the end.. and amazingly, it works!

here: http://jsfiddle.net/36yC5/9/




回答4:


Most of these errors coming from the wrong structure of HTML.

Cases: 1. Form element start within the table OR Form close before the table end

<table><form>
<tr><td><input type="text" name="fname"></td></tr>
<tr><td><input type="text" name="lname"></td></tr>
</form></table>
This will not work

<form><table>
<tr><td><input type="text" name="fname"></td></tr>
<tr><td><input type="text" name="lname"></td></tr></table></form>

This will work (Observe the form begin before the table and ends after the table)

  1. Form start OR end inappropriate place
  2. Not specifying "name" attributes


来源:https://stackoverflow.com/questions/8971014/dynamically-added-input-fields-not-submitting

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!