Hi,

I am attempting to create a usecase which will give a user a form to fill out, and save their response as an XML file. My problem is that things 'seem' to work .. but it doesn't seem to save the file anywhere. Is Lenya doing something dynamically that I am not aware of (or am I simply doing something stupid :p)?

I'm not quite sure where the problem is(I know that form.getXML() does give me what I need though), and am not sure where to ideally save files under lenya (ie would /lenya/{publication-name}/{myFileFolder} be a good place?)

Any hints to what I could be doing wrong would be greatly appreciated!

Thanks,

Vica

------------------------------------------------------------------
usecase-registration.xmap:

...
 <map:pipeline>
        <map:match pattern="*.continue">
            <map:call continuation="{1}"/>
        </map:match>
        
        <map:match pattern="**/*.continue">
            <map:call continuation="{2}"/>
        </map:match>
        
        <map:match pattern="registration-display-pipeline">
            <map:generate src="forms/registration_template.xml"/>
            <map:call resource="style-cms-page"/>
        </map:match>      
        
        <map:match pattern="registration-success-pipeline.jx">
            <map:generate type="jx" src="forms/registration_success_jx.xml"/>
            <map:serialize/>
        </map:match>      

        <map:match pattern="**">
            <map:call function="registration">
                 <map:parameter name="documentURI" value="vica_data.xml"/>
            </map:call>
        </map:match>
    </map:pipeline>
...

-----------------------
registration.js :

cocoon.load("resource://org/apache/cocoon/forms/flow/javascript/Form.js");

function registration()
{
        var form = new Form("forms/registration.xml");
        form.createBinding("binding/registration_bind.xml");
var documentURI = "opt/lenya/jakarta-tomcat-5.0.28/webapps/lenya/lenya/pubs/demo/forms/vica_data.xml"

form.showForm("registration-display-pipeline");
saveToFile(form.getXML(), documentURI);
cocoon.sendPage("registration-success-pipeline.jx", form.getXML());
}

function saveToFile(text, uri)
{
        var fileWriter;
        try
        {
                fileWriter = new java.io.FileWriter(uri);
                fileWriter.write(text);
                fileWriter.close();
        }
        catch(e)
        {
                print("file not found");
        }
}
----


http://devhost:8080/lenya/demo/authoring/index.html?lenya.usecase=registration brings up the form

http://devhost:8080/lenya/demo/authoring/0c543f464d53377e262215401d2f786971696f2f.continue?lenya.usecase=registration
brings up the result

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

Reply via email to