You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@cocoon.apache.org by Bruce Perryman <bp...@yahoo.com> on 2003/11/04 20:11:19 UTC

How to update one table while mod-db add to another in same request?

I have a form from which I can perform several options
each having it's own submit button that passes the
value of the option selected to a sitemap pattern like
the one below.

The behavior that I want from option 3 is to update a
flag in one database table and also perform a modular
db add to another table. Since my cocoon actions are
different (update and mod-db add), I used an xsl for
the table update and an action for the mod-db add. The
db update in the xsl file is not performed but the
mod-db add is performed as desired. In order for the
db update to be performed, I had to remove the
redirects and serialize the output to xml or html. The
xsl file does a simple update table where key field =
"value".

What prohibits the update in the xsl file in
combination with the mod-db add and redirects as
coded? Is there a better way to do this? Can the
desired behavior be achieved without writing my own
action? 

In my sitemap is the following:

<map:match pattern="perf_sev_opts">
   <map:generate type="request"/>

      <map:select type="request-parameter">
        <map:parameter name="parameter-name"
value="opt"/>

          <map:when test="opt1">
            <map:redirect-to uri="option1"/>
          </map:when>      

          <map:when test="opt2">
           <map:redirect-to uri="option2"/>
          </map:when>      

          <map:otherwise>

           <map:transform src="do_updateflag.xsl">
             <map:parameter
name="use-request-parameters" value="true"/>
           </map:transform>
           <map:transform type="sql">
             <map:parameter name="use-connection"
value="DBNAME"/>
          </map:transform>

          <map:act set="moddbinsert">
            <map:parameter name="descriptor"
value="descriptor.xml"/>
          </map:act>
          <map:transform type="sql">
            <map:parameter name="use-connection"
value="DBNAME"/>
          </map:transform>

          <map:select type="request-parameter">
            <map:parameter name="parameter-name"
value="redirectflag"/>

            <map:when test="opt3">
              <map:redirect-to
uri="select_option_to_perform"/>
            </map:test>

            <map:otherwise>
              <map:redirect-to uri="home"/>
            </map:otherwise>

          </map:select>

        </map:otherwise>

      </map:select>

     </map:match>


__________________________________
Do you Yahoo!?
Protect your identity with Yahoo! Mail AddressGuard
http://antispam.yahoo.com/whatsnewfree

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