cocoon-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Jason Johnston" <coc...@lojjic.net>
Subject Re: [CForms] building dynamic selection list with javaflow
Date Fri, 16 Sep 2005 20:42:42 GMT
> I've read the doc about how to create dynamic
> selection list data in formscript a la this:
>
> var data = new Object();
>
> data.cityList = new Array(2);
> data.cityList[0] = {value:"AL", label:"Alabama"};
> data.cityList[1] = {value:"AK", label:"Alaska"};
>
> form.showForm("flow/myform.form", data);
>
> ...and I'm wondering if there's a nice way to do it in
> Javaflow such that I don't have to create an object
> with a bunch of named members (ex. cityList) ie. one
> for each selection list.

If you're using JavaFlow then it might be more appropriate/easy to use a
JavaSelectionList.  The docs on it are pretty light, but take a look at
http://cocoon.apache.org/2.1/apidocs/org/apache/cocoon/forms/datatype/AbstractJavaSelectionList.html

Basically you create a class that extends AbstractJavaSelectionList and
implement the build() method to build the selection list options using
addItem(value, label).  Then instantiate your class, set it as the field's
selection list, and there you go.

Hope that helps.
--Jason



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


Mime
View raw message