Hi Stephan,
One way of doing it is to specify a pipeline on your fd-selection list element's src attribute in the form definition and use an internal pipeline to turn the results of your db query into the fd:selection-list markup. There are certainly other ways, but I like to avoid scripting within cocoon (prefer to use only the XML and Java, minimising cocoon-specific scripting and JavaScript) and I see this as one clean way of doing it.
E.g. In form definition: ... <fd:selection-list src="cocoon:/myListPipeline"/> ...
In Sitemap: ... <map:generator name="aGenerator" src="my.package.GeneratorClass"/> ... <map:pipeline intermal-only="true"> <map:match pattern="myListPipeline"> <map:generate type="aGenerator"> <map:paraneter name="aParm" value="aParmValue"/> ... </map:generate> <map:serialize type="xml"/> </map:match> </map:pipeline>
The output of the pipeline is serialized XML such as <fd:selection-list> <fd:item value="aValue"/> <fd:item value="anotherValue"/> </fd:selection-list>
You need to write your own generator (and any transformers you want) but the cocoon doco is pretty clear on doing that. If you make the generator generic enough you can also re-use it for other lists or queries (e.g. you could pass a basic query as a parameter). There may be some cocoon generators already that may help with this but not sure (check out the generator page).
Scott.
Stephan Coboos wrote:
Hello,
I want to display a selection box in my form. I had seen that CForms support such kind of formfield: selection-list. But all examples only shows handling static values. Is it possible to set the values for the selection box from a database (dynamically) using the form binding? Do you have an example about this? Do I need the repeater for this?
Thank you!
Regards
--------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
--------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]