Hallo, I have a little problem with updating a DropDownChoice in a separate panel with information coming from a modal window. The new value is not updated in the DropDownChoice, only "new choice" is displayed when I come back from the modal window. Can you help me on this issue?
Thanks, Peter P.S.: Here is the code of of a short example, in real life I would like to use objects from a database ... >>>TestAppl.java<<<< public class TestAppl extends WebApplication { @Override public Class<Test> getHomePage() { return Test.class; } } >>>Test.html<<<< <!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd"> <html> <head> <meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1"> <title>Wicket Test</title> </head> <body>> <span wicket:id="textLabel1"></span> <form wicket:id="testForm"> <div wicket:id="namePanel"></div> </form> <div id="feedbackPanel"> <span wicket:id="feedback"></span>> </div> </body> </html> >>>>Test.java<<<< public class Test extends WebPage {>> public Test() { add(new Label("textLabel1","WicketTest - DropDownChoice")); Form testForm = new Form("testForm"); add(testForm); testForm.add(new NamePanel("namePanel")); add(new FeedbackPanel("feedback")); } } >>>>NamePanel.html<<<< <wicket:panel> <select wicket:id="nameSelect"> <option>Peter</option> </select> <div style="position:absolute;top:100px;left=20px;width:200px;height:50px;" wicket:id="modalNameInput"></div> <a href="#" wicket:id="new">new</a> </wicket:panel> >>>>NamePanel.java<<<< public class NamePanel extends Panel { private static final long serialVersionUID = 1L; private static final Log log = LogFactory.getLog(NamePanel.class); private ArrayList<String> names = new ArrayList<String>(Arrays.asList ("Peter","Stephan")); private String selName = "Peter"; public NamePanel(String id) { super(id); final DropDownChoice ddc = new DropDownChoice("nameSelect", new Model(selName), names);); ddc.setOutputMarkupId(true); add(ddc); final ModalWindow modalInput; add(modalInput = new ModalWindow("modalNameInput")); modalInput.setContent(new ModalNameInputPanel (modalInput.getContentId(),modalInput,NamePanel.this)); modalInput.setTitle("Neuer Name ..."); modalInput.setInitialWidth(200);... modalInput.setInitialHeight(100);); modalInput.setCloseButtonCallback(new ModalWindow.CloseButtonCallback() { private static final long serialVersionUID = 1L; public boolean onCloseButtonClicked(AjaxRequestTarget target) { log.debug("CloseButton: " + selName); return true; } }); modalInput.setWindowClosedCallback(new ModalWindow.WindowClosedCallback() { private static final long serialVersionUID = 1L; public void onClose(AjaxRequestTarget target) { target.addComponent(ddc); log.debug("CloseCallback: " + selName); } }); add(new AjaxLink("new") { private static final long serialVersionUID = 1L; public void onClick(AjaxRequestTarget target) { modalInput.show(target); } }); } public void setSelName(String selName) { this.selName = selName; } } >>>>ModalNameInputPanel.html<<<< <wicket:panel> <div> <form wicket:id="nameForm"> <label for="name">Name:</label> <input id="name" wicket:id="nameIn" type="text" /><br/>. <input type="submit" wicket:id="ok" value="ok"/> <input type="reset" wicket:id="cancel" value="cancel"/>. </form> </div> </wicket:panel> >>>>ModalNameInputPanel.java<<<< public class ModalNameInputPanel extends Panel { private static final long serialVersionUID = 1L; private static final Log log = LogFactory.getLog (ModalNameInputPanel.class); private ModalWindow window; private NamePanel namePanel; private String nameIn = "Knut"; public ModalNameInputPanel(String id, final ModalWindow win, NamePanel np) { super(id); this.window = win; this.namePanel = np; PropertyModel nameModel = new PropertyModel(this, "nameIn"); Form nameForm = new Form("nameForm"); add(nameForm); nameForm.add(new TextField("nameIn",nameModel));, nameForm.add(new NameSubmitLink("ok",true)); nameForm.add(new NameSubmitLink("cancel",false)); } private class NameSubmitLink extends AjaxSubmitLink { private static final long serialVersionUID = 1L; private boolean save = false; public NameSubmitLink(String id,boolean save) {; super(id); this.save = save; if (!save) setDefaultFormProcessing(false); } @Override protected void onSubmit(AjaxRequestTarget target, Form form) { if (save) { log.debug("New Name: " + nameIn); namePanel.setSelName(nameIn); } window.close(target); } }} }}} --------------------------------------------------------------------- To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org For additional commands, e-mail: users-h...@wicket.apache.org