You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@cocoon.apache.org by Job van Ommen <jo...@gmail.com> on 2008/09/29 13:38:45 UTC

how: XMLbinding using Cform in cocoon 2.2?

Ok, so I am new to the whole cform thing. It seems like a good way to
implement forms...BUT

I can't get it to work. I've gone through the 2.2 and 2.1 documentation but
I can't get it to work.

Let's keep it simple and use the sample:

The sample from
http://cocoon.apache.org/2.2/blocks/forms/1.0/478_1_1.htmldoesn't use
binding.
What If i wanted to add binding and save the results to a file?

I've noticed the "simplebinding" and found the following flowscript on the
web somewhere, but It doesn't work...

Please, somebody tell me how it should be done?

-what should be in the sitemap?
-what should be in the binding xml?
-should the template or the definition als contain something that points to
the binding.xml ?

cocoon.load("servlet:forms:/resource/internal/flow/javascript/Form.js");

function registration() {
   *form.createBinding("cocoon://resource/internal/registration_binding.xml");
*
    var form = new
Form("cocoon://resource/internal/registration_definition.xml");;
    form.showForm("registration-display-pipeline");

    var viewData = { "username" : form.getChild("name").getValue() }*
form.saveXML("cocoon://resource/internal/binding.xml");*

    cocoon.sendPage("registration-success-pipeline", viewData);
}

how: XMLbinding using Cform in cocoon 2.2?

Posted by Job van Ommen <jo...@gmail.com>.
Ok, so I am new to the whole cform thing. It seems like a good way to
implement forms...BUT

I can't get it to work. I've gone through the 2.2 and 2.1 documentation but
I can't get it to work.

Let's keep it simple and use the sample:

The sample from
http://cocoon.apache.org/2.2/blocks/forms/1.0/478_1_1.htmldoesn't use
binding.
What If i wanted to add binding and save the results to a file?

I've noticed the "simplebinding" and found the following flowscript on the
web somewhere, but It doesn't work...

Please, somebody tell me how it should be done?

-what should be in the sitemap?
-what should be in the binding xml?
-should the template or the definition als contain something that points to
the binding.xml ?

cocoon.load("servlet:forms:/resource/internal/flow/javascript/Form.js");

function registration() {
   *form.createBinding("cocoon://resource/internal/registration_binding.xml");
*
    var form = new
Form("cocoon://resource/internal/registration_definition.xml");;
    form.showForm("registration-display-pipeline");

    var viewData = { "username" : form.getChild("name").getValue() }*
form.saveXML("cocoon://resource/internal/binding.xml");*

    cocoon.sendPage("registration-success-pipeline", viewData);
}

Re: XMLbinding using Cform in cocoon 2.2?

Posted by Job van Ommen <jo...@gmail.com>.
I'm sorry I mailed too fast, I figured it out.

Cheers

On Wed, Oct 1, 2008 at 10:18 AM, Job van Ommen <jo...@gmail.com>wrote:

