cocoon-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Fabrizio Sitzia" <>
Subject Re: Ajax multivaluefield/double-listbox problem
Date Tue, 17 Jan 2006 15:56:24 GMT

I've digged a bit in the source myself ...and found out two things:

1. The "optNxxxxx is not defined" Javascript error is apparently caused by
the optNxxxxx variable being initialised in a local scope instead of the
document's global scope.
( For non-IE browsers, this can be fixed by replacing the line containing
"eval(scripts[i]);" in cocoon-ajax.js with "setTimeout(scripts[i], 10);" )

2. But even if the optNxxxxx variable is initialised all right, you will
stumble upon other stuff not being initialised correctly:

The 'double-listbox' widget relies on an object (OptionTransfer) that is
normally initialised by a document onLoad() handler.
That is fine for full page reloads, but with partial updates via Ajax, the
onLoad() handler for a freshly added 'double-listbox' widget is never
going to be executed!

I've looked at the bug report you mention below (COCOON-1718), and have
merged the changes to my 'cocoon-ajax.js' file, but it doesn't appear to
fix the global var-, nor the onLoad- issues with the 'double-listbox'

I'm currently working on a fix, tbc.

Thanks for your reply,

> Looking at the source, I believe this is due to the fact that
> <script></script> contents received via AJAX requests are executed
> before they are added to the main page's DOM, not after.  The styling
> for double-listbox includes a snippet of script that calls a global
> function to hook up event listeners etc., and this fails because at the
> time it is run the elements aren't yet part of the document.
> There is a bug report in Jira [1] about scripts being run too soon;
> someone attached a preliminary approach for a fix but it seems there are
> still issues with it.  Not sure if that helps or not.
> [1]

To unsubscribe, e-mail:
For additional commands, e-mail:

View raw message