Repeat Grid - Iteration node is not generated

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

Repeat Grid - Iteration node is not generated

Karthi
Hi,

Repeater-Grid is not generating the XML data with '-iteration' root element.
This happens when I submit the form to an external service.

The form is created from form builder.

Form builder source:
  <xh:html xmlns:xh="http://www.w3.org/1999/xhtml"
         xmlns:xxi="http://orbeon.org/oxf/xml/xinclude"
         xmlns:ev="http://www.w3.org/2001/xml-events"
         xmlns:xi="http://www.w3.org/2001/XInclude"
         xmlns:saxon="http://saxon.sf.net/"
         xmlns:xs="http://www.w3.org/2001/XMLSchema"
         xmlns:fb="http://orbeon.org/oxf/xml/form-builder"
         xmlns:xxf="http://orbeon.org/oxf/xml/xforms"
         xmlns:sql="http://orbeon.org/oxf/xml/sql"
         xmlns:fr="http://orbeon.org/oxf/xml/form-runner"
         xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/"
         xmlns:xf="http://www.w3.org/2002/xforms"
         xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
         xmlns:exf="http://www.exforms.org/exf/1-0">
    <xh:head>
        <xh:title>Untitled Form</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>
                        <grid-2>
                            <grid-2-iteration>
                                <control-4/>
                            </grid-2-iteration>
                        </grid-2>
                    </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="grid-2-bind" ref="grid-2" name="grid-2">
                        <xf:bind id="grid-2-iteration-bind" ref="grid-2-iteration" name="grid-2-iteration">
                            <xf:bind id="control-4-bind" ref="control-4" name="control-4"/>
                        </xf:bind>
                    </xf:bind>
                </xf:bind>
            </xf:bind>

           
            <xf:instance xxf:readonly="true" id="fr-form-metadata" xxf:exclude-result-prefixes="#all">
                <metadata>
                    <application-name>Bolero</application-name>
                    <form-name>repeat</form-name>
                    <title xml:lang="en">Untitled Form</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">
                        <control-4>
                            <label>Repeat me</label>
                            <hint/>
                        </control-4>
                        <section-1>
                            <label>Untitled Section</label>
                        </section-1>
                    </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:instance xxf:readonly="true" id="grid-2-template">
                <grid-2-iteration>
                    <control-4/>
                </grid-2-iteration>
            </xf:instance>
        </xf:model>
    </xh:head>
    <xh:body>
        <fr:view>
            <fr:body xmlns:xbl="http://www.w3.org/ns/xbl"
                     xmlns:oxf="http://www.orbeon.com/oxf/processors"
                     xmlns:p="http://www.orbeon.com/oxf/pipeline">
                <fr:section id="section-1-control" bind="section-1-bind">
                    <xf:label ref="$form-resources/section-1/label"/>
                    <fr:grid>
                        <xh:tr>
                            <xh:td/>
                        </xh:tr>
                    </fr:grid>
                    <fr:grid id="grid-2-grid" bind="grid-2-bind" repeat="content" min="1"
                             template="instance('grid-2-template')">
                        <xh:tr>
                            <xh:td>
                                <xf:input id="control-4-control" bind="control-4-bind">
                                    <xf:label ref="$form-resources/control-4/label"/>
                                    <xf:hint ref="$form-resources/control-4/hint"/>
                                    <xf:alert ref="$fr-resources/detail/labels/alert"/>
                                </xf:input>
                            </xh:td>
                        </xh:tr>
                    </fr:grid>
                </fr:section>
            </fr:body>
        </fr:view>
    </xh:body>
</xh:html>

When saving the repeat content the XML generated looks like below.

                        <grid-2>
                             <control-4>test</control-4>
                            </grid-2>
                           <grid-2>
                               <control-4>test-2</control-4>
                            </grid-2>
instead of,
                          <grid-2>
                            <grid-2-iteration>
                                <control-4>test</control-4>
                            </grid-2-iteration>
                           <grid-2-iteration>
                                <control-4>test-2</control-4>
                            </grid-2-iteration>
                        </grid-2>

This is causing problem when I try to pre-populate the form in edit mode.

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

Re: Repeat Grid - Iteration node is not generated

Alessandro  Vernet
Administrator
Hi Karthi,

So you're saying that you would like to have those iteration elements present when you're sending the data to service, correct? If you're doing this with send() in a workflow, you can set data-format-version = "edge", and the iteration parameter will be present. You'll let us know if this works for you.

https://github.com/orbeon/orbeon-forms/wiki/Form-Runner-~-Buttons-and-Processes#send

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

Re: Repeat Grid - Iteration node is not generated

Karthi
Hi Alessandro,

Thanks. It works. but now, some of elements (i found that its all hidden when working with the form runner) are excluded from the sent XML.

Though functionally hidden elements are not required, we need few node be available always.
PS: This was working fine as expected before 'data-format-version' is set to 'edge'.

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

Re: Repeat Grid - Iteration node is not generated

Alessandro  Vernet
Administrator
Hi Karthi,

Could you try adding the attributes prune="false", in case you don't have it already? (Note that the default value is true, and for more on this see the section linked below.)

https://github.com/orbeon/orbeon-forms/wiki/Form-Runner-~-Buttons-and-Processes#send

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

Re: Repeat Grid - Iteration node is not generated

Karthi
Hi Alessandro ,
Thanks Much !!!
That worked.. I don't know how did I miss that parameter from your last answer .. thanks again.
Reply | Threaded
Open this post in threaded view
|

Re: Repeat Grid - Iteration node is not generated

Alessandro  Vernet
Administrator
Hi Karthi,

Excellent! I'm glad adding that parameter solved the problem, and thank you for the update.
--
Follow Orbeon on Twitter: @orbeon
Follow me on Twitter: @avernet