I also had a cut-paste-error:
My initial database.xml had the table name preprended to all field names:
<value name="category.id" type="int"/>
<value name="category.default" type="string"/>
Sorry for the thrash. Steve
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: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
_________________________________________________________________
Fretting that your Hotmail account may expire because you forgot to sign in enough? Get Hotmail Extra Storage today! http://join.msn.com/?PAGE=features/es
--------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
