Repeat section control values as dropdown values

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

Repeat section control values as dropdown values

mbojja
Hi guys - I'm new to Xforms and Orbeon. 

Is there a way to dynamically set the values of a dropdown outside of repeat section/grid to the values of a control in repeat grid/section.

Sample orbeon code below. Need all employee names entered in repeat grid as values in the dropdown.

<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:map="http://www.w3.org/2005/xpath-functions/map"
         xmlns:array="http://www.w3.org/2005/xpath-functions/array"
         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"
         fr:data-format-version="4.0.0">
    <xh:head>
        <xh:title>Test001</xh:title>
        <xf:model id="fr-form-model" xxf:expose-xpath-types="true" xxf:analysis.calculate="true">

            
            <xf:instance id="fr-form-instance" xxf:exclude-result-prefixes="#all" xxf:index="id">
                <form>
                    <section-1>
                        <grid-2>
                            <grid-2-iteration>
                                <control-1/>
                                <control-2/>
                                <control-3/>
                            </grid-2-iteration>
                        </grid-2>
                    </section-1>
                    <section-2>
                        <control-4/>
                    </section-2>
                </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-1-bind" ref="control-1" name="control-1" xxf:whitespace="trim"/>
                            <xf:bind id="control-2-bind" ref="control-2" name="control-2" xxf:whitespace="trim"/>
                            <xf:bind id="control-3-bind" ref="control-3" name="control-3" xxf:whitespace="trim"/>
                        </xf:bind>
                    </xf:bind>
                </xf:bind>
                <xf:bind id="section-2-bind" ref="section-2" name="section-2">
                    <xf:bind id="control-4-bind" ref="control-4" name="control-4"/>
                </xf:bind>
            </xf:bind>

            
            <xf:instance id="fr-form-metadata" xxf:readonly="true" xxf:exclude-result-prefixes="#all">
                <metadata>
                    <application-name>repeat</application-name>
                    <form-name>rest-api</form-name>
                    <title xml:lang="en">Test001</title>
                    <description xml:lang="en"/>
                    <created-with-version>2018.2.3.201905172253 PE</created-with-version>
                    <updated-with-version>2018.2.3.201905172253 PE</updated-with-version>
                </metadata>
            </xf:instance>

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

            
            <xf:instance xxf:readonly="true" id="fr-form-resources" xxf:exclude-result-prefixes="#all">
                <resources>
                    <resource xml:lang="en">
                        <control-4>
                            <label>Employee name dropdown</label>
                            <hint/>
                        </control-4>
                        <control-1>
                            <label>employee id</label>
                            <hint/>
                        </control-1>
                        <control-2>
                            <label>employee name</label>
                            <hint/>
                        </control-2>
                        <control-3>
                            <label>employee salary</label>
                            <hint/>
                        </control-3>
                        <section-1>
                            <label>employee details</label>
                        </section-1>
                        <section-2>
                            <label>Dropdown</label>
                            <help/>
                        </section-2>
                        
                    </resource>
                </resources>
            </xf:instance>
            <xf:instance xxf:readonly="true" xxf:exclude-result-prefixes="#all" id="grid-2-template">
                <grid-2-iteration>
                    <control-1/>
                    <control-2/>
                    <control-3/>
                </grid-2-iteration>
            </xf:instance>

        </xf:model>
    </xh:head>
    <xh:body>
        <fr:view>
            <fr:body xmlns:xbl="http://www.w3.org/ns/xbl" xmlns:p="http://www.orbeon.com/oxf/pipeline"
                     xmlns:oxf="http://www.orbeon.com/oxf/processors">
                <fr:section id="section-1-section" bind="section-1-bind">
                    <xf:label ref="$form-resources/section-1/label"/>
                    <fr:grid id="grid-2-grid" bind="grid-2-bind" repeat="content" min="1"
                             template="instance('grid-2-template')"
                             apply-defaults="true"
                             fb:initial-iterations="first">
                        <fr:c x="1" y="1" w="2">
                            <xf:input id="control-1-control" bind="control-1-bind">
                                <xf:label ref="$form-resources/control-1/label"/>
                                <xf:hint ref="$form-resources/control-1/hint"/>
                        
                                <xf:alert ref="$fr-resources/detail/labels/alert"/>
                            </xf:input>
                        </fr:c>
                        <fr:c x="3" y="1" w="5">
                            <xf:input id="control-2-control" bind="control-2-bind">
                                <xf:label ref="$form-resources/control-2/label"/>
                                <xf:hint ref="$form-resources/control-2/hint"/>
                        
                                <xf:alert ref="$fr-resources/detail/labels/alert"/>
                            </xf:input>
                        </fr:c>
                        <fr:c x="8" y="1" w="5" h="1">
                            <xf:input id="control-3-control" bind="control-3-bind">
                                <xf:label ref="$form-resources/control-3/label"/>
                                <xf:hint ref="$form-resources/control-3/hint"/>
                        
                                <xf:alert ref="$fr-resources/detail/labels/alert"/>
                            </xf:input>
                        </fr:c>
                    </fr:grid>
                </fr:section>
                <fr:section id="section-2-section" bind="section-2-bind">
                    <xf:label ref="$form-resources/section-2/label"/>
                    <fr:grid id="grid-1-grid">
                        <fr:c x="1" y="1" w="6">
                            <fr:dropdown-select1 xmlns:xxbl="http://orbeon.org/oxf/xml/xbl" 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:itemset ref="$form-resources/control-4/item">
                                    <xf:label ref="label"/>
                                    <xf:value ref="value"/>
                                </xf:itemset>
                            </fr:dropdown-select1>
                        </fr:c>
                        <fr:c x="7" y="1" w="6"/>
                    </fr:grid>
                </fr:section>
            </fr:body>
        </fr:view>
    </xh:body>
</xh:html>

--
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 view this discussion on the web visit https://groups.google.com/d/msgid/orbeon/58c5d57f-1599-412a-ad19-f35daf5e0205%40googlegroups.com.
Reply | Threaded
Open this post in threaded view
|

Re: Repeat section control values as dropdown values

Alessandro  Vernet
Administrator
Hi Bojja,

I am afraid you currently can't have the list of choices in a dropdown
populated based on values the user enters in a repeated grid. This is not
unlike `<fr:synchronize-repeated-content>`, but, still, different. However,
what you're trying to do makes sense, and I've create a Request for
Enhancement for this.

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

‑Alex

-----
--
Follow Orbeon on Twitter: @orbeon
Follow me on Twitter: @avernet
--
Sent from: http://discuss.orbeon.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 view this discussion on the web visit https://groups.google.com/d/msgid/orbeon/1568411878430-0.post%40n4.nabble.com.
--
Follow Orbeon on Twitter: @orbeon
Follow me on Twitter: @avernet