Hi all,

i'm working on a Wizard that displays a list of Addresses in one step, where
an address can be selected using a radiobutton.

The relevant code of the addresslist-wizardstep looks like this:

addressList = new ArrayList<UserAddress>(user.getAddresses());
final RadioGroup group = new RadioGroup("group", new 
CompoundPropertyModel(addressList));
add(group);

ListView<UserAddress> userAddresses = new ListView<UserAddress>("addresses", 
addressList) {
        @Override
        protected void populateItem(ListItem<UserAddress> item) {
                item.setDefaultModel(new 
CompoundPropertyModel<UserAddress>(item.getModelObject()));
                item.add(new Radio("is_default"));                              
        
                item.add(new Label("address.street"));
                item.add(new Label("address.zip"));
                item.add(new Label("address.city"));
                item.add(new Label("address.country"));
        }
};

group.add(userAddresses);
group.setRequired(true);

My Problem is that i need to select an address by default based on the 
is_default field in the UserAddress jointable, but only
when the wizardStep is displayed for the first time. If the user changes the 
selected address, it should not jump back
to the is_default value when switching back and forth between wizard-steps.

I've already tried the solution described in the wiki for setting default 
values to radiogroups (http://cwiki.apache.org/WICKET/using-radiogroups.html),
but this resets the selected radiobutton when switching wizard pages to the 
default value, so the wizard doesn't "remember"  if a default option
has been changed by the user.

I'd appreciate any hints on how to solve this one.


thanks!


-robert




Reply via email to