> Made some progress, I actually made a form and get it populated, BUT:
> I do not understand what this is pointing to: form2-display-pipeline since
> the sitemap does not contain this pipeline at all
>
> I've created my own pipeline to display the form and now something happens,
> but the file doesn't get saved :(
>
> Kind regards,
>
> Job
>
>
> On Wed, Oct 1, 2008 at 9:23 AM, Job van Ommen <jo...@gmail.com>wrote:
>
>> Ok, so I've checked out the trunk and tried to "upgrade" the simple sample
>> form with binding.
>>
>> If I do the flowscript and the sitemap as they're done in the
>> form2simpleXML.flow sample I get the following error:
>>
>> Caused by: org.apache.cocoon.ProcessingException: Error calling function
>> handleForm
>>         at
>> servlet:org.apache.cocoon.forms.impl.servlet+:/resource/internal/flow/javascript/Form.js:339
>>         at form2simpleXML - file:///C:/Documents and
>> Settings/job/Desktop/Comaker
>> 4/cocoon-2.1.11/cocoon-2.2.0/cocoon-2.2.0/simple-sample/./src/main/r
>> esources/COB-INF/flow/registration.js:10
>>         at handleForm -
>> servlet:org.apache.cocoon.forms.impl.servlet+:/resource/internal/flow/javascript/Form.js:416
>>         at <map:call> -
>> file:///C:/Documents%20and%20Settings/job/Desktop/Comaker%204/cocoon-2.1.11/cocoon-2.2.0/cocoon-2.2.0/simple-sample/./src/main
>> /resources/COB-INF/sitemap.xmap:68:41
>>         at <map:match> -
>> file:///C:/Documents%20and%20Settings/job/Desktop/Comaker%204/cocoon-2.1.11/cocoon-2.2.0/cocoon-2.2.0/simple-sample/./src/mai
>> n/resources/COB-INF/sitemap.xmap:67:54
>>
>> So I figured I should just try to replace the xml files in the blocks/cocoon-forms/cocoon-forms-sample/src/main/resources/COB-INF
>> folder with my own, just so I could test some stuff.
>>
>> But to my amazement nothing changes. Ok so I figured I need to do a mvn
>> clean install...still no change. And I've set the used files correctly in
>> the config.xmap.
>>
>> Ofcourse my main problem still persists: I can't get binding to work in my
>> own block...
>>
>> Any clues?
>>
>> On Tue, Sep 30, 2008 at 8:39 AM, Jasha Joachimsthal <
>> j.joachimsthal@onehippo.com> wrote:
>>
>>>  Hi Job,
>>>
>>>  ------------------------------
>>> *From:* Job van Ommen [mailto:jobvanommen@gmail.com]
>>> *Sent:* maandag 29 september 2008 13:39
>>> *To:* users@cocoon.apache.org
>>> *Subject:* how: XMLbinding using Cform in cocoon 2.2?
>>>
>>>  Ok, so I am new to the whole cform thing. It seems like a good way to
>>> implement forms...BUT
>>>
>>> I can't get it to work. I've gone through the 2.2 and 2.1 documentation
>>> but I can't get it to work.
>>>
>>> Let's keep it simple and use the sample:
>>>
>>> The sample from
>>> http://cocoon.apache.org/2.2/blocks/forms/1.0/478_1_1.html doesn't use
>>> binding.
>>> What If i wanted to add binding and save the results to a file?
>>>
>>> I've noticed the "simplebinding" and found the following flowscript on
>>> the web somewhere, but It doesn't work...
>>>
>>> Please, somebody tell me how it should be done?
>>>
>>> -what should be in the sitemap?
>>> -what should be in the binding xml?
>>> -should the template or the definition als contain something that points
>>> to the binding.xml ?
>>>
>>> cocoon.load("servlet:forms:/resource/internal/flow/javascript/Form.js");
>>>
>>> function registration() {
>>>    *form.createBinding("cocoon://resource/internal/registration_binding.xml");
>>> *
>>>     var form = new
>>> Form("cocoon://resource/internal/registration_definition.xml");;
>>>     form.showForm("registration-display-pipeline");
>>>
>>>     var viewData = { "username" : form.getChild("name").getValue() }*
>>> form.saveXML("cocoon://resource/internal/binding.xml");*
>>>
>>>     cocoon.sendPage("registration-success-pipeline", viewData);
>>> }
>>>
>>>
>>> There is a simple XML binding example in the samples.  If youve checked
>>> out Cocoon 2.2 it's in
>>> blocks/cocoon-forms/cocoon-forms-sample/src/main/resources/COB-INF. Have a
>>> look at the form2simpleXML. The flowscript function is in
>>> flow/binding_example.js.
>>>
>>>
>>> Regards,
>>>
>>>
>>> Jasha Joachimsthal
>>>
>>> j.joachimsthal@onehippo.com - jasha@apache.org
>>>
>>> www.onehippo.com
>>> Amsterdam - Hippo B.V. Oosteinde 11 1017 WT Amsterdam +31(0)20-5224466
>>> San Francisco - Hippo USA Inc. 101 H Street, suite Q Petaluma CA
>>> 94952-3329 +1 (707) 773-4646
>>>
>>
>>
>

