Принудительная пустая повторная секция - PullRequest
0 голосов
/ 13 мая 2019

Я создал повторный раздел, и по умолчанию при первой загрузке формы он показывает раздел с пустой первой строкой, а затем позволяет стереть эту строку.

Есть ли способ заставить раздел выполнитьбыть полностью пустым в первый раз?

Я использую 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 голосов
/ 15 мая 2019

Вы можете настроить это в диалоговом окне «Параметры раздела», щелкнув переключатель «Нет минимума», который выделен на скриншоте ниже и удаляет первую итерацию в Form Builder

Я не уверен, чтостатус этого - 2017.1.1 (версия, которую вы упомянули, которую вы использовали), но обратите внимание, что в 2018.2.2 была проблема, которая препятствовала созданию новой итерации раздела после удаления последней итерации раздела.Это исправлено и будет включено в выпуск 2018.2.3.Для получения информации по этому вопросу см. # 4018 .

...