Quantcast
Channel: Apache Timeline
Viewing all articles
Browse latest Browse all 5648

Synchronous Wicket.Ajax.get

$
0
0
I've implemented an AbstractDefaultAjaxBehavior as part of a custom
implemention of jqueryui dialog. In a nutshell...

This is the function bound to the dialog's beforeClose event. Returning
false cancels dialog close:
Wicket.Ajax.get({'u': '" + callbackUrl + "', 'async': false});return ok;

In the behavior's respond() method:
target.appendJavaScript("ok = true"); // or ok = false depending on
validation

This works fine when the user closes the dialog via the "X" button in the
title bar. However closing it via the dialog's close() method (triggered as
part of an ajax form submit - the form is in the dialog) doesn't work. After
debugging, I can see the callback function is called but not synchronously.
This means the ok variable isn't set when the function returns.

Any ideas? Any other approaches to hooking into beforeClose?

Viewing all articles
Browse latest Browse all 5648

Trending Articles