break in your onsubmit and look at the list that the listview is pointing to. make sure the data is there, the fact that it isnt being persisted might be a problem outside of wicket's scope.
-igor On 8/29/07, Alex Pine <[EMAIL PROTECTED]> wrote: > > I'm sorry to spam the list like this, but I really need help on this. > Igor's > solution doesn't seem to change anything. No information is transferred to > the database upon hitting "on submit". If no one knows the solution, does > anyone have any ideas on how I could debug this? Is there some way I can > reference the selections of the radiogroups from the the onSubmit method > so > I can see what their values are? > Thanks for any help you can give, > Alex > > On 8/29/07, Alex Pine <[EMAIL PROTECTED]> wrote: > > > > Thank you for the quick reply, but this fix doesn't seem to work. The > > selections are never persisted on form submit. Any ideas? > > > > On 8/29/07, Igor Vaynberg <[EMAIL PROTECTED]> wrote: > > > > > > problem is here > > > > > > RadioGroup rg = new RadioGroup("choice"); > > > > > > you are not setting the model for the radiogroup choice so your > choices > > > go > > > no where > > > > > > RadioGroup rg = new RadioGroup("choice", new PropertyModel( > > > item.getModel(), > > > "status")); > > > > > > or leave it as it is and use PropertyListView instead > > > > > > -igor > > > > > > > > > On 8/29/07, Alex Pine <[EMAIL PROTECTED]> wrote: > > > > > > > > Hi all, > > > > I'm trying to use a Radio Choice component inside a Listview so that > > > each > > > > list > > > > item has one RadioGroup with three choices. When the form submit > > > button is > > > > pressed, > > > > each selected choice should set a field in the model object of each > > > list > > > > item. > > > > The code below should explain the problem more fully: > > > > > > > > > > > > /* > > > > The ultimate goal is to set the "status" field in each Participation > > > > object > > > > in the participationList of the object below. > > > > */ > > > > public class Experiment { > > > > > > > > private String name; > > > > > > > > private List<Participation> participationList; > > > > > > > > /* Other fields, constructors, getters, setters, etc */ > > > > > > > > } > > > > > > > > > > > > public class Participation { > > > > > > > > public static final int PARTICIPATED = 1; > > > > public static final int NO_SHOW = -1; > > > > public static final int SHOWED = 0; > > > > > > > > private User user; > > > > > > > > private int status; > > > > > > > > public Participation() { > > > > status = SHOWED; // Default value > > > > } > > > > > > > > /* getters, setters, etc */ > > > > } > > > > > > > > > > > > /* This is the web page that is supposed to do the setting*/ > > > > public class ParticipationPage extends BasePage { > > > > > > > > private static final long serialVersionUID = 1L; > > > > > > > > @SpringBean > > > > private ExperimentDAO exDAO; > > > > > > > > private DetachableExperimentModel exModel; > > > > > > > > public ParticipationPage(Experiment ex) { > > > > exModel = new DetachableExperimentModel(ex, exDAO); > > > > add(new ParticipationForm("form")); > > > > exModel.detach(); > > > > } > > > > > > > > class ParticipationForm extends Form { > > > > > > > > public ParticipationForm(String id) { > > > > super(id); > > > > List<Participation> participationList = exModel.getEx > > > > ().getParticipationList(); > > > > > > > > ListView subjectListView = new ListView("list", > > > > participationList) { > > > > > > > > private static final long serialVersionUID = 1L; > > > > > > > > /* > > > > I imagine the correct code should be something like > > > > this...? > > > > */ > > > > public void populateItem(final ListItem item) { > > > > Participation participation = > > > > (Participation)item.getModelObject(); > > > > item.add(new Label("name", participation.getUser > > > > ().getName())); > > > > RadioGroup rg = new RadioGroup("choice"); > > > > rg.add (new Radio("participated", new Model( > > > > Participation.PARTICIPATED))); > > > > rg.add(new Radio("no show", new Model( > > > > Participation.NO_SHOW))); > > > > rg.add(new Radio("showed", new Model( > > > > Participation.SHOWED))); > > > > item.add(rg); > > > > } > > > > }; > > > > subjectListView.setReuseItems (true); > > > > add(subjectListView); > > > > } > > > > > > > > @Override > > > > protected void onSubmit() { > > > > > > > > /* > > > > * Somehow I have to set each Participation object in the > user's > > > > > > > participationList > > > > * to the choice from corresponding the radio group. > > > > */ > > > > > > > > exDAO.persistExperiment(exModel.getEx()); > > > > exModel.detach(); > > > > } > > > > } > > > > } > > > > > > > > Does anyone know how to do this easily? I imagine it's not > difficult, > > > I > > > > just > > > > can't figure it out > > > > from the examples on the web. > > > > Thanks! > > > > -Alex Pine > > > > > > > > > > > >