Simon,

Sorry about that... I forgot to give you the loadDOM function... which you seem to have worked out now anyway! But for completeness...

function loadDOM(uri, object) {
    try {
        var util = cocoon.createObject(Packages.org.apache.cocoon.components.flow.util.PipelineUtil);
        var dom =  util.processToDOM(uri, object);
    } finally {
        cocoon.disposeObject(util);
    }
    return dom;
}



On 16 Mar 2006, at 01:25, Simon Stanlake wrote:

This works:

var pu = cocoon.createObject(Packages.org.apache.cocoon.components.flow.util.PipelineUtil);

var model = pu.processToDOM("def.jxt",{"data":data});

as in the patch referenced previously in this thread.



From: Simon Stanlake [mailto:[EMAIL PROTECTED]]
Sent: Wednesday, March 15, 2006 11:54 AM
To: users@cocoon.apache.org
Subject: RE: CForms: creating dynamic widgets

I couldn't find the loadDOM() function - is there another .js file I need to import for this to work?


From: Robin Wyles [mailto:[EMAIL PROTECTED]]
Sent: Friday, February 10, 2006 10:07 AM
To: users@cocoon.apache.org
Subject: Re: CForms: creating dynamic widgets

Andrew,

From flow you can do...

cocoon.load("resource://org/apache/cocoon/forms/flow/_javascript_/Form.js");
...
var questions = someMethodToGetQuestions();
var model =  loadDOM("forms/application/definition.jxt ", {"questions": questions});
var form = new Form(model.getDocumentElement());
form.showForm("forms/application/template.jxt");

Hope this helps...

Robin

On 10 Feb 2006, at 13:29, Andrew Le Quesne wrote:

Hi there,

I am trying to generate a dynamic form template so I can create a list of questions that the user will answer from a set of questions stored in a database table.

I am setting the definition file by using a pipeline -  cocoon:/forms/application/definition.jxt  

To generate a JXT file.

 This works as a basic form but I need to pass a Java Object to it so that I can get a list of question objects from which to create the question set of widgets. Can anyone give me any advice or are there any examples of something  similar anywhere.

I am using cocoon 2.1.8

Thanks,

Andrew



Reply via email to