On Tue, 2005-08-23 at 22:18 -0500, Antonio Gallardo wrote:
> 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,

Cheers Antonio. 

No, sadly I just do not get it working this way either.

I need to do now other work, so I will not find time in the next
days. :(

Anyway should I commit the limited support for cforms? That means that
you cannot use custom flow extension for the cforms which is a PITA. 

Anyway I talked to Antonio about this topic and he thinks that an
integration of custom flow and cforms would be best done via:
<!-- Flowscript Sample -->

     <map:match pattern="form1.flow">
       <map:call function="handleForm">
         <map:parameter name="function" value="form1"/>
         <map:parameter name="definitionURI" value="forms/form1.xml"/>
       </map:call>
     </map:match>

I will have a look on the weekend if I find time.

salu2
-- 
Thorsten Scherler
Wyona Inc.  -  Open Source Content Management  -  Apache Lenya
http://www.wyona.com                   http://lenya.apache.org
[EMAIL PROTECTED]                [EMAIL PROTECTED]


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

Reply via email to