You are viewing a plain text version of this content. The canonical link for it is here.
Posted to adffaces-user@incubator.apache.org by Böhringer Jochen <Jo...@tcc-products.de> on 2006/12/06 18:14:02 UTC

PPR and JavaScript inside a component

Hello,

I have written a component which allows drag and drop. Inside the component's renderer I output some javascript like this one:

<script language="JavaScript">new Dojo.dnd.AjaxDragSource(dojo.byId("csf:treeTableId:1:_id39"), "*", "154", "csf:treeTableId:1:_id39", "clientValue");</script>

The Javascript Class Dojo.dnd.AjaxDragSource is defined in a javascript source dragAndDrop.js I include using:

<trh:script source="../js/dragAndDrop.js" partialTriggers="csf:treeTableId:dropZoneId csf:treeTableId"></trh:script>


The first time a page containing this component is rendered everything works fine. If I use my component inside a page part which executes a PPR I get a javascript error saying that Dojo.dnd.AjaxDragSource is not defined.

I have added the partialTriggers attribute to the trh:script to make sure that the script is included in the page and if I look at the browser source view I see that it is included.

The strange thing is that both IE7 and Firefox 1.5 show me a JavaScript error. But Firefox seems to execute the JavaScript although it marks an error in its JavaScript console. IE does not execute the code.

I have seen some capabilities of Trinidad in the XhtmlUtils, AutoSubmitUtils and Scriptlet class to manage javascript includes with Trinidad. Does it solve my problem if I use these classes?

Regards
Jochen