Hi All,

I'm trying to do something pretty simple: create a choice list with
multi-select, which I iterate through upon clicking a button.
 Unfortunately, it looks like my selections aren't being recorded in the
model that's supposed to receive them.  Here's what the pertinent code looks
like:

- Java:

public EditIssuePage extends WebPage {
   // I've tried removing the 'transient' keyword, but that doesn't change
anything
   transient private Set <Party> selectedParties = new HashMap <Party> ();
   ...
   public EditIssuePage () {
      ...
      Form form = new Form ("editIssueForm");
      add (form);
      ...
      ListMultipleChoice <Party> partyChoice = new ListMultipleChoice
<Party> (
            "parties",
            new PropertyModel (this, "selectedParties"),
            new LoadableDetachableModel <List <Party>> () {
               @Override
               public List <Party> load () {
                  return new Vector <Party> (retrieveAllPartiesFromDAO ());
               }
            },
            new IChoiceRenderer <Party> () {
               public Object getDisplayValue (Party object) {
                  return object.getFullName ();
               }

               public String getIdValue (Party object, int index) {
                  return object.getId ();
               }
            }
      );
      Button addPartiesButton = new Button ("addPartiesButton") {
         @Override
         public void onSubmit () {
            logger.debug ("Number of selected parties: " +
selectedParties.size ());     // always reporting zero!
            for (Party selectedParty : selectedParties) {
               ...
            }
         }
      };
      form.add (partyChoice);
      form.add (addPartiesButton);
   }

   private Set <Party> retrieveAllPartiesFromDAO () {
      // does what it sounds like
   }
}

- HTML: (My memory is a bit hazy here; I don't have any of this code in
front of me as I write this)

...
<select multiple wicket:id="parties">
   <option>[A party should be here]</option>
</select>
<submit wicket:id="addPartiesButton" name="Add Selected Parties"/>
...

The page renders fine, with all Party objects listed for selection.  But
when I select one or more of the rows and click the button, the log message
I see is "Number of selected parties: 0", no matter what.  I have very
similar logic working on another page, so I'm pretty confused about what's
the problem here.  All advice is much appreciated.

Thanks,
Ray Weidner

Reply via email to