You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@cocoon.apache.org by footh <fo...@yahoo.com> on 2005/09/16 21:36:03 UTC

[CForms] building dynamic selection list with javaflow

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.

I looked at the methods of form.getChild("name") but
didn't find any that seemed like it would work.

Thanks,

JF


		
__________________________________ 
Yahoo! Mail - PC Magazine Editors' Choice 2005 
http://mail.yahoo.com

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


Re: [CForms] building dynamic selection list with javaflow

Posted by footh <fo...@yahoo.com>.
Thanks, that did the trick.

--- Jason Johnston <co...@lojjic.net> wrote:

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


__________________________________________________
Do You Yahoo!?
Tired of spam?  Yahoo! Mail has the best spam protection around 
http://mail.yahoo.com 

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


Re: [CForms] building dynamic selection list with javaflow

Posted by Jason Johnston <co...@lojjic.net>.
> 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