Sorry if that title is a bit vague, I'll try to explain what I'm trying to do here.
I have a form that I can dynamically add/delete rows of a form from, and those rows need to generate some content in another table further down the page. I need to be able to delete the entire contents of the generated table at any point from within the form, but I just can't seem to get it to work.
This is part of the form that is used to generate the table I spoke of, the voucherTable() function is where I need to perform the deleting.
<td><input id="amount_1" type="text" name="amount_1" size="15" onBlur="voucherTable()"></td>
This is the just the tbody tags for my content table, it begins empty and is populated as I go along.
Here is the portion of the voucherTable() function that I'm trying to perform the delete from.
var voucher_tbody = 'glfVoucherValues';
var voucher_table = document.all.glfVoucherValues;
//var voucher_table = document.getElementById(voucher_tbody); // Tried a couple things here
while ((voucher_table = voucher_table.parentElement) && voucher_table.tagName !="TBODY");
I guess because I'm trying to call this function from outside the tbody block I'm trying to delete, it doesn't like it. At the moment I get an "Object Required" error on the removeChild line.
This is basically the same code I'm using to delete the rows in my form, only I get the voucher_table variable by doing voucher_table = window.event.srcElement; which works fine. Of course, if I try to do that here it ends up deleting all of my form, which is kind of counter productive :)
Is this possible??