cocoon-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Bruno Dumon <br...@outerthought.org>
Subject Re: [CForm] No Cocoon Form found????
Date Sat, 31 Jul 2004 11:13:20 GMT
On Fri, 2004-07-30 at 21:39, Christina wrote:
> I got this error :
> org.apache.cocoon.ProcessingException: Failed to execute pipeline.:
> org.apache.cocoon.ProcessingException: Failed to execute pipeline.:
> org.xml.sax.SAXException: No Cocoon Form found.
>  
> from the follow flow: 
>    var form=new Form(cocoon.parameters["form-definition"]);
>    var display=cocoon.parameters["display-page"];
>         ......................
>    cocoon.request.setAttribute("form1", form.getWidget());   
>    cocoon.sendPage(display);
>  
>  it works fine if I change cocoon.sendPage(display) to
> form.showForm(display)
> But I don't get what is wrong with the cocoon.sendPage()? I set the
> form attribute!

And why did you call the attribute "form1" ?

The error you get is because the FormsTransformer couldn't find your
form. 

How the FormsTransformer searches the form is explained on this page:
http://cocoon.apache.org/2.1/userdocs/forms/templatetransformer.html

To keep it short, I think you're best of doing it like this:

cocoon.sendPage(display, {"CocoonFormsInstance": form});

You don't need to set the request attribute.

>  
> btw, would anybody be kind enough to explain what is difference
> between cocoon.sendPage and form.showForm?
> It seems sendPage is better to use as the last page of a flow because
> it helps to clean up the used resource, right? then what if showForm?

The difference is very huge.

The form.showForm function shows the form in a loop until it validates
correctly. It uses continuations, so that the form instance is also
stored server side. This is not required in general but it is required
for certain features, such as value changed events.

The sendPage function doesn't create a continuation, and simply executes
a pipeline. Using it as the last page of a flow doesn't clean up any
resources (continuations), but on the other hand doesn't allocate any
new neither. It is perfectly possible to use CForms combined with
sendPage (thus without storing the form instance server side), though
there are no examples included of this. The action sample works
stateless, so that can serve as an example.

If you have a simple form with a simple flow that is executed very
frequently, then it makes sense to avoid continuations to save
resources. Otherwise, I think you're best of using showForm.

-- 
Bruno Dumon                             http://outerthought.org/
Outerthought - Open Source, Java & XML Competence Support Center
bruno@outerthought.org                          bruno@apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@cocoon.apache.org
For additional commands, e-mail: users-help@cocoon.apache.org


Mime
View raw message