Question

I have a table (Dataview) with content from a database, where each row/object has an "edit" button. When I try to edit the object, the DropDownChoice-value (in a form) is not correctly updated (even though it is correct in the database). The value that gets set in the DDC is the first item in the (sorted) list "placeList", where I obviously want the correct value from my object (event.getPlace().getName()).

Here is the code (wicket 1.5):

    List<Place> placesList = UtGuidenApplication.getInstance().getUgpService().getAllPlaces();
    Collections.sort(placesList);

    DropDownChoice<Place> selectablePlaceField = new DropDownChoice<Place>("Sted", new PropertyModel<Place>(event, "eventPlace.name"),
            placesList, new ChoiceRenderer<Place>("name"));
    utguidenEventForm.add(selectablePlaceField);

Anybody?

Cheers, Terje Eithun, Norway

Was it helpful?

Solution

I think you have an error in your model. You've written new PropertyModel<Place>(event, "eventPlace.name") which contains the name of your event as model, but the list of choices contains places. I think using new PropertyModel<Place>(event, "eventPlace") should solve the issue.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top