Ah I thought the 'create new account' check box was on the parent page and checked before the Window was opened. But its in the window itself. Right so you want to replace a panel in the page. In that case:
I do this as well as I have a form in my ModalWindow that allows a user to confirm an action and then a message is displayed. The content of the ModalWindow is just a Panel, the components of which you can just replace normally via the AjaxRequestTarget. cheers, Steve On 27/01/2010, at 4:33 PM, Chris Colman wrote: > >> You could just have the ModalWindow's contents be set in the onClick > of >> the button that shows the window. > > That's how I'm opening them but that's not the problem. The problem is > once I have a ModalWindow open I want to switch the contents without the > 'flicker' of shutting down the ModalWindow and opening up another one. > > Although I tried doing the shut down/reopen and didn't have much success > with that either. Maybe that's not possible with Wicket/AJAX - it might > want to do only major action for any AJAX event i.e. either close or > open a modal but not both together. > >> Then you know if the checkbox has been checked or not and you can add > in >> the appropriate panel, then just show the window. >> >> In my app I have any number of modal windows that might show depending > on >> the state of the page so I just construct it when I need it. >> >> cheers, >> Steve >> >> >> >> On 26/01/2010, at 5:30 AM, Chris Colman wrote: >> >>> Also, it seems like ModalWindow.setTitle will not update the title > after >>> the initial ModalWindow.show has been called. >>> >>> Is there any way to trigger a title update after show has been > called? >>> >>>> -----Original Message----- >>>> From: Chris Colman [mailto:chr...@stepaheadsoftware.com] >>>> Sent: Tuesday, 26 January 2010 5:15 AM >>>> To: users@wicket.apache.org >>>> Subject: RE: How to change content in ModalWindow - minor success! >>>> >>>> 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 >>> >>> >>> > --------------------------------------------------------------------- >>> 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