cocoon-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Ugo Cei <u....@cbim.it>
Subject Re: woody: fill selection-list with result of database query ?
Date Thu, 06 Nov 2003 08:08:43 GMT
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


Mime
View raw message