You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@cocoon.apache.org by Joern Wallstabe <jo...@rostock.igd.fhg.de> on 2003/11/05 18:39:08 UTC

woody: fill selection-list with result of database query ?

Hi,

I'm using cocoon 2.1.3 dev and would like to fill a selection-list in a woody form dynamically
using the result of a database query.

How can I fill the selection-list from flowscript?
.. using FlowJXPathSelectionList ?

 
Does anybody have an idea?

Thanks,

jörn

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


Re: woody: fill selection-list with result of database query ?

Posted by Antonio Gallardo <ag...@agsoftware.dnsalias.com>.
Joern Wallstabe dijo:
> Hi,
>
> I'm using cocoon 2.1.3 dev and would like to fill a selection-list in a
> woody form dynamically using the result of a database query.
>
> How can I fill the selection-list from flowscript?
> .. using FlowJXPathSelectionList ?

> Does anybody have an idea?

I am using OJB and JXTemplate generator.

Best Regards,

Antonio Gallardo




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


Re: woody: fill selection-list with result of database query ?

Posted by Joern Wallstabe <jo...@rostock.igd.fhg.de>.
On Thu, 06 Nov 2003 09:08:43 +0100
Ugo Cei <u....@cbim.it> wrote:

> Joern Wallstabe wrote:
> > The countryselector example shows how to change a selection list inside an event handler.
> 
> Indeed, I should've pointed this out in my reply, but I was in a hurry.
> 
> > Is this the only way e.g is there a <wd:load> to fill the list inside an event handler.
> > Can it be done without an event handler in flow like:
> > ...
> > var states = [
> >     { key: "AL", value: "Alabama" },
> >     { key: "AK", value: "Alaska" },
> >     { key: "WY", value: "Wyoming" }
> > ];
> > 
> > mylist=form.getWidget("list");
> > mylist.setSelectionList(states, "key", "value");
> 
> You could do it that way, but there's a better way. See the javadoc for 
> the org.apache.cocoon.woody.datatype.FlowJXPathSelectionListBuilder class.
> 
> In short, put this in your form definition:
> 
> 	<wd:selection-list type="flow-jxpath"
> 	  list-path="states" value-path="key" label-path="value"/>
> 
> and show the form using:
> 
> 	form.showForm(uri, { "states" : states });
> 
> Hope this helps,
> 
> 		Ugo
> 

Thanks a lot. Works perfectly :-)

joern


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


Re: woody: fill selection-list with result of database query ?

Posted by Ugo Cei <u....@cbim.it>.
Joern Wallstabe wrote:
> The countryselector example shows how to change a selection list inside an event handler.

Indeed, I should've pointed this out in my reply, but I was in a hurry.

> Is this the only way e.g is there a <wd:load> to fill the list inside an event handler.
> Can it be done without an event handler in flow like:
> ...
> var states = [
>     { key: "AL", value: "Alabama" },
>     { key: "AK", value: "Alaska" },
>     { key: "WY", value: "Wyoming" }
> ];
> 
> mylist=form.getWidget("list");
> mylist.setSelectionList(states, "key", "value");

You could do it that way, but there's a better way. See the javadoc for 
the org.apache.cocoon.woody.datatype.FlowJXPathSelectionListBuilder class.

In short, put this in your form definition:

	<wd:selection-list type="flow-jxpath"
	  list-path="states" value-path="key" label-path="value"/>

and show the form using:

	form.showForm(uri, { "states" : states });

Hope this helps,

		Ugo

-- 
Ugo Cei - Consorzio di Bioingegneria e Informatica Medica
P.le Volontari del Sangue, 2 - 27100 Pavia - Italy
Phone: +39.0382.525100 - E-mail: u.cei@cbim.it


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


Re: woody: fill selection-list with result of database query ?

Posted by Joern Wallstabe <jo...@rostock.igd.fhg.de>.
On Wed, 05 Nov 2003 22:53:23 +0100
Ugo Cei <u....@cbim.it> wrote:

> Sylvain Wallez wrote:
> > Joern Wallstabe wrote:
> >> I'm using cocoon 2.1.3 dev and would like to fill a selection-list in 
> >> a woody form dynamically
> >> using the result of a database query.
> >>
> >> How can I fill the selection-list from flowscript?
> >> .. using FlowJXPathSelectionList ?
> > The simplest way is to write a pipeline that does the database 
> > extraction e.g. with ESQL and use <wd:selection-list 
> > src="cocoon://esql-pipeline.xml" dynamic="true"/>
> > 
> > Sylvain
> 
> Sylvain, are you repudiating your own creation? ;-)
> 
> Joern, FlowJXPathSelection list is perfect for what you are trying to 
> accomplish. I bugged Sylvain to create it because I needed it for the 
> same reason. Please see the countryselector example in the latest CVS 
> version and don't hesitate to ask me if you need more help.
> 
> 	Ugo
> 
> 

Hi,

thanks for replying so quickly.

The countryselector example shows how to change a selection list inside an event handler.
Is this the only way e.g is there a <wd:load> to fill the list inside an event handler.

Can it be done without an event handler in flow like:
...
var states = [
    { key: "AL", value: "Alabama" },
    { key: "AK", value: "Alaska" },
    { key: "WY", value: "Wyoming" }
];

mylist=form.getWidget("list");
mylist.setSelectionList(states, "key", "value");

Thanks, joern

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


Re: woody: fill selection-list with result of database query ?

Posted by Ugo Cei <u....@cbim.it>.
Sylvain Wallez wrote:
> Joern Wallstabe wrote:
>> I'm using cocoon 2.1.3 dev and would like to fill a selection-list in 
>> a woody form dynamically
>> using the result of a database query.
>>
>> How can I fill the selection-list from flowscript?
>> .. using FlowJXPathSelectionList ?
> The simplest way is to write a pipeline that does the database 
> extraction e.g. with ESQL and use <wd:selection-list 
> src="cocoon://esql-pipeline.xml" dynamic="true"/>
> 
> Sylvain

Sylvain, are you repudiating your own creation? ;-)

Joern, FlowJXPathSelection list is perfect for what you are trying to 
accomplish. I bugged Sylvain to create it because I needed it for the 
same reason. Please see the countryselector example in the latest CVS 
version and don't hesitate to ask me if you need more help.

	Ugo



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


Re: woody: fill selection-list with result of database query ?

Posted by Sylvain Wallez <sy...@apache.org>.
Joern Wallstabe wrote:

>Hi,
>
>I'm using cocoon 2.1.3 dev and would like to fill a selection-list in a woody form dynamically
>using the result of a database query.
>
>How can I fill the selection-list from flowscript?
>.. using FlowJXPathSelectionList ?
>
> 
>Does anybody have an idea?
>  
>

The simplest way is to write a pipeline that does the database 
extraction e.g. with ESQL and use <wd:selection-list 
src="cocoon://esql-pipeline.xml" dynamic="true"/>

Sylvain

-- 
Sylvain Wallez                                  Anyware Technologies
http://www.apache.org/~sylvain           http://www.anyware-tech.com
{ XML, Java, Cocoon, OpenSource }*{ Training, Consulting, Projects }
Orixo, the opensource XML business alliance  -  http://www.orixo.com



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