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
 

Reply via email to