Orbeon статическое автозаполнение не работает должным образом - PullRequest
0 голосов
/ 27 августа 2018

Я использую Orbeon v2017.1, и я хотел бы добавить поле автозаполнения со статическим набором элементов.

Я пытался реализовать это так, как здесь определено https://doc.orbeon.com/form-runner/component/autocomplete#static и я также попытался создать службу и действие, которое будет заполнять данные, но отображает их в виде переключателей вместо заполнения раскрывающегося списка.

Есть ли рабочий пример для этой версии Orbeon, на который я мог бы взглянуть?

EDIT: Вот пример двух полей автозаполнения (динамическое и статическое) Я не уверен, поддерживает ли используемый бесплатный веб-сервис фильтрацию, поэтому значение fr-search-value не использовалось для динамического (возможно ли его как-то отфильтровать в Orbeon как для статического, так и для динамического?)

<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">

                 <xf:instance id="all-countries"
                     src="http://webservices.oorsprong.org/websamples.countryinfo/CountryInfoService.wso/ListOfCountryNamesByName/XML"/>

        <!-- Main instance -->
        <xf:instance id="fr-form-instance" xxf:exclude-result-prefixes="#all" xxf:index="id">
            <form>
                <section-1>
                    <country-dynamic-autocomplete label=""/>
                    <country-static-autocomplete label=""/>

                </section-1>
            </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="country-dynamic-autocomplete-bind" ref="country-dynamic-autocomplete"
                         name="country-dynamic-autocomplete"/>
                <xf:bind id="country-static-autocomplete-bind" ref="country-static-autocomplete"
                         name="country-static-autocomplete"/>

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

        <!-- Metadata -->
        <xf:instance xxf:readonly="true" id="fr-form-metadata" xxf:exclude-result-prefixes="#all">
            <metadata>
                <application-name>insurance</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">
                    <country-dynamic-autocomplete>
                        <label>Countries Dynamic Autocomplete</label>
                        <hint/>
                    </country-dynamic-autocomplete>
                    <country-static-autocomplete>
                        <label>Countries Static Autocomplete</label>
                        <hint/>
                    </country-static-autocomplete>
                    <section-1>
                        <label>Country Section</label>
                    </section-1>

                </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>
                    <xh:tr>
                        <xh:td>
                            <fr:autocomplete xmlns:xxbl="http://orbeon.org/oxf/xml/xbl"
                                             xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
                                             id="country-dynamic-autocomplete-control"
                                             labelref="@label"
                                             max-results-displayed="300"
                                             resource="http://webservices.oorsprong.org/websamples.countryinfo/CountryInfoService.wso/ListOfCountryNamesByName/XML"
                                             bind="country-dynamic-autocomplete-bind">
                                <xf:label ref="$form-resources/country-dynamic-autocomplete/label"/>
                                <xf:hint ref="$form-resources/country-dynamic-autocomplete/hint"/>
                                <xf:alert ref="$fr-resources/detail/labels/alert"/>


                                <xf:itemset ref="/ArrayOftCountryCodeAndName/tCountryCodeAndName">
                                    <xf:label ref="sName"/>
                                    <xf:value ref="sISOCode"/>
                                </xf:itemset>
                            </fr:autocomplete>

                        </xh:td>

                    </xh:tr>
                    <xh:tr>
                        <xh:td>
                            <fr:autocomplete id="country-static-autocomplete-control" ref="country-static-autocomplete"
                                             dynamic-itemset="false"
                                             bind="country-static-autocomplete-bind">
                                <xf:label ref="$form-resources/country-static-autocomplete/label"/>
                                <xf:hint ref="$form-resources/country-static-autocomplete/hint"/>
                                <xf:alert ref="$fr-resources/detail/labels/alert"/>


                                <xf:itemset ref="instance('all-countries')/ArrayOftCountryCodeAndName/tCountryCodeAndName">
                                    <xf:label ref="sName"/>
                                    <xf:value ref="sISOCode"/>
                                </xf:itemset>
                            </fr:autocomplete>
                        </xh:td>
                    </xh:tr>
                </fr:grid>
            </fr:section>
        </fr:body>
    </fr:view>
</xh:body>
</xh:html>
...