Re: XMLbinding using Cform in cocoon 2.2?

Posted by Job van Ommen <jo...@gmail.com>.
Made some progress, I actually made a form and get it populated, BUT:
I do not understand what this is pointing to: form2-display-pipeline since
the sitemap does not contain this pipeline at all

I've created my own pipeline to display the form and now something happens,
but the file doesn't get saved :(

Kind regards,

Job

On Wed, Oct 1, 2008 at 9:23 AM, Job van Ommen <jo...@gmail.com> wrote:

> Ok, so I've checked out the trunk and tried to "upgrade" the simple sample
> form with binding.
>
> If I do the flowscript and the sitemap as they're done in the
> form2simpleXML.flow sample I get the following error:
>
> Caused by: org.apache.cocoon.ProcessingException: Error calling function
> handleForm
>         at
> servlet:org.apache.cocoon.forms.impl.servlet+:/resource/internal/flow/javascript/Form.js:339
>         at form2simpleXML - file:///C:/Documents and
> Settings/job/Desktop/Comaker
> 4/cocoon-2.1.11/cocoon-2.2.0/cocoon-2.2.0/simple-sample/./src/main/r
> esources/COB-INF/flow/registration.js:10
>         at handleForm -
> servlet:org.apache.cocoon.forms.impl.servlet+:/resource/internal/flow/javascript/Form.js:416
>         at <map:call> -
> file:///C:/Documents%20and%20Settings/job/Desktop/Comaker%204/cocoon-2.1.11/cocoon-2.2.0/cocoon-2.2.0/simple-sample/./src/main
> /resources/COB-INF/sitemap.xmap:68:41
>         at <map:match> -
> file:///C:/Documents%20and%20Settings/job/Desktop/Comaker%204/cocoon-2.1.11/cocoon-2.2.0/cocoon-2.2.0/simple-sample/./src/mai
> n/resources/COB-INF/sitemap.xmap:67:54
>
> So I figured I should just try to replace the xml files in the blocks/cocoon-forms/cocoon-forms-sample/src/main/resources/COB-INF
> folder with my own, just so I could test some stuff.
>
> But to my amazement nothing changes. Ok so I figured I need to do a mvn
> clean install...still no change. And I've set the used files correctly in
> the config.xmap.
>
> Ofcourse my main problem still persists: I can't get binding to work in my
> own block...
>
> Any clues?
>
> On Tue, Sep 30, 2008 at 8:39 AM, Jasha Joachimsthal <
> j.joachimsthal@onehippo.com> wrote:
>
>>  Hi Job,
>>
>>  ------------------------------
>> *From:* Job van Ommen [mailto:jobvanommen@gmail.com]
>> *Sent:* maandag 29 september 2008 13:39
>> *To:* users@cocoon.apache.org
>> *Subject:* how: XMLbinding using Cform in cocoon 2.2?
>>
>>  Ok, so I am new to the whole cform thing. It seems like a good way to
>> implement forms...BUT
>>
>> I can't get it to work. I've gone through the 2.2 and 2.1 documentation
>> but I can't get it to work.
>>
>> Let's keep it simple and use the sample:
>>
>> The sample from
>> http://cocoon.apache.org/2.2/blocks/forms/1.0/478_1_1.html doesn't use
>> binding.
>> What If i wanted to add binding and save the results to a file?
>>
>> I've noticed the "simplebinding" and found the following flowscript on the
>> web somewhere, but It doesn't work...
>>
>> Please, somebody tell me how it should be done?
>>
>> -what should be in the sitemap?
>> -what should be in the binding xml?
>> -should the template or the definition als contain something that points
>> to the binding.xml ?
>>
>> cocoon.load("servlet:forms:/resource/internal/flow/javascript/Form.js");
>>
>> function registration() {
>>    *form.createBinding("cocoon://resource/internal/registration_binding.xml");
>> *
>>     var form = new
>> Form("cocoon://resource/internal/registration_definition.xml");;
>>     form.showForm("registration-display-pipeline");
>>
>>     var viewData = { "username" : form.getChild("name").getValue() }*
>> form.saveXML("cocoon://resource/internal/binding.xml");*
>>
>>     cocoon.sendPage("registration-success-pipeline", viewData);
>> }
>>
>>
>> There is a simple XML binding example in the samples.  If youve checked
>> out Cocoon 2.2 it's in
>> blocks/cocoon-forms/cocoon-forms-sample/src/main/resources/COB-INF. Have a
>> look at the form2simpleXML. The flowscript function is in
>> flow/binding_example.js.
>>
>>
>> Regards,
>>
>>
>> Jasha Joachimsthal
>>
>> j.joachimsthal@onehippo.com - jasha@apache.org
>>
>> www.onehippo.com
>> Amsterdam - Hippo B.V. Oosteinde 11 1017 WT Amsterdam +31(0)20-5224466
>> San Francisco - Hippo USA Inc. 101 H Street, suite Q Petaluma CA
>> 94952-3329 +1 (707) 773-4646
>>
>
>

