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


On 2-Jun-09, at 6:54 PM, m_salman wrote:


I have set the model. But I still don't see it preselected when the
dropDownChoice object is displayed:

                form.add(new DropDownChoice<IParameterInOutType>(
                                                "parameterInOutType",
                                                new
CompoundPropertyModel <IParameterInOutType>(parameterMetaData.getParameterInOutType()),
                                                listParameterInOutType,
                                                new 
ChoiceRenderer<IParameterInOutType>("name")));



Am I missing some thing?  DO I need to do something in the html?

Thanks.





Nino.Martinez wrote:

just set the model to what you want selected:)

John wrote:
hi, when using a DropDownChoice is there a way to have the value
preselected if there is only one available and the field is required?

i have looked through the code but cannot see any settings that might
control this, and am stumped trying to work out how to extend the
control in this way.

john

---------------------------------------------------------------------
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]




--
View this message in context: 
http://www.nabble.com/DropDownChoice---required%2C-one-item-so-preselection--tp19198000p23842503.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]



---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to