submission resource with the param in uri

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

submission resource with the param in uri

Chunyu_uk
Hello,

I have the following submission from 'xf:send' with a property.
It is not working with {event('versioning')} in the param of url.
Could someone help and where is wrong please?

<xf:submission id="persist-project-sda" method="put" instance="fr-form-instance" replace="instance" serialization="application/xml" validate="true" relevant="false" resource="/fr/service/persistence/crud/erdf/project-sda/data/{xxf:instance('fr-parameters-instance')/document/test/data.xml/test?apply-transformation=true&amp;versioning={event('versioning')}"> 

<xf:send submission="persist-project-sda">
                       <xf:property name="versioning" value="'false'"/>
                      </xf:send>

Thanks,
Chunyu
Reply | Threaded
Open this post in threaded view
|

Re: submission resource with the param in uri

Alessandro  Vernet
Administrator
Hi Chunyu,

This should work; in fact the databound select1 component does something very similar (search for xf:send in the code):

https://github.com/orbeon/orbeon-forms/blob/master/src/resources-packaged/xbl/orbeon/databound-select1/databound-select1.xbl

So I'm not sure why it wouldn't be working in your case. If you can't figure it out, could create a simple example reproducing the problem that we can run here?

Alex
--
Follow Orbeon on Twitter: @orbeon
Follow me on Twitter: @avernet
Reply | Threaded
Open this post in threaded view
|

Re: submission resource with the param in uri

Chunyu_uk
Hi Alex,

The event('name') only works in the url itself, but not in the param.
Please see the form below and see whether you can reproduce it.
We are using orbeon-4.10.2.marklogic.201605162217-CE.war.
Thanks,
Chunyu

