Sylvain Wallez wrote:
Patrick Refondini wrote:

Thanks, for the quick answer!

I looked at the source code available on SVN:
http://svn.apache.org/viewcvs.cgi/*checkout*/cocoon/blocks/
in
forms/trunk/java/org/apache/cocoon/forms/flow/javascript/Form.js


Now I am going to reveal my whole Javascript incompetency:

The showForm() function located in Form.js has the following signature:

Form.prototype.showForm = function(uri, viewdata, ttl) { (...) }

Is it the implementation for use case such as:

(...)
// Load form definition     var form = new Form(formDefinition);


This calls the Form(...) function which then acts as a constructor.

// Send form to client
form.showForm("some-pipeline.jx");
(...)

It is not quite clear yet how Form.prototype.showForm() can be called Form.prototype.showForm() and how a call to form.showForm("some-pipeline.jx") is matched something like form.showForm("some-pipeline.jx", null, null) ?


Form.prototype.showForm attaches a function to the Form's prototype which is then visible in objects created with "new Form(...)". This is similar to declaring a method on a Java class. Also, JavaScript has no notion of method overloading, but accepts variable argument lists. Unspecified function arguments then have the value "undefined" (a JS keyword).
Thanks for this clarification.


Nevertheless I'll need to take a deeper look at this source code and try to find some Javascript tutorials ;)


I've you start with JavaScript, using Form.js as a tutorial is probably a bad idea, as it's not the simplest JS you can find and makes an advanced use of continuations to implement the form redisplay loop without actually looping.
I understand...

I try to get a deeper understanding of the showForm() continuation "loop" to see when bindings to data are actually applied / reloaded in particular in the fb:simple-repeater.

I have implemented a prototype "XML" editor using CForm/Binding/JX Templates with ajax enabled. Cocoon does a wonderful job to support this!

My goal is to let a user insert a "Form Fragment" build from a template XML file. But I haven't been able to do it yet although I see no reason, my Cocoon understanding appart, why it should not be possible.

Patrick


Sylvain



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