Patrick Refondini wrote:
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.
The binding is handled outside of the loop, in form.load() and form.save().
I have implemented a prototype "XML" editor using CForm/Binding/JX
Templates with ajax enabled. Cocoon does a wonderful job to support this!
Cool!
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.
I see. What you needed is probably a partial binding of the form, i.e.
binding only a widget (I suppose there must be fd:union somewhere) with
the fragment, instead of binding the full form.
Sylvain
--
Sylvain Wallez Anyware Technologies
http://bluxte.net http://www.anyware-tech.com
Apache Software Foundation Member Research & Technology Director
---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]