Martin, thanks for the answer!
However, as I said, I *did* manage to open it on pageload. The problem is to open it programmatically at any point of a member function of the Panel instance. Ideally, I'd like to do something like: public MyPanel() { // panel creation add(...) // ... // business logic // somestuff // ... Boolean userConfirm = modalDialog(...); If( userConfirm ) { // other stuff If( modalDialog("Another question") ) { // more stuff } } // other stuff } M. -----Ursprüngliche Nachricht----- Von: Martin Grigorov [mailto:mgrigo...@apache.org] Gesendet: Montag, 16. Februar 2015 14:43 An: users@wicket.apache.org Betreff: Re: All inside a Panel Hi, See http://stackoverflow.com/questions/4765790/how-to-open-modaldialog-on-pageload I think the second approach/answer is better. Martin Grigorov Wicket Training and Consulting https://twitter.com/mtgrigorov On Mon, Feb 16, 2015 at 1:37 PM, Massimo Redaelli <massimo.redae...@aia.ch> wrote: > Hello everybody. First question from a newbie, sorry if it's stupid. > > I'm customizing a software that uses wickets, version 1.5.7. I have to > add some behavior, and the only way the framework gives me is making > me implement two callbacks, one that is supposed to contain the > business logic, and one that returns a panel to be displayed. > These callbacks are called only once, in this order. > > This would be perfect if I only needed to show the results, but I also > want to ask for user input, in particular I need modal confirmation dialogs. > > I tried putting all the business logic in the panel constructor or in > a function called after the panel rendering (I know it sucks, but I > don't see an alternative), and then using an Ajax Modal dialog. > However, the modal dialog show() function requires an AjaxTarget, > which is available only after a user action (click on a link, say). > (Actually, I found online that I could use > RequestCycle.get().find(AjaxRequestTarget.class), but it's not working > for me). > > I can simulate a user clicking, using javascript, so I thought I'd put > an invisible link and use that, but again I cannot do so inside the > flow of the business logic (I managed only on page load...). > > What I need is to be able to show a dialog whenever I need, and to > wait for a return value. > > I even tried linking the dialog display to an onchange handler of a > hidden checkbox that I change through its model, but the event doesn't > get triggered. > > Can anyone give a hand? :) > > M. >