cocoon-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Derek Hohls" <>
Subject Re: Selection-List CocoonForms
Date Thu, 02 Jun 2005 12:48:05 GMT

Not sure exactly what your question is... if I phrase it as
"how can I easily get data for my CForm selection list 
from a database without using a bean" then the answer is:

1. setup a field in your form template/definition

    <fd:field id="special">
      <fd:datatype base="string"/>
      <fd:selection-list  src="cocoon:/form-sql/theme.xml" dynamic="true"/> 

2. in your sitemap have a match for the above call:

   <!-- === data for form from database list === -->
   <map:match pattern="form-sql/theme.xml">
     <map:generate src="docs/basic-sql.xml"/>  <!-- step 3 below -->
     <!-- === SQL Connector ==== -->       
     <map:transform type="sql">
       <map:parameter name="use-connection" value="connection_name"/>
       <map:parameter name="show-nr-of-rows" value="true"/> 
       <map:parameter name="clob-encoding" value="UTF-8"/> 
     <map:transform src="stylesheets/widget-theme.xsl"/>  <!-- step 4 below -->
     <map:serialize type="xml"/>

3. a XML page containing the SQL for the generator step: 

<?xml version="1.0" encoding="UTF-8"?>
  <sq2:execute-query xmlns:sq2=""> 
    <!-- SQL statement or stored procedure -->
    <sq2:query name="themes">
      SELECT ID,Name FROM MyTableName  

4. a stylesheet to transform the XML from the database into a list; 
below is an example:

<?xml version="1.0"  encoding="UTF-8"?>
<!-- root -->
<xsl:template match="/">

<!-- list -->
<xsl:template match="fd:selection-list">
  <xsl:apply-templates select="sq2:rowset"/>

<!-- rowset -->
<xsl:template match="sq2:rowset">
  <xsl:apply-templates select="sq2:row"/>

<!-- row -->
<xsl:template match="sq2:row">
  <fd:item value="{sq2:id}"><fd:label><xsl:value-of select="sq2:name"/></fd:label></fd:item>



>>> 2005/06/02 02:15:07 PM >>>
Is there no other possibility for dynamic selection lists than
-flow-jxpath implementation
-enum implementation

I want to load the data for my selection list from database and like the 
JSF idea with backing beans load my bean into my form.
So the selection list should be able to read the collection of items, 
display them and I must save the selection in my bean to save the data 
to database.

Thx for any idea.


To unsubscribe, e-mail: 
For additional commands, e-mail: 

To unsubscribe, e-mail:
For additional commands, e-mail:

View raw message