JavaScript appendChild Not Posting to Form
I was battling an issue where I was using the following function to add a field to a form:
function addRow (tblID){
var tblBody = document.getElementById(tblID).tBodies[0];
len = tblBody.rows.length;
var newNode = tblBody.rows[len-1].cloneNode(true);
tblBody.appendChild(newNode);
}
All the fields that were being appending were not being included on the form post, but any field I manually put in the code would post. After battling it for far too long I moved the opening and close form tags to the end and close of the file and everything worked correctly. I’m not sure why the form location worked with a hardcoded input but not with one that was manually input, but moving the form tag was easy enough.
About this entry
You’re currently reading “JavaScript appendChild Not Posting to Form,” an entry on Ricky Robinett's Blog
- Published:
- November 2, 2009 / 5:00 pm
- Category:
- AJAX
- Tags:
- appendChild, JavaScript
No comments yet
Jump to comment form | comment rss [?] | trackback uri [?]