How to trigger the external validation code when pressing the send button

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

How to trigger the external validation code when pressing the send button

javaudvikling
HI,

Can anyone tell me how to bind the submission code below to the Send button on a published form?
E.g. when I press the Send button it should trigger the submission code..

 
            <xf:submission id="validation-submission" ref="instance('user-info')"
                    resource="http://localhost:62203/api/Values/"
                    method="post" replace="instance" instance="validation-result">
               
                <xf:delete ev:event="xforms-submit" ref="//@v:*"/>
                <xf:action ev:event="xforms-submit-done">
                   
                    <xf:insert ref="." origin="instance('validation-result')/v:data/*"/>
                   
                    <xf:setvalue iterate="//@v:alert" ref="." value="concat(., ' (save again to revalidate)')"/>
                   
                    <xf:dispatch name="fr-visit-all" targetid="error-summary-incremental"/>
                    <xf:dispatch name="fr-visit-all" targetid="error-summary"/>
                   
                    <xf:refresh/>
                    <xf:dispatch name="fr-update" targetid="error-summary"/>
                </xf:action>
            </xf:submission>
Reply | Threaded
Open this post in threaded view
|

Re: How to trigger the external validation code when pressing the send button

Erik Bruchez
Administrator
With 4.4 we have a good way to do this:

- You can create your own button and process (https://github.com/orbeon/orbeon-forms/wiki/Form-Runner:-Buttons-and-Processes)
- In that process you can use `xf:send` to send the submission
- You can add your own custom model logic (https://github.com/orbeon/orbeon-forms/wiki/Form-Runner:-Custom-Model-Logic) with that submission

With earlier versions it's harder.

-Erik