Hi,
I am creating table rows dynamically using javascript.I have dropdowns in the dynamically created row and onchange of the row i am using ajax call to populate the values to another dropdown wchih is also dynamicaaly created.
Please find the code below
function createRow()
{
var tbody = document.getElementById("t1");
var newTr = document.createElement("TR");
var newTd1 = document.createElement("TD");
var ss=document.getElementById("task1").innerHTML;
newTd1.innerHTML = document.getElementById("task1").innerHTML;
newTd1.setAttribute("align","center");
var newTd2 = document.createElement("TD");
newTd2.innerHTML = document.getElementById("activity1").innerHTML;
newTd2.setAttribute("align","center");
newTr.appendChild(newTd1);
newTr.appendChild(newTd2);
tbody.appendChild(newTr); }
span id="task1" style="visibility:hidden" property="task1">
<html:select styleId="tasks" property="tasks" onchange="hi('loadactivities.do?taks=' + this.value);createRow();">
<option value="All">----</option>
<bean:define id="hoursCollection" name="loginForm" property="task" />
<logic:present name="hoursCollection">
<logic:iterate id="hour" name="hoursCollection">
<html:option value="<%=(String)hour%>"><%=(String)hour%></html:option>
</logic:iterate>
</logic:present>
</html:select>
</span>
<span id="activity1" style="visibility:hidden">
<html:select styleId="activitys" property="activitys" >
<option value="All">----</option>
<bean:define id="activityCollection" name="loginForm" property="subtasks" />
<logic:present name="activityCollection">
<logic:iterate id="hour" name="activityCollection">
<html:option value="<%=(String)hour%>"><%=(String)hour%></html:option>
</logic:iterate>
</logic:present>
</html:select>
</span>
i have a ajax call in the "task" which whill return the activities to the "activities" dropdown.But since i dont have the ids of the activity..whereever i change the task the result is coming int he first row...can anyone please help me...
If what i am doing is not a good way please give me another solution....
thanks in advance....