强制清空重复部分

时间:2019-05-13 14:50:24

标签: orbeon

我创建了一个重复的节,默认情况下,当第一次加载表单时,它会显示该节的第一行为空,然后删除该行。

有什么方法可以强制该节在第一次被完全清空吗?

我正在使用Orbeon Forms 2017.1.1.201709122316 PE。这是代码:

<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">
    <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>
                    <rep-section-1>
                        <rep-section-1-iteration>
                            <control-1/>
                        </rep-section-1-iteration>

                    </rep-section-1>
                </form>
            </xf:instance>

            <!-- Bindings -->
            <xf:bind id="fr-form-binds" ref="instance('fr-form-instance')">
                <xf:bind id="rep-section-1-bind" name="rep-section-1" ref="rep-section-1">
                    <xf:bind id="rep-section-1-iteration-bind" ref="rep-section-1-iteration"
                             name="rep-section-1-iteration">
                        <xf:bind id="control-1-bind" name="control-1" ref="control-1"/>
                    </xf:bind>

                </xf:bind>
            </xf:bind>

            <!-- Metadata -->
            <xf:instance xxf:readonly="true" id="fr-form-metadata" xxf:exclude-result-prefixes="#all">
                <metadata>
                    <application-name>test</application-name>
                    <form-name>repeated</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">
                        <rep-section-1>
                            <label>Repeated Section</label>
                        </rep-section-1>
                        <control-1>
                            <label>Field1</label>
                            <hint/>
                            <alert/>
                        </control-1>
                    </resource>
                </resources>
            </xf:instance>
            <xf:instance xxf:readonly="true" id="rep-section-1-template"
                         xxf:exclude-result-prefixes="#all">
                <rep-section-1-iteration>
                    <control-1/>
                </rep-section-1-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="rep-section-1-control" bind="rep-section-1-bind" repeat="content"
                            template="instance('rep-section-1-template')"
                            apply-defaults="true"
                            fb:initial-iterations="first"
                            collapsible="true">
                    <xf:label ref="$form-resources/rep-section-1/label"/>
                    <fr:grid>
                        <xh:tr>
                            <xh:td>
                                <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>
                            </xh:td>
                            <xh:td/>
                        </xh:tr>
                    </fr:grid>
                </fr:section>
            </fr:body>
        </fr:view>
    </xh:body>
</xh:html>

下一张图片解释了我的评论:

  1. 首次加载后的默认重复部分 Default repeated section
  2. 首次加载后需要重复的部分 Desired repeated section

1 个答案:

答案 0 :(得分:0)

您可以在“部分设置”对话框中进行配置,单击“无最小”单选按钮,该单选按钮在下面的屏幕快照中突出显示,并删除Form Builder中的第一次迭代

我不确定2017.1.1(您提到的版本)的状态是什么,但是请注意,2018.2.2中存在一个问题,该问题阻止了在上一节之后创建新的节迭代迭代已被删除。此问题已修复,将包含在2018.2.3版本中。有关该问题的信息,请参见#4018

"No minimum" radio in the Section Settings dialog