xf:range初始隐藏时的Orbeon错误

时间:2019-07-11 13:19:27

标签: orbeon

我正在尝试在Orbeon中使用xf:range控件,因为我正在制作的表单需要一个滑块。 如果在呈现表单时可见范围控件,则这是可能的。 如果该范围最初是隐藏的,然后在满足特定条件后变为可见,则该范围之后的所有控件均无法正确呈现。

这是一个已知的错误吗?有没有办法解决这个问题或实施解决方法?

<xh:html xmlns:xh="http://www.w3.org/1999/xhtml"
         xmlns:ev="http://www.w3.org/2001/xml-events"
         xmlns:exf="http://www.exforms.org/exf/1-0"
         xmlns:fb="http://orbeon.org/oxf/xml/form-builder"
         xmlns:fr="http://orbeon.org/oxf/xml/form-runner"
         xmlns:saxon="http://saxon.sf.net/"
         xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/"
         xmlns:sql="http://orbeon.org/oxf/xml/sql"
         xmlns:xf="http://www.w3.org/2002/xforms"
         xmlns:xi="http://www.w3.org/2001/XInclude"
         xmlns:xs="http://www.w3.org/2001/XMLSchema"
         xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
         xmlns:xxf="http://orbeon.org/oxf/xml/xforms"
         xmlns:xxi="http://orbeon.org/oxf/xml/xinclude"
         fr:data-format-version="4.0.0">
    <xh:head>
        <xh:title/>
        <xf:model id="fr-form-model" xxf:expose-xpath-types="true">
        <!-- Main instance -->
        <xf:instance id="fr-form-instance" xxf:exclude-result-prefixes="#all" xxf:index="id">
            <form>
                <section-1>
                    <min>1</min>
                    <max>10</max>
                    <range>0</range>
                    <range-output/>
                    <value/>
                </section-1>
                <section-2>
                    <min2>1</min2>
                    <max2>10</max2>
                    <visible-value2/>
                    <range2>0</range2>
                    <value2/>
                </section-2>
            </form>
        </xf:instance>

        <!-- Bindings -->
        <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="min-bind" name="min" ref="min"/>
                <xf:bind id="range-output-bind" ref="range-output" name="range-output"/>
                <xf:bind id="range-bind" ref="range" name="range" xxf:whitespace="trim"/>
                <xf:bind id="max-bind" ref="max" name="max" xxf:whitespace="trim"/>
                <xf:bind id="value-bind" ref="value" name="value"
                         calculate="round(($max - $min) * $range + $min)"/>
            </xf:bind>
            <xf:bind id="section-2-bind" ref="section-2" name="section-2" relevant="$value &gt; 5">
                <xf:bind id="min2-bind" name="min2" ref="min2"/>
                <xf:bind id="max2-bind" ref="max2" name="max2" xxf:whitespace="trim"/>
                <xf:bind id="range2-bind" ref="range2" name="range2" xxf:whitespace="trim"/>
                <xf:bind id="value2-bind" ref="value2" name="value2"
                         calculate="round(($max2 - $min2) * $range2 + $min2)"/>
                <xf:bind id="visible-value2-bind" ref="visible-value2" name="visible-value2"
                         xxf:whitespace="trim"
                         calculate="round(($max2 - $min2) * $range2 + $min2)"/>
            </xf:bind>
        </xf:bind>

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

        <!-- Attachments -->
        <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>

        <!-- All form resources -->
        <!-- Don't make readonly by default in case a service modifies the resources -->
        <xf:instance id="fr-form-resources" xxf:readonly="false" xxf:exclude-result-prefixes="#all">
            <resources>
                <resource xml:lang="en">
                    <min2>
                        <label>min</label>
                        <hint/>

                    </min2>
                    <max2>
                        <label>max</label>
                        <hint/>
                    </max2>
                    <visible-value2>
                        <label>visible value</label>
                        <hint/>
                    </visible-value2>
                    <range2>
                        <label/>
                        <hint/>
                    </range2>
                    <value2>
                        <label>not rendered value</label>
                        <hint/>
                    </value2>
                    <section-1>
                        <label>Default Section</label>
                    </section-1>
                    <section-2>
                        <label>Hidden section</label>
                    </section-2>
                    <min>
                        <label>min</label>
                        <hint/>

                    </min>
                    <max>
                        <label>max</label>
                        <hint/>
                    </max>
                    <range>
                        <label/>
                        <hint/>
                    </range>
                    <range-output>
                        <label/>
                        <hint/>
                    </range-output>
                    <value>
                        <label>value</label>
                        <hint/>
                    </value>
                </resource>
            </resources>
        </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-control" bind="section-1-bind">
                <xf:label ref="$form-resources/section-1/label"/>
                <fr:grid id="grid-1-grid">
                    <fr:c y="1" x="1" w="6">
                            <xf:input id="min-control" bind="min-bind">
                                <xf:label ref="$form-resources/min/label"/>
                                <xf:hint ref="$form-resources/min/hint"/>
                            <xf:alert ref="$fr-resources/detail/labels/alert"/>

                            </xf:input>
                        </fr:c>
                    <fr:c y="1" x="7" w="6">
                        <xf:input id="max-control" bind="max-bind">
                            <xf:label ref="$form-resources/max/label"/>
                            <xf:hint ref="$form-resources/max/hint"/>
                            <xf:alert ref="$fr-resources/detail/labels/alert"/>


                        </xf:input>
                    </fr:c>
                    <fr:c x="1" y="2" w="6">
                        <xf:range id="range-control" bind="range-bind">
                            <xf:label ref="$form-resources/range/label"/>
                            <xf:hint ref="$form-resources/range/hint"/>
                            <xf:alert ref="$fr-resources/detail/labels/alert"/>


                        </xf:range>
                    </fr:c>
                    <fr:c x="7" y="2" w="6">
                        <xf:output id="range-output-control" bind="range-output-bind">
                            <xf:label ref="$form-resources/range-output/label"/>
                            <xf:hint ref="$form-resources/range-output/hint"/>
                            <xf:alert ref="$fr-resources/detail/labels/alert"/>


                        </xf:output>
                    </fr:c>
                    <fr:c x="1" y="3" w="6">
                        <xf:output id="value-control" bind="value-bind">
                            <xf:label ref="$form-resources/value/label"/>
                            <xf:hint ref="$form-resources/value/hint"/>
                            <xf:alert ref="$fr-resources/detail/labels/alert"/>


                        </xf:output>
                    </fr:c>
                    <fr:c x="7" y="3" w="6"/>
                </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-2-grid">
                    <fr:c x="1" y="1" w="6">
                        <xf:input id="min2-control" bind="min2-bind">
                                <xf:label ref="$form-resources/min2/label"/>
                                <xf:hint ref="$form-resources/min2/hint"/>
                            <xf:alert ref="$fr-resources/detail/labels/alert"/>


                            </xf:input>
                    </fr:c>
                    <fr:c x="7" y="1" w="6">
                        <xf:input id="max2-control" bind="max2-bind">
                            <xf:label ref="$form-resources/max2/label"/>
                            <xf:hint ref="$form-resources/max2/hint"/>
                            <xf:alert ref="$fr-resources/detail/labels/alert"/>



                        </xf:input>
                    </fr:c>
                    <fr:c x="1" y="2" w="6">
                        <xf:input id="visible-value2-control" bind="visible-value2-bind">
                            <xf:label ref="$form-resources/visible-value2/label"/>
                            <xf:hint ref="$form-resources/visible-value2/hint"/>
                            <xf:alert ref="$fr-resources/detail/labels/alert"/>


                        </xf:input>
                    </fr:c>
                    <fr:c x="7" y="2" w="6"/>
                    <fr:c x="1" y="3" w="6">
                        <xf:range id="range2-control" bind="range2-bind">
                            <xf:label ref="$form-resources/range2/label"/>
                            <xf:hint ref="$form-resources/range2/hint"/>
                            <xf:alert ref="$fr-resources/detail/labels/alert"/>



                        </xf:range>
                    </fr:c>
                    <fr:c x="7" y="3" w="6"/>
                    <fr:c x="1" y="4" w="6">
                        <xf:output id="value2-control" bind="value2-bind">
                            <xf:label ref="$form-resources/value2/label"/>
                            <xf:hint ref="$form-resources/value2/hint"/>
                            <xf:alert ref="$fr-resources/detail/labels/alert"/>



                        </xf:output>
                    </fr:c>
                    <fr:c x="7" y="4" w="6"/>
                </fr:grid>
            </fr:section>
        </fr:body>
    </fr:view>
</xh:body>

1 个答案:

答案 0 :(得分:0)

的确,这是一个错误,如果要跟踪此问题,可以遵循issue #4131。但是请注意,范围控件当前在Form Builder中不可用,因此只有在他们编辑表单源并将控件显式更改为var x = ["banana", "apple", "orange"]; var y = []; for (var i in x) { if (x[i].indexOf('na') > -1) { y.push(i); } } 的情况下,这个问题才会出现。此时很可能是一个优先级较低的问题。