Thorsten Scherler wrote:
I changed the the view definition a wee bit in the spirit of Andreas:
<view template="usecases/test/cform.jx" type="cforms">
<definition template="usecases/test/cform.xml">
<before/>
<after>
form.setAttribute("counter", new java.lang.Integer(0));
</after>
</definition>
<binding template="usecases/test/cform_binding.xml">
<before>
var doc =
Packages.javax.xml.parsers.DocumentBuilderFactory.newInstance().newDocumentBuilder().newDocument();
doc.appendChild(doc.createElement("contracts"));
</before>
<after>
form.save(doc);
</after>
</binding>
</view>
The before/after elements should get rid of the old code I mentioned in
the earlier message. So instead of using:
var doc =
Packages.javax.xml.parsers.DocumentBuilderFactory.newInstance().newDocumentBuilder().newDocument();
doc.appendChild(doc.createElement("contracts"));
in the usecase.js directly (that is limited to my special usecase) I
wanted to use:
view.getCformBindingBefore()
That should allow custom flowscript additions that may be necessary for
the cforms. The problem is that "view.getCformBindingBefore()" is a
string that contains javascript commands which needs to be executed.
I tried with eval( view.getCformBindingAfter()) but that gave:
"Calling eval() with anything other than a primitive string value will
simply return the value. Is this what you intended?"
Does anybody know how to overcome that problem? For cforms we need to be
able to extend the usecase.js through custom flowscript.
Maybe you are looking for:
http://cocoon.apache.org/2.1/apidocs/org/apache/cocoon/forms/util/JavaScriptHelper.html
A sample how to use it is here in the cforms binding code.
1. See how to build the load/save script (search for "/Build load
script" or "//Build save script//"/):
http://svn.apache.org/viewcvs.cgi/cocoon/blocks/forms/trunk/java/org/apache/cocoon/forms/binding/JavaScriptJXPathBindingBuilder.java?view=markup
2. How to execute the script code (search for "doLoad(" or "doSave("):
http://svn.apache.org/viewcvs.cgi/cocoon/blocks/forms/trunk/java/org/apache/cocoon/forms/binding/JavaScriptJXPathBinding.java?view=markup
I hope this helps, ;-)
Best Regards,
Antonio Gallardo.
---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]