Thanks so much for yoru response. I tried a few things from your response
and one solution solved the problem. I changed the ChoiceRenderer
constructor to include the "id" part. And it worked.
So here is the code:
form = new Form<IParameterMetaData>(
"form",
new
CompoundPropertyModel<IParameterMetaData>(parameterMetaData));
form.setOutputMarkupPlaceholderTag(true);
add(form);
form.add(choiceParameterInOutType =
new DropDownChoice<IParameterInOutType>(
"parameterInOutType",
listParameterInOutType,
new
ChoiceRenderer<IParameterInOutType>("name", "id")));
choiceParameterInOutType.setOutputMarkupPlaceholderTag(true);
Thanks again.
Brill Pappin wrote:
>
> Set the expected value of the id part in your form model (the model
> where the dropdown will store the submitted value).
> when the dropdown renders it will use the existing value to preset the
> choice.
>
> In your code below, it looks like the model is created new every time.
> for this to work, the model has to have the preselected choice set on
> it, or it need to survive renders.
> Your ChoiceRenderer simply tells the component which part is id and
> which is display.
>
> - Brill Pappin
>
>
--
View this message in context:
http://www.nabble.com/DropDownChoice---required%2C-one-item-so-preselection--tp19198000p23890566.html
Sent from the Wicket - User mailing list archive at Nabble.com.
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]