You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@cocoon.apache.org by Markus Heussen <he...@rheinland-online.com> on 2004/01/15 15:48:45 UTC

[Woody/CForms] Multipage forms with woody and one XML source to bind

Hi all!

I need to construct a form with multiple pages using the woody form and
binding framework. The first page asks for user data, the second page for
contract data and so on. I have to bind one XML source to that form. How can
I do this?

When the user fills in all the part specific data correctly (for example the
users data section) the data have to hold and the next form part have to be
processed. After all pages and validations done the model have to be bind
back to the source XML document.

At this time I load the source once and bind it to one big form definition.
The parts I publish doing several showForm() function calls with differnet
templates. But like this I cannot do it. The performance is much too bad.

Can anybody give me a hint how I do it in a better way?

Thanks, Markus


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


AW: AW: [Woody/CForms] Multipage forms with woody and one XML source to bind

Posted by Markus Heussen <he...@rheinland-online.com>.

> -----Ursprungliche Nachricht-----
> Von: Tony Collen
> Gesendet: Freitag, 16. Januar 2004 04:43
> An: users@cocoon.apache.org
> Betreff: Re: AW: [Woody/CForms] Multipage forms with woody and one XML
> source to bind
>
>
> Markus Heussen wrote:
>
> > Meanwhile I have found a solution but I don't know if it is the
> elegant way
> > ;-) Maybe you can have a look at it and do a comment? I have
> one source but
> > two or more form defintion files and two or more binding files.
> Also two or
> > more templates.
> >
> >
> > First of all the following call initializes the form part1:
> >
> >
> >
> cocoon.sendPage("form.init?function=contractConclusionForm1&form-d
> efinition=
> > test1&documentURI=test&bindingURI=test1);
> >
> >
> > That calls the following sitemap matcher:
> >
> >
> > <map:match pattern="form.init">
> > 	<map:call function="woody">
> > 		<map:parameter name="function"
> value="{request-param:function}"/>
> > 		<map:parameter name="form-definition"
> >
> value="cocoon:/forms/descriptors/{request-param:form-definition}.d
> escriptor.
> > xml"/>
> > 		<map:parameter name="documentURI"
> > value="cocoon:/forms/sources/{request-param:documentURI}.source.xml"/>
> > 		<map:parameter name="bindingURI"
> > value="cocoon:/forms/bindings/{request-param:bindingURI}.binding.xml"/>
> > 	</map:call>
> > </map:match>
> >
> >
> > Then the function "contractConclusionForm1" is called:
> >
> >
> > function contractConclusionForm1(form) {
> > ...
> > 	doc = flowHelper.loadDocument(documentURI); // globale
> > 	form.load(doc); // bind the document data (first part data
> to first form)
> > 	form.showForm("portal.base?template=test1", // show with
> first template
> > 		{
> > ...
> > 		}
> > 	);
> > 	form.save(doc); // bind the form's data back to the document
> >
> >
> cocoon.sendPage("form.init?function=contractConclusionForm2&form-d
> efinition=
> > test2&documentURI=test&bindingURI=test2);
> > }
> >
> >
> > Then the function "contractConclusionForm2" is called:
> >
> >
> > function contractConclusionForm2(form) {
> > 	form.load(doc); // bind the document data (second part data
> to second form)
> > 	form.showForm("portal.base?template=test2", // show with
> second template
> > 		{
> > ...
> > 		}
> > 	);
> > 	form.save(doc); // bind the form's data back to the document
> > 	flowHelper.saveDocument(doc,"test2.xml");
> >
> > 	cocoon.sendPage("portal.base",
> > 			{
> > ...
> > 			}
> > 	);
> > }
> >
> >
> > Is this stupid?
> >
> > Markus
>
> Well, I don't think putting the function name in the request parameter
> is all that great of an idea (just think if the wrong function gets
> called that happens to do something you really don't want), but I'm not
> all that sure how else it could be done...
>
> Regards,
> Tony
>

Hi Tony,

my sample above is just a code snippet. From my flowscript I call an XSP
page and give it a javascript object. Using jx transformer I create an
<cinclude:src/> using the cocoon protocol that includes the form sources
from an internal pipeline using request parameters to control the form. So I
have everything under control. The request parameters never appear at the
gui.

Greetings, Markus :-)

>
> ---------------------------------------------------------------------
> 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


Re: AW: [Woody/CForms] Multipage forms with woody and one XML source to bind

