cocoon-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Thorsten Scherler <thors...@apache.org>
Subject flow - java.util.Object[] {something} causes syntax Error
Date Wed, 24 Aug 2005 19:18:00 GMT
Hi all,

Background:
****************************************************
I am trying to activate cforms in Lenya's usecase-fw.

For this I need to execute javascript snippets that are coming from a
configuration file. e.g. 
<after>
 form.setAttribute("counter", new java.lang.Integer(0));
</after>

Antonio pointed me to
http://cocoon.apache.org/2.1/apidocs/org/apache/cocoon/forms/util/JavaScriptHelper.html

I tested before with execScript (I started with that) like:
jsHelper.execScript(view.getTestScript(),scriptMap,objectModel);
but that did not work.

I created a function which I want to access in the flow script. I am
trying to use "public static Object callFunction(Function func, Object
thisObject, Object[] arguments, Map objectModel)" from within my *flow*
script.

Instead of using:
form = new Form(viewDef);
form.setAttribute("counter", new java.lang.Integer(0));

I want to use:
var flowHelper =
cocoon.getComponent("org.apache.lenya.cms.cocoon.flow.FlowHelper");
var objectModel = flowHelper.getObjectModel(cocoon);
var jsHelper = new
Packages.org.apache.cocoon.forms.util.JavaScriptHelper();
form = new Form(viewDef);
jsHelper.callFunction(view.getTestFunction(),form,new java.util.Object[]
{form}, objectModel);

Problem:
*****************************************************
As soon as I try:
var test = new java.util.Object[] {"test"};

I get:
...
Caused by: SyntaxError: syntax error
(file:/home/thorsten/apache/lenya-trunk/build/lenya/webapp/lenya/usecases/usecases.js; line
144)
 
which is above line.

How can I use JavaScriptHelper.callFunction if I cannot create an
Object[]?

Is there another way to create a Object[] then the above mentioned? Is
this a bug?

Is there a better way to execute javascript that is stored in a string?

TIA

salu2
-- 
thorsten

"Together we stand, divided we fall!" 
Hey you (Pink Floyd)

--------------------------------------------------------------
Thorsten Scherler
Wyona Inc.  -  Open Source Content Management  -  Apache Lenya
http://www.wyona.com                   http://lenya.apache.org
thorsten.scherler@wyona.com                thorsten@apache.org




Mime
View raw message