On 18.Mar.2003 -- 03:15 PM, Richard In Public wrote:
> Hi Chris
> 
> Firstly, thanks for your response.  I have been mulling over this and
> revisiting the docs, but I have not managed to get things working.
> 
> I suspect that my problem lies in chanelling the request parameters passed
> by the form into the database action.
> Specifically, I cannot figure out what:
> 
> > I've not tested it, but in theory you could set the path separator for
> > the action to "/" and use the xmlform input module. Drawback is, you
> > need to pass the module name and form id for every value OR create
> > different instances of the xmlform module for each and every form
> > id.
> 
> would look like in practice.  Do you have any samples?

No, I haven't tested this.

First, you need to have a separate instance for the xmlform module in
cocoon.xconf

    <component-instance 
       name="xmlform-42"      
       logger="core.modules.input" 
       class="org.apache.cocoon.components.modules.input.XMLFormInput"/>
       <xmlform-id>42</xmlform-id>
    </component-instance>


To change the path separator, add
     <path-separator>/</path-separator>
to the action's config. This will change "table.column[row]" to
"table/column[row]". You might need to add
     <append-row>false</append-row>
as well to make it "table/row". In addition, switch the default input
to this new module:
     <input>xmlform-42</input>

In sitemap.xmap:

  <map:components>
    <map:actions>
       <map:action name="mod-db-add-42" 
src="org.apache.cocoon.acting.modular.DatabaseAddAction">
          <descriptor>database.xml</descriptor>
          <throw-exception>false</throw-exception>
          <path-separator>/</path-separator>
          <append-row>false</append-row>
          <input>xmlform-42</input>
       </map:action>
    </map:actions>
  </map:components>

and

         <map:act type="mod-db-add-42">
            <map:parameter name="table-set" value="foo"/>
         </map:act>


Now, given a suitable database.xml which basically needs to list the
tables and columns, the above *should* be able to store values from an
XMLForm with id "42" to the database.

If this turns out to be useful, we could try to find a way to get the
xmlform-id to the xmlform module at run-time. It's a bit tricky,
though, so it hasn't been done, yet.

This is untested functionality and may or may not work. In any case
I'd be happy to hear about the outcome or even fixes.

        Chris.
-- 
C h r i s t i a n       H a u l
[EMAIL PROTECTED]
    fingerprint: 99B0 1D9D 7919 644A 4837  7D73 FEF9 6856 335A 9E08

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

Reply via email to