Hi Michael
I believe that this is not what Archie asked about, he wanted to place
database id's in the value of the radios.. Dont know why he wanted to
though... I might have gotten it wrongly though..
regards Nino
Michael O'Cleirigh wrote:
Hi ArchieC,
The way RadioGroup works is that it renders to a hidden field and
stores the selected value of the selected Radio.
i.e. the rendered markup is not that relevant and the model object for
the selected radio will be placed into the model for the RadioGroup
when the form submits.
This is how I've used it:
RadioGroup group = new RadioGroup ("group", new Model());
Radio apple = new Radio ("apple", new Model (Fruit.APPLE));
Radio orange = new Radio ("orange", new Model (Fruit.ORANGE));
group.setModelObject (Fruit.APPLE);
Here by default the first radio is selected.
When the form submits group.getModelObject() will return either
Fruit.APPLE or Fruit.ORANGE depending on the selected radio button
In your case the RadioGroup will have as its model Object the value of
the selected radio.getModelObject() so whatever the value of "user" is
coming from the PropertyModel() for the selected option.
Regards,
Mike
RadioGroup group=new RadioGroup("group", new Model(id));
final ArrayList <SelectOptionLevel> selectOptionLevel =
getDdcChoices();
ListView persons=new ListView("persons",
selectOptionLevel) {
/**
* */
private static final long serialVersionUID = 1L;
protected void populateItem(ListItem item) {
SelectOptionLevel option = (SelectOptionLevel)
item.getModelObject();
//Exampe of Icon setting
item.add(new Label("levelImage", "< img
src='images/icons/icon1.gif'/>").setEscapeModelStrings(false));
Radio radio = new Radio(
"radio", new
PropertyModel(modelObject, "user") <~~ Need
to set the value of the radio to
my option.getValue() value.
);
item.add(radio);
item.add(new Label("name", option.getLabel()));
}
};
group.add(persons);
add(group);
Apart from not getting a value it all looks great just as I want.
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]
--
-Wicket for love
Nino Martinez Wael
Java Specialist @ Jayway DK
http://www.jayway.dk
+45 2936 7684
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]