Martin thank you!! It was indeed the form in the ModalWindow causing the error. 
I thought that nested forms was not an issue with Wicket but I guess it is? 
Anyway, replacing the form on the ModalWindow with the one you suggested works 
like a charm. Thanks again! 

-----Original Message-----
From: Martin Makundi [mailto:martin.maku...@koodaripalvelut.com] 
Sent: woensdag 6 januari 2010 14:11
To: users@wicket.apache.org
Subject: Re: DropDownChoice losing selection after ajax update

There can be many reasons... maybe you show more of the html and java pages? 
Here is some previous discussion about such situations:
http://mail-archives.apache.org/mod_mbox/wicket-users/200904.mbox/%3c23274595.p...@talk.nabble.com%3e

2010/1/6 Kogel, Jonck-van-der <jonck-van-der.ko...@bmw.nl>:
> Hi,
>
> I have a simple DropDownChoice that holds male/female option. The 
> selected value is retrieved from the database fine. Now I have a modal 
> panel and when it closes it refreshes a certain portion of my screen 
> using ajax. However, when the ajax refresh comes back the selected 
> value gets lost. When I look in the ajax debug screen I see the list 
> of options coming back and the selected value is empty. This happens 
> even when I don't do anything with the value of the dropdown in the 
> modal panel, but simply refresh the dropdown. Any ideas? Here is some code:
>
> The dropdown: (the list of options is an enum, mergedModel is a
> LoadableDetatchableModel)
>
> DropDownChoice<Sex> sex = new DropDownChoice<Sex>("sex",
>  new PropertyModel<Sex>(mergedModel, "user.sex"),
>  Utility.arrayToList(new Sex[]{Sex.MALE, Sex.FEMALE})); 
> sex.setOutputMarkupId(true); add(sex);
>
> What happens when I close the modal panel: (the contentPanel gets 
> passed a reference to the modalPanel and the objects that need 
> refreshing)
>
> form.add(new AjaxSubmitLink("save") {
> �...@override
>  protected void onSubmit(AjaxRequestTarget target, Form<?> form) {
>  for (Component comp : updateList) {
>   target.addComponent(comp);
>  }
>  modalWindow.close(target);
>  }
> });
>
> The ajax response:
>
> <?xml version="1.0" encoding="UTF-8"?><ajax-response><component
> id="sex11" ><![CDATA[<select name="tabs:tabUser:sex" id="sex11"> 
> <option selected="selected" value="">Kies er een</option> <option 
> value="0">Man</option> <option value="1">Vrouw</option> </select>]]>
>
>
>
> Thanks for any help!
>
> Kind regards, Jonck
>
>

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org
For additional commands, e-mail: users-h...@wicket.apache.org




---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org
For additional commands, e-mail: users-h...@wicket.apache.org

Reply via email to