On Mon, February 25, 2013, Martin Grigorov wrote: > > | AjaxCallListener myAjaxCallListener = new AjaxCallListener(); > > | myAjaxCallListener.onBeforeSend( return "for ( instance in > > CKEDITOR.instances ) CKEDITOR.instances[instance].updateElement();" ); > > > > except the leading "return" all looks OK to me. > Add some logging with console.log() and see what is available in the > context.
OK, I got it, thought this would be nice to have in the archives for others. First, the "return" was of course not from the real code, I did some on-the-fly optimizing of the code to avoid unnecessary complexity in this example before I posted it. The culprit was basically the lack of three letters - "var". The variable "instance" was not declared before use. While this is totally fine when executed in the browser, it throws an exception in the code environment in which Wicket calls this callback. This way the code works: | var instance; for ( instance in CKEDITOR.instances ) CKEDITOR.instances[instance].updateElement(); I had to ask my local JS guru for help, I would never have found this one alone. As I've run across a number of issues migrating from 1.4 to 6.6 now, I would like to suggest creating and continuously extending a Wiki page, like: "Old patterns vs. New patterns", where we can just add such things (as: for Ajax, instead of JavaScriptUtils.writeJavaScript() inside onRender() use OnDomReadyHeaderItem.forScript() in renderHead()), so that they can be found more easily? Cheers, M'bert -- ----------- / http://herbert.the-little-red-haired-girl.org / ------------- =+= Tower: Hoehe und Position? Pilot: Ich bin 1.80m und sitze vorne links. --------------------------------------------------------------------- To unsubscribe, e-mail: [email protected] For additional commands, e-mail: [email protected]