<xh:html xmlns:xh="http://www.w3.org/1999/xhtml" xmlns:xf="http://www.w3.org/2002/xforms"
         xmlns:xs="http://www.w3.org/2001/XMLSchema"
         xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
         xmlns:ev="http://www.w3.org/2001/xml-events"
         xmlns:xi="http://www.w3.org/2001/XInclude"
         xmlns:xxi="http://orbeon.org/oxf/xml/xinclude"
         xmlns:xxf="http://orbeon.org/oxf/xml/xforms"
         xmlns:exf="http://www.exforms.org/exf/1-0"
         xmlns:fr="http://orbeon.org/oxf/xml/form-runner"
         xmlns:saxon="http://saxon.sf.net/"
         xmlns:sql="http://orbeon.org/oxf/xml/sql"
         xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/"
         xmlns:fb="http://orbeon.org/oxf/xml/form-builder">
    <xh:head>
        <xh:title>submission</xh:title>
        <xf:model id="fr-form-model" xxf:expose-xpath-types="true">

           
            <xf:instance id="fr-form-instance" xxf:exclude-result-prefixes="#all">
                <form>
                    <section-1>
                        <test-submission/>
                        <submit-param/>
                    </section-1>
                </form>
            </xf:instance>

           
            <xf:bind id="fr-form-binds" ref="instance('fr-form-instance')">
                <xf:bind id="section-1-bind" name="section-1" ref="section-1">
                    <xf:bind id="test-submission-bind" name="test-submission" ref="test-submission"/>
                    <xf:bind id="submit-param-bind" ref="submit-param" name="submit-param"/>
                </xf:bind>
            </xf:bind>
           
            <xf:submission id="persist-project-sda" method="put" instance="fr-form-instance"
                           replace="instance"
                           serialization="application/xml"
                           validate="true"
                           relevant="false"
                           resource="/fr/service/persistence/crud/erdf/project-sda/data/{xxf:instance('fr-parameters-instance')/document/test/data.xml/test?apply-transformation=true&amp;versioning={event('versioning')}">
                <xf:header combine="replace">
                    <xf:name>Accept</xf:name>
                    <xf:value>application/xml</xf:value>
                </xf:header>
                <xf:header>
                    <xf:name>Orbeon-Form-Definition-Version</xf:name>
                    <xf:value value="xxf:instance('fr-parameters-instance')/form-version"/>
                </xf:header>
                <xf:action ev:event="xforms-submit-error">
         
                    <xf:message level="modal">
                        <xf:output value="concat(event('resource-uri'),'8888',event('versioning'))"/>
                    </xf:message>
       
                </xf:action>
       
            </xf:submission>
     

           
            <xf:instance xxf:readonly="true" id="fr-form-metadata" xxf:exclude-result-prefixes="#all">
                <metadata>
                    <application-name>erdf</application-name>
                    <form-name>test-submission</form-name>
                    <title xml:lang="en">submission</title>
                    <description xml:lang="en"/>
                    <singleton>false</singleton>
                </metadata>
            </xf:instance>

           
            <xf:instance id="fr-form-attachments" xxf:exclude-result-prefixes="#all">
                <attachments>
                    <css mediatype="text/css" filename="" size=""/>
                    <pdf mediatype="application/pdf" filename="" size=""/>
                </attachments>
            </xf:instance>

           
           
            <xf:instance id="fr-form-resources" xxf:readonly="false" xxf:exclude-result-prefixes="#all">
                <resources>
                    <resource xml:lang="en">
                        <section-1>
                            <label>submission</label>
                        </section-1>
                        <test-submission>
                            <label>test</label>
                            <hint/>
                           
                        </test-submission>
                        <submit-param>
                            <label>test submit with porperty</label>
                            <hint/>
                        </submit-param>
                    </resource>
                </resources>
            </xf:instance>

           
            <xf:instance id="fr-service-request-instance" xxf:exclude-result-prefixes="#all">
                <request/>
            </xf:instance>

            <xf:instance id="fr-service-response-instance" xxf:exclude-result-prefixes="#all">
                <response/>
            </xf:instance>

        </xf:model>
    </xh:head>
    <xh:body>
        <fr:view>
            <fr:body xmlns:oxf="http://www.orbeon.com/oxf/processors"
                     xmlns:p="http://www.orbeon.com/oxf/pipeline"
                     xmlns:xbl="http://www.w3.org/ns/xbl">
                <fr:section id="section-1-control" bind="section-1-bind">
                    <xf:label ref="$form-resources/section-1/label"/>
                    <fr:grid>
                        <xh:tr>
                            <xh:td>
                                <xf:input id="test-submission-control" bind="test-submission-bind">
                                    <xf:label ref="$form-resources/test-submission/label"/>
                                    <xf:hint ref="$form-resources/test-submission/hint"/>
                                    <xf:alert ref="$fr-resources/detail/labels/alert"/>
                                   
                                </xf:input>
                            </xh:td>
                            <xh:td/>
                        </xh:tr>
                    </fr:grid>
                    <fr:grid>
                        <xh:tr>
                            <xh:td>
                                <xf:trigger id="submit-param-control" bind="submit-param-bind">
                                    <xf:label ref="$form-resources/submit-param/label"/>
                   
                                    <xf:hint ref="$form-resources/submit-param/hint"/>
                                    <xf:alert ref="$fr-resources/detail/labels/alert"/>
                                    <xf:action ev:event="DOMActivate">
                                        <xf:send submission="persist-project-sda">
                                            <xf:property name="versioning" value="'false'"/>
                                        </xf:send>
                                    </xf:action>
                   
                                </xf:trigger>
                            </xh:td>
                        </xh:tr>
                    </fr:grid>
                </fr:section>
            </fr:body>
        </fr:view>
    </xh:body>
</xh:html>
Reply | Threaded
Open this post in threaded view
|

Re: submission resource with the param in uri

Alessandro  Vernet
Administrator
Hi Chunyu,

Got it, I've reproduced a similar issue, and we're looking into it.

