All,

I've created a simple confirmation link based on Sven Meier's ConfirmationLink code <https://cwiki.apache.org/confluence/x/X4U> on Confluence. For the most part it works, but...

...but if I'm on an upload form, then an an Ajax link won't work because I need to actually submit the multipart information.

The theory behind Sven's code should work the same with or without an Ajax link. Wicket's AjaxLink simply provides an easy way to inject the confirmation JavaScript without having to wire the event handling manually. You'll see on the same page listed above other examples that do this wiring manually, and do it in a way that is decidedly "not correct" (replacing the onclick attribute) according to today's modern JavaScript best practices (and frankly hasn't been correct for almost a decade).

There is some discussion of this sort on that page, with a bit of back-and-forth about wanting a general, reusable solution, but in the end only giving an example of "something in that fashion" and with another contributor noting that their solution "isn't working and I need to figure out why". And now we're at Wicket 7 and even the incomplete examples on this page don't work anymore because the underlying classes have been removed.

(On that page the idea of Ed Eustace is also mentioned, namely to use Component.replaceWith() to have an embedded confirmation panel that appears when needed. But it's as usually a completely do-it-yourself project.)

So, friends, does the latest version of Wicket have an easy way to make a confirmation dialog? If not, does it have an easy way for me to inject JavaScript using best-practice DOM event binding?

Garret

Reply via email to