Hi there,

I want to figure out how database actions work and therefore i created a
small example where i only want to store a number from a form field into my
database. Although cocoon is connected correctly to my mysql database i
can't make coocon write something into it. Instead it always displays
error.html (look at sitemap). My configuration: Windows XP, Cocoon 2.1m2,
MySQL Ver 11.18 Distrib 3.23.54

the sitemap:

<?xml version="1.0"?>
<map:sitemap xmlns:map="http://apache.org/cocoon/sitemap/1.0";>
<map:components>
  <map:actions>
    <map:action name="add-number"
      src="org.apache.cocoon.acting.DatabaseAddAction"/>
    <map:action name="form"
src="org.apache.cocoon.acting.FormValidatorAction"/>
  </map:actions>
</map:components>

<map:pipelines>
  <map:pipeline>
    <map:match pattern="hello">
      <map:read src="number.html" mimy-type="text/html"/>
    </map:match>
    <map:match pattern="send">
      <map:act type="form" action="add-number">
        <map:parameter name="validate-set" value="add"/>
          <map:parameter name="descriptor" value="context://db/number.xml"/>
          <map:parameter name="form-descriptor" value="context://db/number.xml"/>
          <map:act type="add-number">
            <map:read src="confirm.html" mimy-type="text/html"/>
            <map:serialize/>
          </map:act>
      </map:act>
      <map:read src="error.html" mimy-type="text/html"/>
      <map:serialize/>
    </map:match>
  </map:pipeline>
</map:pipelines>
</map:sitemap>

If i understood it right, confirm.html should be processed if the action was
executed correctly and error.html if the action failed. But confirm.html is
never executed in this case.

I couldn't use an action-set here like in the examples (webapp) because i
always got an error which seems to be an known cocoon bug. The sample webabb
didn't work correctly either.

number.xml:

<root>
  <parameter name="number" type="int"/>

  <constraint-set name="add">
    <validate name="number"/>
  </constraint-set>

  <number>
    <connection>MySQL</connection>
    <table name="test">
      <keys>
        <key param="number" dbcol="number" type="int" mode="manual"/>
      </keys>
      <values>
          <value param="number" dbcol="number" type="int"/>
        </values>
    </table>
  </number>
</root>

number.html:

<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
  <head>
    <title>test</title>
  </head>
  <body>
    <form action="send" method="post">
      <p>
        Number:
        <input name="number" type="int"/>
      </p>
      <input type="submit" value="OK"/>
    </form>
  </body>
</html>

It would be nice if someone could help.

regards,
Garvin


---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to