Upload xml instance: In section templates values of standard xform fields are not updated

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

Upload xml instance: In section templates values of standard xform fields are not updated

mabu
Hi,

I implemented an upload/download feature based on the description in http://wiki.orbeon.com/forms/how-to/view/upload-and-download-instance. Therefore, I created a custom button/process and defined a global upload/download dialog which shows up on button click.
In general, all works fine. But if I use a section template in my form, following problem occurs:
After uploading a local XML file, the values of standard xform fields (e.g. xf:input) inside the section template were not updated on the UI. The values of Orbeon components (e.g. <fr:dropdown-select1>) were updated correct. If I enable the introspector, I can see that the instance data has been written correct to the model. Is there a bug in event dispatching?

Martin
Reply | Threaded
Open this post in threaded view
|

Re: Upload xml instance: In section templates values of standard xform fields are not updated

Alessandro  Vernet
Administrator
Hi Martin,

Indeed, it sounds like this could be something related to event dispatching. If after uploading a local XML you save the form, and reload the page, do the values show up OK in the xf:input? Can you share with us the xf:insert you use to replace the instance? I imagine that it is along the lines of what was mentioned in the how-to guide you pointed to?

<xforms:insert ev:event="xforms-submit-done" nodeset="instance('main-instance')"
               origin="saxon:parse(saxon:base64Binary-to-string(xs:base64Binary(instance('upload')), 'UTF-8'))"/>

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

Re: Upload xml instance: In section templates values of standard xform fields are not updated

mabu
Hi Alex,

Yes, the values show up OK if I save the form and then reload the page.
The code for my upload/download dialog is as follows:

<xxf:dialog xmlns:xs="http://www.w3.org/2001/XMLSchema"
        xmlns:ev="http://www.w3.org/2001/xml-events"
        xmlns:xh="http://www.w3.org/1999/xhtml"
        xmlns:xxf="http://orbeon.org/oxf/xml/xforms"
        xmlns:xf="http://www.w3.org/2002/xforms"
        xmlns:fr="http://orbeon.org/oxf/xml/form-runner"
        id="upload-download-dialog" model="upload-download-model" level="modal">

        <xf:model id="upload-download-model">
                <xf:instance id="download">
                        <serialized mediatype="application/xml" />
                </xf:instance>
                <xf:instance id="upload">
                        <serialized mediatype="application/xml" filename="" />
                </xf:instance>
                <xf:bind ref="instance('download')" type="xs:base64Binary" />
                <xf:bind ref="instance('upload')" type="xs:base64Binary" />

                <xf:submission id="upload-submission" ref="instance('upload')"
                        validate="false" relevant="false" method="post" replace="none"
                        resource="echo:">

                        <xf:insert ev:event="xforms-submit-done"
                                ref="xxf:instance('fr-form-instance')"
                                origin="saxon:parse(saxon:base64Binary-to-string(xs:base64Binary(instance('upload')), 'UTF-8'))" />
                </xf:submission>
        </xf:model>

        <xf:setvalue ev:event="xxforms-dialog-open" ref="instance('download')"
                value="saxon:string-to-base64Binary(saxon:serialize(xxf:instance('fr-form-instance'), 'xml'), 'UTF-8')" />

        <xf:setvalue ev:event="xxforms-dialog-close" ref="instance('upload')" />

        <xf:label>Daten laden/zwischenspeichern</xf:label>

        <fr:tabview>
                <fr:tab>
                        <fr:label>Daten laden</fr:label>
                        <xf:upload ref="instance('upload')">
                                <xf:filename ref="@filename" />
                                <xf:mediatype ref="@mediatype" />
                                <xf:send ev:event="xxforms-upload-done"
                                        submission="upload-submission" />
                        </xf:upload>
                </fr:tab>
                <fr:tab>
                        <fr:label>Daten zwischenspeichern</fr:label>
                        <xf:output ref="instance('download')" appearance="xxf:download">
                                <xf:label>
                                        <xh:i class="icon-download" />Daten lokal speichern</xf:label>
                                <xf:mediatype ref="@mediatype" />
                                <xf:filename ref="$title" />
                        </xf:output>
                </fr:tab>
        </fr:tabview>