Re: XMLbinding using Cform in cocoon 2.2?

Posted by Job van Ommen <jo...@gmail.com>.
Ok, so I've checked out the trunk and tried to "upgrade" the simple sample
form with binding.

If I do the flowscript and the sitemap as they're done in the
form2simpleXML.flow sample I get the following error:

Caused by: org.apache.cocoon.ProcessingException: Error calling function
handleForm
        at
servlet:org.apache.cocoon.forms.impl.servlet+:/resource/internal/flow/javascript/Form.js:339
        at form2simpleXML - file:///C:/Documents and
Settings/job/Desktop/Comaker
4/cocoon-2.1.11/cocoon-2.2.0/cocoon-2.2.0/simple-sample/./src/main/r
esources/COB-INF/flow/registration.js:10
        at handleForm -
servlet:org.apache.cocoon.forms.impl.servlet+:/resource/internal/flow/javascript/Form.js:416
        at <map:call> -
file:///C:/Documents%20and%20Settings/job/Desktop/Comaker%204/cocoon-2.1.11/cocoon-2.2.0/cocoon-2.2.0/simple-sample/./src/main
/resources/COB-INF/sitemap.xmap:68:41
        at <map:match> -
file:///C:/Documents%20and%20Settings/job/Desktop/Comaker%204/cocoon-2.1.11/cocoon-2.2.0/cocoon-2.2.0/simple-sample/./src/mai
n/resources/COB-INF/sitemap.xmap:67:54

So I figured I should just try to replace the xml files in the
blocks/cocoon-forms/cocoon-forms-sample/src/main/resources/COB-INF
folder with my own, just so I could test some stuff.

But to my amazement nothing changes. Ok so I figured I need to do a mvn
clean install...still no change. And I've set the used files correctly in
the config.xmap.

Ofcourse my main problem still persists: I can't get binding to work in my
own block...

Any clues?

On Tue, Sep 30, 2008 at 8:39 AM, Jasha Joachimsthal <
j.joachimsthal@onehippo.com> wrote:

