Hi,

I am using ListView and and each item in the listview is RadioGroup. Now
the problem is, If radio1 is selected and I select radio2 and submit
the form the selection goes back to radio1. What is wrong with following
code? 

final ListView listView = new ListView("abc", myList) {
                        protected final void populateItem(final ListItem
item) {
                                final MyObject object = (MyObject)
item.getModelObject();
                                final RadioGroup radioGroup = new
RadioGroup("radio-group", new Model());

                                final Model radioModel1 = new
Model(myObject1);
                                final Model radioModel2 = new
Model(myObject2);
                                final Model radioModel3 = new
Model(myObject3);

                                radioGroup.add(new Radio("radio1",
radioModel1));
                                radioGroup.add(new Radio("radio2",
radioModel2));
                                radioGroup.add(new Radio("radio2",
radioModel3));

                                // set default value for radio.
                                if (object.isTrue() != null &&
object.isTrue()) {
        
radioGroup.setModel(radioModel1);
                                } else if (object.isFalse() != null &&
object.isFalse()) {
        
radioGroup.setModel(radioModel2);
                                } else {
        
radioGroup.setModel(radioModel3);
                                }
                                item.add(radioGroup);
                        }
                };
                form.add(listView);


---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to