Alex
--
Follow Orbeon on Twitter: @orbeon
Follow me on Twitter: @avernet
Reply | Threaded
Open this post in threaded view
|

Re: submission resource with the param in uri

Alessandro  Vernet
Administrator
Hi Chunyu,

A couple of things:

1. In your source, in the value of the "resource" attribute, you're missing a closing curly bracket. The one that opens before "{xxf:instance…" isn't closed. I suspect that this is what is causing the issue you're seeing.

/fr/service/persistence/crud/erdf/project-sda/data/{xxf:instance('fr-parameters-instance')/document/test/data.xml/test?apply-transformation=true&versioning={event('versioning')}

2. It is highly unusual to do a replace="instance" with a PUT. Does your PUT return an XML document, and do you expect that document to replace the current document in the form? In general this isn't the case, and you should have replace="none".

Alex
--
Follow Orbeon on Twitter: @orbeon
Follow me on Twitter: @avernet
Reply | Threaded
Open this post in threaded view
|

Re: submission resource with the param in uri

Chunyu_uk
Hi Alex,

Thanks for the investigation.

1. You are right. I did miss the close '}' and sorry about the that. It works after I added it.
2. About 'PUT', if the form is 'edit' mode from the saved version earlier, we shall replace the previous one, right?
We PUT the same instance (fr-from-instance) for our case always.
I am thinking replace='none' is applied for the case that the different 'instance' is PUT in the database. We dont overwrite the main instance.
Please correct me if I am wrong.

Thanks,
Chunyu

On 27 May 2016 at 23:54, Alessandro Vernet [via Orbeon Forms community mailing list] <[hidden email]> wrote:
Hi Chunyu,

A couple of things:

1. In your source, in the value of the "resource" attribute, you're missing a closing curly bracket. The one that opens before "{xxf:instance…" isn't closed. I suspect that this is what is causing the issue you're seeing.

/fr/service/persistence/crud/erdf/project-sda/data/{xxf:instance('fr-parameters-instance')/document/test/data.xml/test?apply-transformation=true&versioning={event('versioning')}

2. It is highly unusual to do a replace="instance" with a PUT. Does your PUT return an XML document, and do you expect that document to replace the current document in the form? In general this isn't the case, and you should have replace="none".

Alex
--
Follow Orbeon on Twitter: @orbeon
Follow me on Twitter: @avernet



If you reply to this email, your message will be added to the discussion below:
http://discuss.orbeon.com/submission-resource-with-the-param-in-uri-tp4661546p4661558.html
To unsubscribe from submission resource with the param in uri, click here.
NAML

Reply | Threaded
Open this post in threaded view
|

Re: submission resource with the param in uri

Alessandro  Vernet
Administrator
Hi Chunyu,

1. I am glad that solved the problem.
2. I am not sure to follow you: is your PUT service returning the same XML document it received? If not, that could cause some problem in Form Runner, couldn't it. If the same, then you don't need to send it back.

Alex
--
Follow Orbeon on Twitter: @orbeon
Follow me on Twitter: @avernet
Reply | Threaded
Open this post in threaded view
|

Re: submission resource with the param in uri

Chunyu_uk
HI Alex,

OK, I got it from the point 2.

Thanks,
Chunyu

On 31 May 2016 at 16:20, Alessandro Vernet [via Orbeon Forms community mailing list] <[hidden email]> wrote:
Hi Chunyu,

1. I am glad that solved the problem.
2. I am not sure to follow you: is your PUT service returning the same XML document it received? If not, that could cause some problem in Form Runner, couldn't it. If the same, then you don't need to send it back.

Alex
--
Follow Orbeon on Twitter: @orbeon
Follow me on Twitter: @avernet



If you reply to this email, your message will be added to the discussion below:
http://discuss.orbeon.com/submission-resource-with-the-param-in-uri-tp4661546p4661565.html
To unsubscribe from submission resource with the param in uri, click here.
NAML