I'm trying to pass an object from the form to a javascript function to change text box values when the value of a select field is changed.
On the jsp page, I have access to the collection called rows.
I also have an html:select field that I need to use the onChange event to change other fields on the page. I can certainly call a javascript function on the onChange with no problem. But I need to take it one step further. I need to send the javascript function the collection called rows, so I can set other fields' values on the jsp page to the values of the selected row.
This (or some facimile) is what I want to do:
<html:select name="currentForm" property="value(id)" onChange="fillUomForm(this.form,this,rows);">
<c:forEach var="row" items="${rows}">
<c:choose>
<c:when test='${row.id == currentForm.stringValues["id"]}'>
<option value="<c:out value='${row.id}'/>" selected>
<c:out value="${row.id}"/>
</option>
</c:when>
<c:otherwise>
<option value="<c:out value='${row.id}'/>">
<c:out value="${row.id}"/>
</option>
</c:otherwise>
</c:choose>
</c:forEach>
</html:select>
Of course, rows is not recognized when I try to run this.
I have tried replacing rows with
<c:out value='${rows}'/> but that did not work.
How can I do this?
thanks,
Walter