cocoon-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Steve Schwarz" <saschw...@hotmail.com>
Subject ModularDb OutputModule Mapping Confusion
Date Thu, 16 Oct 2003 15:58:21 GMT
Hi
I'm using ModularDb to check if an entry already exists in the database and 
I'm having trouble mapping the form fields to the mod db key/values. I'm 
using simpleform validation together with the modular db also.

My simplified input form (there are actually a couple on the page - so I 
prefix the input fields):
<form name="category" method="post" action="category-add">
<input type="text" cols="32" name="category.name"/>
<input type="hidden" name="category.id"/>
<input type="hidden" name="category.default"/>
<input type="submit" value="Add Category" name="add-category"/>
</form>

My first approach in the database.xml file:
<!-- used for select checking that name doesn't already exist -->
    <table name="category" alias="category-exists">
        <keys>
            <key name="category.name" type="string" autoincrement="false"/>
        </keys>
        <values>
            <value name="id" type="int"/>
            <value name="default" type="string"/>
        </values>
    </table>

This generates this SQL (if the user supplies 'YY' for the category.name 
field):
SELECT category.id, category.default FROM category WHERE category.name= 'YY'

Unfortunately HSQLDB doesn't like this syntax...so I'd like to generate:
SELECT id, default FROM category WHERE name= 'YY'

After studying the sample and the online docs:
<!-- used for select checking that name doesn't already exist -->
    <table name="category" alias="category-exists">
        <keys>
            <key name="name" type="string" autoincrement="false">
          <mode name="request-attr" type="all">
                    <parameter>
                    
org.apache.cocoon.components.modules.output.OutputModule:category.name[0]</parameter>
                </mode>
            </key>
        </keys>
        <values>
            <value name="id" type="int">
              <mode name="request-attr" type="all">
                    <parameter>
                    
org.apache.cocoon.components.modules.output.OutputModule:category.id[0]</parameter>
                </mode>
            </value>
            <value name="default" type="string">
               <mode name="request-attr" type="all">
                    <parameter>
                    
org.apache.cocoon.components.modules.output.OutputModule:category.default[0]</parameter>
                </mode>
            </value>
        </values>
    </table>

But then null is assigned to the name field.
Can someone "give me the clue" as to how to map the fields correctly?
Thanks,
Steve

_________________________________________________________________
Enjoy MSN 8 patented spam control and more with MSN 8 Dial-up Internet 
Service.  Try it FREE for one month!   http://join.msn.com/?page=dept/dialup


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


Mime
View raw message