Problem Pre-populating selected part of AddRemove List

I'm building a "CRUD"-type app. My "create" screen works fine, and includes an AddRemove List component.

My "update" screen needs to pre-populate the ARL, both the items to select from and the already selected items previously saved.

I've tried this 2 ways:

1) Pre-populating the list pointed to by the "selected" attribute in my JSP ARL component.

2) Binding the ARL, and in the init() method calling setSelected();

They both work in the sense that my list is displayed, and both lists are pre-populated exactly like I want. The problem is I can't Add or Remove anything!

Here's my JSP code:

<ui:addRemove availableItemsLabel="(Available:)"

id="SessionAddRemoveList"

items="#{sessionsBean.sessionSelectList}"

binding="#{ProgramEdit.sessionAddRemoveList}"

required="true"

rows="10"

selected="#{programBean.newSelectedSessionsList}"

selectedItemsLabel="(Selected:)"

vertical="true">

<f:facet name="addButton">

<ui:button id="SessionAddRemoveList_addButton" onClick="AddRemove_ProgramAddForm_SessionAddRemoveList.add()" style="width: 100px" text="Add"/>

</f:facet>

<f:facet name="removeButton">

<ui:button id="SessionAddRemoveList_removeButton" onClick="AddRemove_ProgramAddForm_SessionAddRemoveList.remove()" style="width: 100px" text="Remove"/>

</f:facet>

</ui:addRemove>

And here's the type behind the items attribute (not using the msol):

ArrayList<Option> sessionSelectList =new ArrayList <Option>();

[Each Option is an int, String pair for the value, title]

And here's the type behind the "selected" attriute

int[] selectedSessionsList;

[An int[], corresponding the the int values in my Option array.]

Why can't I edit the items in the ARL when I pre-populate the "selected" list? There has to be a way to do this....

Help!

Thanks,

-Craig

[2561 byte] By [CraigRPetersa] at [2007-11-27 2:47:26]
# 1
Guess next step will be trying a String[] instead of int[], but I don't see the same symptoms as others have reporting using non-String results...
CraigRPetersa at 2007-7-12 3:16:47 > top of Java-index,Development Tools,Java Tools...
# 2
Nope, converting everything to String[] and Options (String, String) didn't help at all....Hmmm...Ok, will try using an MultipleSelectOptionsList instead of my own lists to see if that has any benefit...This is getting ridiculous....this shouldn't be this hard....
CraigRPetersa at 2007-7-12 3:16:47 > top of Java-index,Development Tools,Java Tools...
# 3

Just so the next poor guy doesn't have to spend 8 hrs on this problem, when I copied my Add page to my Edit page, I didn't change the form references in the facets:

<f:facet name="addButton">

<ui:button id="SessionAddRemoveList_addButton" onClick="AddRemove_ProgramEditForm_SessionAddRemoveList.add()" style="width: 100px" text="Add"/>

</f:facet>

[the ..._ProgramEditForm_... part still had ProgramAddForm...]

For whatever reason, every Add/Remove event sumitted the form but did not add or remove anything....

Whew.....

-Craig

Message was edited by:

CraigRPeters

CraigRPetersa at 2007-7-12 3:16:47 > top of Java-index,Development Tools,Java Tools...