From a old application, written many years ago:

In Flow:

var form = new Form("resource/internal/forms/feedback-definition.xml");
form.createBinding("resource/internal/forms/feedback-binding.xml");
var feedback = new Feedback(); // Holds data for the form, could be obtained from a database.
form.load(feedback);
form.showForm("feedback-display");
form.save(feedback);
do-something-with-feedback(feedback);  // e.g. prepare some response.


In sitemap.xmap:

<map:match pattern="*-display" internal-only="true">
  <map:generate type="jx" src="resource/internal/forms/{1}-template.xml" /
  ...
</map:match>

I have the feedback-definition.xml located in the given folder relative to the folder containing sitemap.xmpa. There is no separate map:match to this file. The statement above form = new Form(...) finds the file.





On 03/14/2012 09:41 PM, Mika M Lehtonen wrote:
getting closer!
No pipeline matched request: registration2.mika

14.3.2012 21:35, Robby Pelssers kirjoitti:

Try

var form = new Form("cocoon://registration.mika");

Cheers,

Robby

*From:*Mika M Lehtonen [mailto:m...@digikartta.net]
*Sent:* Wednesday, March 14, 2012 8:33 PM
*To:* users@cocoon.apache.org
*Subject:* Re: pipeline in flowscript

Hi Robby,
"..create form definitions on the fly.."
That is my ultimate goal.

"Any reason why you don't switch to C2.2 or C3?"
Any reason why not continue using C2.1?
This is something I newer understood. Why did the C2.1 were almost
abandoned. As far as I know, it is like 99% ready piece of software
with little childhood diseases. I understand how much clever these new
versions can be, especially in front of the expert eyes. But how much
is left from the original idea? And anyway, the learning curve or the
opportunity costs are little too high to switch into entirely
different framework, albeit it would have the same name. And C3 is all
the way too alfa for production usage.

But if I find Cocoon to be the right framework for our needs, I will
do the switching at some stage. But how long does it take before C3 is
in stable state..

Back to my question, what am I doing wrong?
var form = new Form("registration.mika"); doesn't work
var form = new Form("forms/registration2.xml"); does work

....

<map:match pattern="registration.mika">
<map:generate src="forms/registration2.xml"/>
<map:serialize/>
</map:match>

- mika -



14.3.2012 20:39, Robby Pelssers kirjoitti:

Hi Mika,

I can reassure you that this is possible. Most use cases have a static form 
definition and you can bind data from your database to the widgets declared in 
this form definition.    Hack, you can even use repeaters to get some dynamic 
behavior or even create form definitions on the fly but those are more exotic 
use cases.

Just one question though.    You only recently started to experiment with 
C2.11.    Any reason why you don't switch to C2.2 or C3?

Back to your question:
 From flowscript you can access your Java components responsible for retrieving 
data from the database. Next you can use the Cocoon forms api to dynamically 
populate your widgets with values. This also works vice versa where on a form 
submit you intercept the widget values and save them back.

Robby

-----Original Message-----
From: Mika M Lehtonen [mailto:m...@digikartta.net]
Sent: Wednesday, March 14, 2012 6:32 PM
To:users@cocoon.apache.org  <mailto:users@cocoon.apache.org>
Subject: pipeline in flowscript

Hi list,
I started to experiment with the Cocoon 2.11 after a long while. I did
some adjustment on the registration example.

I added this to the samples/blocks/forms/ sitemap:
<map:match pattern="registration.mika">
<map:generate src="forms/registration2.xml"/>
<map:serialize/>
</map:match>
and this modification to the registration.js
var form = new Form("registration.mika");

This is not working. Obviously this is trying to fetch a file with that
name.
java.io.FileNotFoundException:
/home/tomcat/webapps/cocoon/samples/blocks/forms/registration.mika (No
such file or directory)

How can I make this work with the pipelines?

I am trying to create forms based on data in database, anyway that is
the ultimate goal. I found some examples how to use pipelines in flow
script, but I haven't been able to get them work.


cheers,
- mika -


---------------------------------------------------------------------
To unsubscribe, e-mail:users-unsubscr...@cocoon.apache.org  
<mailto:users-unsubscr...@cocoon.apache.org>
For additional commands, e-mail:users-h...@cocoon.apache.org  
<mailto:users-h...@cocoon.apache.org>


---------------------------------------------------------------------
To unsubscribe, e-mail:users-unsubscr...@cocoon.apache.org  
<mailto:users-unsubscr...@cocoon.apache.org>
For additional commands, e-mail:users-h...@cocoon.apache.org  
<mailto:users-h...@cocoon.apache.org>





--
Andre H. Juffer              | Phone: +358-8-553 1161
Biocenter Oulu and           | Fax: +358-8-553-1141
Department of Biochemistry   | Email: andre.juf...@oulu.fi
University of Oulu, Finland  | WWW: www.biochem.oulu.fi/Biocomputing/
StruBioCat                   | WWW: www.strubiocat.oulu.fi
Triacle Biocomputing         | WWW: www.triacle-bc.com

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

Reply via email to