Hey all,
I'm currently in the progress of migrating a largish Wicket 1.5 app to
Wicket 6.2. The only major problem I could not resolve so far are
precondition scripts with user input.
My old code looked like this:
@Override
> public CharSequence postDecorateScript(Component component, CharSequence
> script) {
> return "jConfirm(function(r) { if (r) {" + script + "}});";
> }
The whole script was decorated and the callback only executed if the user
pressed OK in a custom confirmation dialog.
In Wicket 6, there are no more script decorators, just listeners that
provide hooks into the ajax lifecycle, so I changed my code to this:
@Override
> public CharSequence getPrecondition(final Component component) {
> return "jConfirm(function(r) { if (r) { return true; } }); return false;";
> }
The problem is, that the callback function I'm passing to jConfirm is
evaluated only when the user makes a selection, but the precondition has to
return an output immediately. It would work if we used browser-level
confirmation dialogs, but we use a custom jquery dialog for better user
experience.
Is there any way to emulate the pre-Wicket 6 behavior using listeners?
Kind regards,
Thomas