You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@cocoon.apache.org by Peter Sparkes <pe...@didm.co.uk> on 2006/03/31 11:33:30 UTC
Re: Flowscript - amend file - Solved
I have solved the problem
doc is the document, appendChild is a method of the node object so have
to use
doc.documentElement.appendChild(lodgeEl);
where documentElement returns the element node of the doc
Peter Sparkes
> Hi,
>
> I am using CForms to generate and store files on the server. I want to
> take some of the entered data and use it to amend a different file
> stored on the server. Within the CForm javascript I extract the data
> from the form using
>
> var lodge= form.getChild("name").getValue();
>
> I then load the file which I wish to amend with
>
> var doc = loadDocument("test.xml");
>
> find the element which I wish to amend with
>
> doc.getElementById('a')
>
> save the doc with
>
> saveDocument(doc, 'test1.xml');
>
> All this works fine, but when I try append the data to the file with
>
> doc.getElementById('a').appendChild(doc.createTextNode(lodge));
>
> I get the following error
>
> org.mozilla.javascript.EcmaError: Cannot convert null to an object.
>
> Please can anyone tell me what I am doing wrong.
>
> Peter Sparkes
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@cocoon.apache.org
> For additional commands, e-mail: users-help@cocoon.apache.org
>
>
---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@cocoon.apache.org
For additional commands, e-mail: users-help@cocoon.apache.org