Posted by Tony Collen <co...@umn.edu>.
Markus Heussen wrote:

> Meanwhile I have found a solution but I don't know if it is the elegant way
> ;-) Maybe you can have a look at it and do a comment? I have one source but
> two or more form defintion files and two or more binding files. Also two or
> more templates.
> 
> 
> First of all the following call initializes the form part1:
> 
> 
> cocoon.sendPage("form.init?function=contractConclusionForm1&form-definition=
> test1&documentURI=test&bindingURI=test1);
> 
> 
> That calls the following sitemap matcher:
> 
> 
> <map:match pattern="form.init">
> 	<map:call function="woody">
> 		<map:parameter name="function" value="{request-param:function}"/>
> 		<map:parameter name="form-definition"
> value="cocoon:/forms/descriptors/{request-param:form-definition}.descriptor.
> xml"/>
> 		<map:parameter name="documentURI"
> value="cocoon:/forms/sources/{request-param:documentURI}.source.xml"/>
> 		<map:parameter name="bindingURI"
> value="cocoon:/forms/bindings/{request-param:bindingURI}.binding.xml"/>
> 	</map:call>
> </map:match>
> 
> 
> Then the function "contractConclusionForm1" is called:
> 
> 
> function contractConclusionForm1(form) {
> ...
> 	doc = flowHelper.loadDocument(documentURI); // globale
> 	form.load(doc); // bind the document data (first part data to first form)
> 	form.showForm("portal.base?template=test1", // show with first template
> 		{
> ...
> 		}
> 	);
> 	form.save(doc); // bind the form's data back to the document
> 
> cocoon.sendPage("form.init?function=contractConclusionForm2&form-definition=
> test2&documentURI=test&bindingURI=test2);
> }
> 
> 
> Then the function "contractConclusionForm2" is called:
> 
> 
> function contractConclusionForm2(form) {
> 	form.load(doc); // bind the document data (second part data to second form)
> 	form.showForm("portal.base?template=test2", // show with second template
> 		{
> ...
> 		}
> 	);
> 	form.save(doc); // bind the form's data back to the document
> 	flowHelper.saveDocument(doc,"test2.xml");
> 
> 	cocoon.sendPage("portal.base",
> 			{
> ...
> 			}
> 	);
> }
> 
> 
> Is this stupid?
> 
> Markus

Well, I don't think putting the function name in the request parameter 
is all that great of an idea (just think if the wrong function gets 
called that happens to do something you really don't want), but I'm not 
all that sure how else it could be done...

Regards,
Tony


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


AW: [Woody/CForms] Multipage forms with woody and one XML source to bind

Posted by Markus Heussen <he...@rheinland-online.com>.
Meanwhile I have found a solution but I don't know if it is the elegant way
;-) Maybe you can have a look at it and do a comment? I have one source but
two or more form defintion files and two or more binding files. Also two or
more templates.


First of all the following call initializes the form part1:


cocoon.sendPage("form.init?function=contractConclusionForm1&form-definition=
test1&documentURI=test&bindingURI=test1);


That calls the following sitemap matcher:


<map:match pattern="form.init">
	<map:call function="woody">
		<map:parameter name="function" value="{request-param:function}"/>
		<map:parameter name="form-definition"
value="cocoon:/forms/descriptors/{request-param:form-definition}.descriptor.
xml"/>
		<map:parameter name="documentURI"
value="cocoon:/forms/sources/{request-param:documentURI}.source.xml"/>
		<map:parameter name="bindingURI"
value="cocoon:/forms/bindings/{request-param:bindingURI}.binding.xml"/>
	</map:call>
</map:match>


Then the function "contractConclusionForm1" is called:


function contractConclusionForm1(form) {
...
	doc = flowHelper.loadDocument(documentURI); // globale
	form.load(doc); // bind the document data (first part data to first form)
	form.showForm("portal.base?template=test1", // show with first template
		{
...
		}
	);
	form.save(doc); // bind the form's data back to the document

cocoon.sendPage("form.init?function=contractConclusionForm2&form-definition=
test2&documentURI=test&bindingURI=test2);
}


Then the function "contractConclusionForm2" is called:


function contractConclusionForm2(form) {
	form.load(doc); // bind the document data (second part data to second form)
	form.showForm("portal.base?template=test2", // show with second template
		{
...
		}
	);
	form.save(doc); // bind the form's data back to the document
	flowHelper.saveDocument(doc,"test2.xml");

	cocoon.sendPage("portal.base",
			{
...
			}
	);
}