</xxf:dialog>

I also tried to trigger a <xf:recalculate model="fr-form-model"> after the xf:insert without success.

Martin
Reply | Threaded
Open this post in threaded view
|

Re: Upload xml instance: In section templates values of standard xform fields are not updated

mabu
In reply to this post by Alessandro Vernet
Can you reproduce my problem?
Reply | Threaded
Open this post in threaded view
|

Re: Upload xml instance: In section templates values of standard xform fields are not updated

Alessandro  Vernet
Administrator
Hi Martin,

I tried, but was unable to reproduce the problem. Here is the form with your dialog: form.xml. I paste that source in Form Builder, save, publish, open the new page, and attach this data: data.xml, and the value gets properly set in the input field:



Does this source work for you? If it does, maybe you can find what is different in your case.

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

AW: [orbeon] Re: Upload xml instance: In section templates values of standard xform fields are not updated

mabu
Yes, your example works! As I mentioned in my initial post the problem occurs only if the input field is in a section template. In your example you don't use a section template.
Additionally you can add a <fr:dropdown-select1> to your form. Then you can see that the value of the dropdown field is properly updated also inside a section template. The problem occurs only on standard xforms fields (e.g. <xf:input>) used inside a section template.
Can you please give it a try with a section template!

Thanks,
Martin

-----Ursprüngliche Nachricht-----
Von: [hidden email] [mailto:[hidden email]] Im Auftrag von Alessandro Vernet
Gesendet: Freitag, 24. Oktober 2014 02:57
An: [hidden email]
Betreff: [orbeon] Re: Upload xml instance: In section templates values of standard xform fields are not updated

Hi Martin,

I tried, but was unable to reproduce the problem. Here is the form with your
dialog:  form.xml <http://discuss.orbeon.com/file/n4659167/form.xml>  . I
paste that source in Form Builder, save, publish, open the new page, and
attach this data:  data.xml
<http://discuss.orbeon.com/file/n4659167/data.xml>  , and the value gets
properly set in the input field:

<http://discuss.orbeon.com/file/n4659167/value-updated.png>

Does this source work for you? If it does, maybe you can find what is
different in your case.

Alex

-----
--
Follow Orbeon on Twitter: @orbeon
Follow me on Twitter: @avernet
--
View this message in context: http://discuss.orbeon.com/Upload-xml-instance-In-section-templates-values-of-standard-xform-fields-are-not-updated-tp4659105p4659167.html
Sent from the Orbeon Forms community mailing list mailing list archive at Nabble.com.

--
You received this message because you are subscribed to the Google Groups "Orbeon Forms" group.
To unsubscribe from this group and stop receiving emails from it, send an email to [hidden email].
To post to this group, send email to [hidden email].

--
You received this message because you are subscribed to the Google Groups "Orbeon Forms" group.
To unsubscribe from this group and stop receiving emails from it, send an email to [hidden email].
To post to this group, send email to [hidden email].
Reply | Threaded
Open this post in threaded view
|

Re: AW: [orbeon] Re: Upload xml instance: In section templates values of standard xform fields are not updated

Alessandro  Vernet
Administrator
Hi Martin,

Ah, yes, I misread your earlier message. And indeed, I'm able to reproduce this with a section template. Here the form source: form.xml, and the data to upload: data.xml. I will create an issue, and we'll look into it.

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

Re: AW: [orbeon] Re: Upload xml instance: In section templates values of standard xform fields are not updated

Alessandro  Vernet
Administrator
And for reference, the issue is:

https://github.com/orbeon/orbeon-forms/issues/1965

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