You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@wicket.apache.org by Marco Santos <mp...@gmail.com> on 2009/05/30 03:02:28 UTC
DropDownChoices: How to force a selection.
Hello There.
Im creating a page where the user can either create or update a registry. I
have a few DropDownChoices, and i am trying, on the case o updating a
registry, to set the a specific value of the choices of the dropdownchoice.
Does any one know how? I have tryed to set a value on the PropertyModel that
i use on the creation of the DDC.
Here is the creation of the DDC:
private void buildDistritosComboBox() {
DistritosModel distritosModel = new DistritosModel();
SelectedChoice selectedDistrito = new SelectedChoice();//A class
with a variable selectedChoice and it getter and setter
DropDownChoice distritosDDC = new DropDownChoice("distritos", new
PropertyModel(selectedDistrito, "selectedChoice"), distritosModel);
distritosDDC.setOutputMarkupId(true);
distritosDDC.setRequired(true);
}
Thanks a lot
--
Marco Santos
Re: DropDownChoices: How to force a selection.
Posted by Rob Sonke <ro...@tigrou.nl>.
It should work with the value in your model. In your case something like
selectedDistrito.setSelectedChoice(1);
Rob
On 5/30/09 3:02 AM, Marco Santos wrote:
> Here is the creation of the DDC:
>
> private void buildDistritosComboBox() {
> DistritosModel distritosModel = new DistritosModel();
> SelectedChoice selectedDistrito = new SelectedChoice();//A class
> with a variable selectedChoice and it getter and setter
> DropDownChoice distritosDDC = new DropDownChoice("distritos", new
> PropertyModel(selectedDistrito, "selectedChoice"), distritosModel);
> distritosDDC.setOutputMarkupId(true);
> distritosDDC.setRequired(true);
>
---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
For additional commands, e-mail: users-help@wicket.apache.org