Is this stupid?

Markus



> -----Ursprungliche Nachricht-----
> Von: Marc Portier
> Gesendet: Donnerstag, 15. Januar 2004 16:38
> An: users@cocoon.apache.org
> Betreff: Re: [Woody/CForms] Multipage forms with woody and one XML
> source to bind
>
>
>
>
> Markus Heussen wrote:
>
> > Hi all!
> >
> > I need to construct a form with multiple pages using the woody form and
> > binding framework. The first page asks for user data, the
> second page for
> > contract data and so on. I have to bind one XML source to that
> form. How can
> > I do this?
>
> proposal:
> - have multiple forms and matching multiple bindings,
> - add the bindings to the matching forms,
> - remember them in your flow as you step through them, and
> - (most likely only ) at the end of the use-case 'save' them all to the
> same XML source.
>
> On a side-note: the theme of multi-form flow keeps on recurring, however
> there hasn't been an decission yet.  Honestly I think it doesn't make
> sense to add this into the declarative form-definitions, we have flow to
> express the infinitly complex relations between all these forms in a far
> more elegant way.  (you know the kind of: don't show form six if form 3
> had some flag checked, of course this only unless form 5 was skipped or
> the end user is wearing green socks...)
>
> >
> > When the user fills in all the part specific data correctly
> (for example the
> > users data section) the data have to hold and the next form
> part have to be
> > processed. After all pages and validations done the model have
> to be bind
> > back to the source XML document.
> >
> > At this time I load the source once and bind it to one big form
> definition.
> > The parts I publish doing several showForm() function calls
> with differnet
> > templates. But like this I cannot do it. The performance is
> much too bad.
> >
>
> hm, to me it's even surprising that it works at all, I was still under
> the impression that the widgets that were not submitted back were set to
> null
>
>
> > Can anybody give me a hint how I do it in a better way?
> >
>
> HTH
> -marc=
>
> > Thanks, Markus
> >
> >
> > ---------------------------------------------------------------------
> > To unsubscribe, e-mail: users-unsubscribe@cocoon.apache.org
> > For additional commands, e-mail: users-help@cocoon.apache.org
> >
>
> --
> Marc Portier                            http://outerthought.org/
> Outerthought - Open Source, Java & XML Competence Support Center
> Read my weblog at                http://blogs.cocoondev.org/mpo/
> mpo@outerthought.org                              mpo@apache.org
>
>
> ---------------------------------------------------------------------
> 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


Re: [Woody/CForms] Multipage forms with woody and one XML source to bind

Posted by Marc Portier <mp...@outerthought.org>.

Markus Heussen wrote:

> Hi all!
> 
> I need to construct a form with multiple pages using the woody form and
> binding framework. The first page asks for user data, the second page for
> contract data and so on. I have to bind one XML source to that form. How can
> I do this?

proposal:
- have multiple forms and matching multiple bindings,
- add the bindings to the matching forms,
- remember them in your flow as you step through them, and
- (most likely only ) at the end of the use-case 'save' them all to the 
same XML source.

On a side-note: the theme of multi-form flow keeps on recurring, however 
there hasn't been an decission yet.  Honestly I think it doesn't make 
sense to add this into the declarative form-definitions, we have flow to 
express the infinitly complex relations between all these forms in a far 
more elegant way.  (you know the kind of: don't show form six if form 3 
had some flag checked, of course this only unless form 5 was skipped or 
the end user is wearing green socks...)

> 
> When the user fills in all the part specific data correctly (for example the
> users data section) the data have to hold and the next form part have to be
> processed. After all pages and validations done the model have to be bind
> back to the source XML document.
> 
> At this time I load the source once and bind it to one big form definition.
> The parts I publish doing several showForm() function calls with differnet
> templates. But like this I cannot do it. The performance is much too bad.
> 

hm, to me it's even surprising that it works at all, I was still under 
the impression that the widgets that were not submitted back were set to 
null


> Can anybody give me a hint how I do it in a better way?
> 

HTH
-marc=

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

-- 
Marc Portier                            http://outerthought.org/
Outerthought - Open Source, Java & XML Competence Support Center
Read my weblog at                http://blogs.cocoondev.org/mpo/
mpo@outerthought.org                              mpo@apache.org


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