|
I have some code that adds a new row of INPUT fields to a form when a
button is pressed.
I use the following line to assign an onchange eventhandler.
element.onchange = function(){updateItemCost(rowNum);};
The 'rowNum' parameter is defined in the Javascript function that
calls the above code.
This works great if the user adds one row, enters the data, then adds
the next row, enters data, etc.
But if the user adds two or more rows, the 'rowNum' received is always
the number of the last row added.
I can tell that separate INPUT objects are being created, because if I
SUBMIT, I can see the proper fields names (itemQuantity3,
itemQuantity4, etc) in the POST data.
|