I have generated a webpage dynamically using struts tags, the page is basically a table with some numbers and some input fields on it.
The page is generated from an ArrayList of objects using struts, and is indexed, meaning the name og the various fields I want to access comes in the following manner;
And so on, this works out beautifully with Struts on the server side, because the values are posted back into the arrayList, and I can continue to work with the elements with no hazzle.
I have a problem though; I want a text field to be automatically updated with the sum of two other fields on the same row, say;
<td><input type="text" name="arrayListname.addValue" onchange=CalculateSums(this) ... etc</td>
<td><input type="text" name="arrayListname.sum" ... etc</td>
When a user types something into the text field and leaves the fiield, I want the sum field to be calculated.
Problem is, that I cannot for some reson refer to the name
We cannot generate an unique id for each element trough the struts tags as far as I understand.
(For those familliar with struts, we are using an iterate tag which has a indexId="index" and is using <bean:write .. ... .. indexed="true" >)
It is kinda tough to explain, but the core of my problem lies in accessing dynamically generated table elements and manipulate them at will.
Is there any way to loop trough each tr and td element in a table and then hard code in some loop that will calculate stuff for me, without refering to names or id's in particular?
Sorry for the more or less useless explanation, but any tips are apperciated.
I cannot for some reson refer to the name