Eirik Bjørsnøs wrote:


Hello Cocoon developers,

Would it be possible to load a form from a DOM tree instead of from a uri using the javascript flow api?

Well, if FormManager already supports it, I see no problem in exposing it in the Form JS object.

Sylvain

Sylvain,

The attatched patch for Form.js checks the type of the parameter in function/constructor Form(uriOrElement).

If uriOrElement is an instance of org.w3c.dom.Element, the form is loaded directly from the element. If not, it is loaded from the uri as before. The type checking is done using instanceof.

I'm quite new to Javascript, so you can probably think of better ways to solve this. But I've tested it and it works. It's very useful since I'm creating a multiform wizard but want to keep all the forms in the same xml.

Is there any possibility for this to be included in 2.1.6? (It's just a small fix, and shouldn't break existing code, but then again, smarter people than me have said that before and got burned :-)


Attachment: forms-js-loadfromelement.patch
Description: Binary data



Eirik.
--
Eirik Bjørsnøs

Reply via email to