You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@cocoon.apache.org by "Miller, Andrew (BL)" <An...@health.wa.gov.au> on 2004/10/11 07:19:26 UTC
populating selection list from database
My apologies for what I am sure is an easy question.
I am trying to think of how I should populate a cocoon forms selection
list field from a MySQL query.
I have a form definition and a form template working fine as is and I
can get my sql query to serialise its results in a web browser but now I
would like to use these results to populate one of the selection list
fields in my form as part of the generation process.
One of the samples hints at how to do this but my grasp of cocoon is
still quite weak and some tips would be appreciated.
Thanks in Advanced
Andrew Miller
Re: populating selection list from database
Posted by Scott Yeadon <sc...@anu.edu.au>.
Try this:
http://cocoon.apache.org/2.1/userdocs/transformers/sql-transformer.html
Add the above transformer to an internal pipeline, write a stylesheet
which transforms the results into fd:selection-list markup and then in
your form definition point the "src" attribute to your pipeline (e.g.
cocoon:/myListPipeline).
Alternatively (if you have existing Java APIs/classes above the DB for
example and don't want to talk ot the DB directly) you could write your
own generator/transformer rather than use the sql transformer
Scott.
Miller, Andrew (BL) wrote:
> My apologies for what I am sure is an easy question.
>
> I am trying to think of how I should populate a cocoon forms selection
> list field from a MySQL query.
>
> I have a form definition and a form template working fine as is and I
> can get my sql query to serialise its results in a web browser but now
> I would like to use these results to populate one of the selection
> list fields in my form as part of the generation process.
>
> One of the samples hints at how to do this but my grasp of cocoon is
> still quite weak and some tips would be appreciated.
>
> Thanks in Advanced
>
> Andrew Miller
>
---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@cocoon.apache.org
For additional commands, e-mail: users-help@cocoon.apache.org