>  Hi Job,
>
>  ------------------------------
> *From:* Job van Ommen [mailto:jobvanommen@gmail.com]
> *Sent:* maandag 29 september 2008 13:39
> *To:* users@cocoon.apache.org
> *Subject:* how: XMLbinding using Cform in cocoon 2.2?
>
>  Ok, so I am new to the whole cform thing. It seems like a good way to
> implement forms...BUT
>
> I can't get it to work. I've gone through the 2.2 and 2.1 documentation but
> I can't get it to work.
>
> Let's keep it simple and use the sample:
>
> The sample from http://cocoon.apache.org/2.2/blocks/forms/1.0/478_1_1.htmldoesn't use binding.
> What If i wanted to add binding and save the results to a file?
>
> I've noticed the "simplebinding" and found the following flowscript on the
> web somewhere, but It doesn't work...
>
> Please, somebody tell me how it should be done?
>
> -what should be in the sitemap?
> -what should be in the binding xml?
> -should the template or the definition als contain something that points to
> the binding.xml ?
>
> cocoon.load("servlet:forms:/resource/internal/flow/javascript/Form.js");
>
> function registration() {
>    *form.createBinding("cocoon://resource/internal/registration_binding.xml");
> *
>     var form = new
> Form("cocoon://resource/internal/registration_definition.xml");;
>     form.showForm("registration-display-pipeline");
>
>     var viewData = { "username" : form.getChild("name").getValue() }*
> form.saveXML("cocoon://resource/internal/binding.xml");*
>
>     cocoon.sendPage("registration-success-pipeline", viewData);
> }
>
>
> There is a simple XML binding example in the samples.  If youve checked
> out Cocoon 2.2 it's in
> blocks/cocoon-forms/cocoon-forms-sample/src/main/resources/COB-INF. Have a
> look at the form2simpleXML. The flowscript function is in
> flow/binding_example.js.
>
>
> Regards,
>
>
> Jasha Joachimsthal
>
> j.joachimsthal@onehippo.com - jasha@apache.org
>
> www.onehippo.com
> Amsterdam - Hippo B.V. Oosteinde 11 1017 WT Amsterdam +31(0)20-5224466
> San Francisco - Hippo USA Inc. 101 H Street, suite Q Petaluma CA 94952-3329
> +1 (707) 773-4646
>

RE: XMLbinding using Cform in cocoon 2.2?

Posted by Jasha Joachimsthal <j....@onehippo.com>.
Hi Job,


________________________________

	From: Job van Ommen [mailto:jobvanommen@gmail.com] 
	Sent: maandag 29 september 2008 13:39
	To: users@cocoon.apache.org
	Subject: how: XMLbinding using Cform in cocoon 2.2?
	
	
	Ok, so I am new to the whole cform thing. It seems like a good
way to implement forms...BUT
	
	I can't get it to work. I've gone through the 2.2 and 2.1
documentation but I can't get it to work.
	
	Let's keep it simple and use the sample:
	
	The sample from
http://cocoon.apache.org/2.2/blocks/forms/1.0/478_1_1.html doesn't use
binding.
	What If i wanted to add binding and save the results to a file?
	
	I've noticed the "simplebinding" and found the following
flowscript on the web somewhere, but It doesn't work...
	
	Please, somebody tell me how it should be done?
	
	-what should be in the sitemap?
	-what should be in the binding xml?
	-should the template or the definition als contain something
that points to the binding.xml ?
	
	
cocoon.load("servlet:forms:/resource/internal/flow/javascript/Form.js");
	
	function registration() {
	
form.createBinding("cocoon://resource/internal/registration_binding.xml"
);
	    var form = new
Form("cocoon://resource/internal/registration_definition.xml");;
	    form.showForm("registration-display-pipeline");
	
	    var viewData = { "username" :
form.getChild("name").getValue() }
	form.saveXML("cocoon://resource/internal/binding.xml");
	
	    cocoon.sendPage("registration-success-pipeline", viewData);
	}
	 

There is a simple XML binding example in the samples.  If youve checked
out Cocoon 2.2 it's in
blocks/cocoon-forms/cocoon-forms-sample/src/main/resources/COB-INF. Have
a look at the form2simpleXML. The flowscript function is in
flow/binding_example.js.
 
 
Regards,
 

Jasha Joachimsthal 
 
j.joachimsthal@onehippo.com - jasha@apache.org
 
www.onehippo.com <http://www.onehippo.com/> 
Amsterdam - Hippo B.V. Oosteinde 11 1017 WT Amsterdam +31(0)20-5224466 
San Francisco - Hippo USA Inc. 101 H Street, suite Q Petaluma CA
94952-3329 +1 (707) 773-4646