Calling a processor before sending form data

classic Classic list List threaded Threaded
3 messages Options
Reply | Threaded
Open this post in threaded view
|

Calling a processor before sending form data

ciprianster
Hi,
I am a beginer with Orbeon forms and I have a specific requirement that I couldn't implement so far. The requirement is that when the user presses the Send button, the form data is first saved into our database (in our business tables), the inserts are validated and after that, if no error occures, the form is saved.

Here is what I've done so far:
1. I built an SQL Processor that I saved into orbeon\WEB-INF\resources\forms\Test\MyProcessor.xpl.
2. I verified that my processor is working by calling it directly from my form with an action triggered by a button

<xf:action ev:event="DOMActivate" if="true()" ev:observer="but-insert-sql-processor-control">
        <xf:insert ref="instance('my-processor-response-instance')"
                           origin="xxf:call-xpl('oxf:/forms/Test/MyProcessor.xpl', 'instance' ,instance('fr-form-instance'), 'data' )"/>
</xf:action>


3. I added a custom button using properties in properties.local.xml file:

        <property   as="xs:string"   name="oxf.fr.detail.buttons.Test.*"
                        value="save-draft pdf button-sql"/>
        <property
                  as="xs:string"
                  name="oxf.fr.resource.Test.*.en.detail.buttons.button-sql"
                  value="&lt;i class='icon-ok-sign'/&gt; Send"/>         
        <property
                  as="xs:string"
                  name="oxf.fr.detail.process.button-sql.Test.*"
                  value='require-valid
                                 then validate
                                 then confirm(message="Are you sure you want to submit your form?")
                                 then suspend
                                 then process("oxf:/forms/Test/MyProcessor.xpl")
                                 then send
                                 then success-message(message = "Your form has been saved!")
                                 recover error-message(message = "There was an error saving the data!")'/>

                                 
My processor isn't called this way. How do I need to call my processor? Is there additional configuration that I need to do?
Is this the good approach for my requirement? Can you point me to an online resource that explains how to do this?

I'm using Orbeon Forms 4.5 PE.

Thank you.
Reply | Threaded
Open this post in threaded view
|

Re: Calling a processor before sending form data

Erik Bruchez
Administrator
The issue is with this line:

    then process("oxf:/forms/Test/MyProcessor.xpl")

The `process` action takes a URL. Try instead something like:

    then send(uri = "/fr/service/custom/Test/MyProcessor")

-Erik
Reply | Threaded
Open this post in threaded view
|

Re: Calling a processor before sending form data

Erik Bruchez
Administrator
What I meant was "The `process` action DOESN'T takes a URL". It takes a process name.

However the `send` action DOES take a URL.

-Erik