Fabrizio Sitzia wrote:
Hello

I'm experiencing problems when rendering a multivaluefield using the
'double-listbox' styling - when that multivaluefield is contained in a
repeater, and Ajax is enabled for the form (ft:form-template ajax="true")

The 'double-listbox'-styled fields in the repeater stop working as soon as
some action, involving a round-trip to the server and a partial
re-rendering of the repeater, is being performed (for example adding or
deleting a repeater row)
After such a round-trip, a click on any of the double-listbox's UI
elements (double-click on an item, click on an option-transfer button)
will yield the Javascript error "optNxxxxx is not defined".

The form works fine if Ajax is disabled, or if a styling other than
'double-listbox' is used for rendering the multivaluefields (default
styling as a multiple-selection list, or list-type='checkbox' styling)

Has somebody out there experienced this problem, or even better, come with
a fix for it?


I would like to keep Ajax enabled - especially as it avoids the 'jump to
top-of-page' effect when adding or deleting rows on lengthy forms. And I
would like to also keep the 'double-listbox', simply because to most users
they are a lot more intuitive to use than html's default
multiple-selection boxes, and less noisy than a bunch of checkboxes.


BTW: The Cocoon version I'm using is 2.1.8
The problem does not appear to be browser-specific (same behaviour with
IE6 on Windows, Firefox on both Windows and OSX, Safari on OSX)

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] http://issues.apache.org/jira/browse/COCOON-1718



---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]