views:

295

answers:

0

Hello, I am having an issue updating a select box's value that was created from a dynamically-binded AutoPopulatingList.

Here's what I have:

  • An AutoPopulatingList "basicList" that contains "BasicDefinition" objects that I created.
  • Each BasicDefinition object contains:
    • String value
    • OperatorType object (the OperatorType object contains an id and description)
  • A list of possible OperatorType objects that the user can choose from using a select box, which I want binded to the OperatorType object of the BasicDefinition.

The "value" is binded to the jsp using:

<form:input path="basicList[${row.index}].value"/>

I have no problem creating each row and updating this field as many times as I want.

The problem is the "OperatorType" object, which I have binded to the jsp as follows:

<form:select path="basicList[${row.index}].operatorType.id">
<c:forEach items="${form.operatorTypes}" var="operator"> <form:option value="${operator.id}">${operator.description}</form:option>

I also have Javascript to create each row, which works fine. The issue comes when after I save this page, then return and try to update one of the OperatorType select boxes to a different value. I'm seeing very strange behavior, where sometimes it saves fine, but other times replaces ALL rows with the value in the row I changed. I feel there is some type of issue with the binding, and I'm not sure exactly how to proceed.

Any help would be greatly appreciated. Thank you.