Well I managed to get the panels to replace without adding a new ModalWindow to the stack each time:
replacePanel(Panel existingPanel, Panel newPanel, String title, AjaxRequestTarget target) { existingPanel.replaceWith(newPanel); newPanel.setOutputMarkupId(true); modalContentWindow.setTitle(title); target.addComponent(newPanel); } This appears to work wonderfully - it allows me to toggle the ModalWindow content between two different PanelS and it does so cleanly with no flicker. However the 'Close' button that I added to each Panel will only work if no content toggling has taken place. Once the content has been toggled the Close button doesn't trigger a modal close. The 'X' in the top right of the Modal still works fine. > -----Original Message----- > From: Chris Colman [mailto:chr...@stepaheadsoftware.com] > Sent: Tuesday, 26 January 2010 4:27 AM > To: users@wicket.apache.org > Subject: RE: How to change content in ModalWindow > > For this to work can I use Panels for the Modal content or do I need to > use Pages for the content and set up a PageCreator? > > > -----Original Message----- > > From: Chris Colman [mailto:chr...@stepaheadsoftware.com] > > Sent: Tuesday, 26 January 2010 4:03 AM > > To: users@wicket.apache.org > > Subject: RE: How to change content in ModalWindow > > > > My use case might explain the situation better: > > > > User visits a page that needs authentication. A ModalWindow appears > with > > a username/password field pair and a 'sign in' button. In case they > are > > a new user it also contains a 'create account' button. If they click > > this then the contents of the ModalWindow changes to hold more fields, > > name, email, password, confirm password etc., sufficient to creating a > > new account. I wanted to do a nice smooth switch from the 'sign in' > > presentation to the 'create account' presentation without the flicker > of > > closing the form and bringing up a new form. > > > > > > > -----Original Message----- > > > From: Chris Colman [mailto:chr...@stepaheadsoftware.com] > > > Sent: Tuesday, 26 January 2010 3:58 AM > > > To: users@wicket.apache.org > > > Subject: RE: How to change content in ModalWindow > > > > > > I tried that initially but calling modalContentWindow.show when > there > > > already is a ModalWindow being displayed creates a new ModalWindow > > that > > > sits over the top of the original one meaning I now have 2 windows > > that > > > the user has to close. > > > > > > My aim is to have only one ModalWindow but just switch its contents. > > > > > > > Aren't you missing a : > > > > > > > > modalContentWindow.show(target) > > > > > > > > in the onClick callback ? > > > > > > > > 2010/1/25 Chris Colman <chr...@stepaheadsoftware.com> > > > > > > > > > Searching Nable shows this question has been asked before but > > there > > > none > > > > > of the solutions proposed there work for me. > > > > > > > > > > I have a link in PanelA that, when clicked, should cause PanelB > to > > > > > display in the same ModalWindow (PanelB replaced PanelA). > > > > > > > > > > The onClick event handler does something like the following: > > > > > > > > > > add > > > > > ( > > > > > new AjaxLink("selectionLink") > > > > > { > > > > > public void onClick(AjaxRequestTarget target) > > > > > { > > > > > PanelB panelB = new > > > > > PanelB(modalContentWindow.getContentId()); > > > > > > > > > > modalContentWindow.setContent(panelB); > > > > > modalContentWindow.setTitle("Hi, I'm > PanelB"); > > > > > target.addComponent(panelB); > > > > > } > > > > > } > > > > > ); > > > > > > > > > > When the link is pressed the panel A content disappears (popup > > > content > > > > > goes blank) but the panel B content does not appear. > > > > > > > > > > Should this work or have I missed something? > > > > > > > > > > > > > > --------------------------------------------------------------------- > > > > > 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 > > > > > > --------------------------------------------------------------------- > > 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 --------------------------------------------------------------------- To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org For additional commands, e-mail: users-h...@wicket.apache.org