fr:资源模式下的自动完成不显示建议列表

发布于 2025-01-07 12:33:16 字数 10383 浏览 0 评论 0原文

我使用 orbeon 表单生成器自动完成控件,我在编辑模式下更改了该控件以匹配自动完成资源模式的语法,如下所示:

<xhtml:html xmlns:xhtml="http://www.w3.org/1999/xhtml"
        xmlns:xforms="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:xxforms="http://orbeon.org/oxf/xml/xforms"
        xmlns:exforms="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/">
<xhtml:head>
    <xhtml:title>Test Autocomplete</xhtml:title>
          <xhtml:style>
    .fr-autocomplete-container .yui-ac-content {
overflow-x: hidden;
overflow-y: auto;
max-height: 100px;
*height:expression(this.scrollHeight>100?"100px":"auto");}
    </xhtml:style>
    <xforms:model id="fr-form-model">

        <!-- Main instance -->
        <xforms:instance id="fr-form-instance">
            <form>
                <address>
                    <street/>

                    <number/>
                    <zip/>
                    <city/>
                </address>
            </form>
        </xforms:instance>

        <!-- Bindings -->
        <xforms:bind id="fr-form-binds" nodeset="instance('fr-form-instance')">
            <xforms:bind id="address-bind" nodeset="address">
                <xforms:bind id="number-bind" nodeset="number" name="number"/>
                <xforms:bind id="zip-bind" nodeset="zip" type="xforms:string" readonly="true()" name="zip"/>
                <xforms:bind id="city-bind" nodeset="city" type="xforms:string" readonly="true()"
                             name="city"/>
                <xforms:bind id="street-bind" nodeset="street" type="xforms:string" name="street"/>

            </xforms:bind>
        </xforms:bind>

        <!-- Metadata -->
        <xforms:instance id="fr-form-metadata" xxforms:readonly="true">
            <metadata>
                <application-name>MyApp</application-name>
                <form-name>test_autocomplete</form-name>
                <title xml:lang="en">Test Autocomplete</title>
                <description xml:lang="en"/>
                <author/>
                <logo mediatype="" filename="" size=""/>
            </metadata>
        </xforms:instance>

        <!-- Attachments -->
        <xforms:instance id="fr-form-attachments">
            <attachments>
                <css mediatype="text/css" filename="" size=""/>
                <pdf mediatype="application/pdf" filename="" size=""/>
            </attachments>
        </xforms:instance>

        <!-- All form resources -->
        <!-- Don't make readonly by default in case a service modifies the resources -->
        <xforms:instance id="fr-form-resources" xxforms:readonly="false">
            <resources>
                <resource xml:lang="en">
                    <street>
                        <label>Rue</label>
                        <hint/>
                        <help/>
                        <alert/>
                    </street>

                    <address>
                        <label>Coordonees</label>
                        <help/>
                    </address>
                    <number>
                        <label>Num</label>
                        <hint/>
                        <help/>
                        <alert/>
                    </number>
                    <zip>
                        <label>Code postal</label>
                        <hint/>
                        <help/>
                        <alert/>
                    </zip>
                    <city>
                        <label>Localite</label>
                        <hint/>
                        <help/>
                        <alert/>
                    </city>
                </resource>
            </resources>
        </xforms:instance>


    </xforms:model>
</xhtml:head>
<xhtml:body>
    <fr:view>
        <xforms:label ref="instance('fr-form-metadata')/title"/>
        <fr:body>
            <fr:section id="address-section" bind="address-bind">
                <xforms:label ref="$form-resources/address/label"/>
                <xforms:help ref="$form-resources/address/help"/>
                <fr:grid columns="2">
                  <xhtml:tr>
                        <xhtml:td>
                            <widget:xforms-instance-inspector xmlns:widget="http://orbeon.org/oxf/xml/widget" id="orbeon-xforms-inspector"/>
                        </xhtml:td>
                    </xhtml:tr>
                    <xhtml:tr>
                        <xhtml:td>

                            <fr:autocomplete xmlns:xxbl="http://orbeon.org/oxf/xml/xbl"
                                             xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
                                             xmlns:oxf="http://www.orbeon.com/oxf/processors"
                                             xmlns:xbl="http://www.w3.org/ns/xbl"
                                             xmlns:fb="http://orbeon.org/oxf/xml/form-builder"
                                             xmlns:pipeline="java:org.orbeon.oxf.processor.pipeline.PipelineFunctionLibrary"
                                             bind="street-bind"
                                             appearance="minimal"
                                             id="street-control"
                                             ref="."
                                             resource="https://myHTTPServiceUrl/streets/getByCriteria.do?language=FR&amp;streetName={event('fr-search-value')}"
                                             dynamic-itemset="true" >
                                <xforms:label ref="$form-resources/street/label"/>
                                <xforms:hint ref="$form-resources/street/hint"/>
                                <xforms:help ref="$form-resources/street/help"/>
                                <xforms:alert ref="$fr-resources/detail/labels/alert"/>
                                <xforms:itemset nodeset="/results/result">
                                    <xforms:label ref="/Street/name"/>
                                    <xforms:value ref="/Street/name"/>
                                </xforms:itemset>

                            </fr:autocomplete>




                        </xhtml:td>
                        <xhtml:td>
                            <xforms:input xmlns:xbl="http://www.w3.org/ns/xbl"
                                          xmlns:fb="http://orbeon.org/oxf/xml/form-builder"
                                          xmlns:pipeline="java:org.orbeon.oxf.processor.pipeline.PipelineFunctionLibrary"
                                          bind="number-bind"
                                          id="number-control">
                                <xforms:label ref="$form-resources/number/label"/>
                                <xforms:hint ref="$form-resources/number/hint"/>
                                <xforms:help ref="$form-resources/number/help"/>
                                <xforms:alert ref="$fr-resources/detail/labels/alert"/>
                            </xforms:input>
                        </xhtml:td>
                    </xhtml:tr>
                    <xhtml:tr>
                        <xhtml:td>
                            <xforms:input xmlns:xbl="http://www.w3.org/ns/xbl"
                                          xmlns:fb="http://orbeon.org/oxf/xml/form-builder"
                                          xmlns:pipeline="java:org.orbeon.oxf.processor.pipeline.PipelineFunctionLibrary"
                                          bind="zip-bind"
                                          id="zip-control">
                                <xforms:label ref="$form-resources/zip/label"/>
                                <xforms:hint ref="$form-resources/zip/hint"/>
                                <xforms:help ref="$form-resources/zip/help"/>
                                <xforms:alert ref="$fr-resources/detail/labels/alert"/>
                            </xforms:input>
                        </xhtml:td>
                        <xhtml:td>
                            <xforms:input xmlns:xbl="http://www.w3.org/ns/xbl"
                                          xmlns:fb="http://orbeon.org/oxf/xml/form-builder"
                                          xmlns:pipeline="java:org.orbeon.oxf.processor.pipeline.PipelineFunctionLibrary"
                                          bind="city-bind"
                                          id="city-control">
                                <xforms:label ref="$form-resources/city/label"/>
                                <xforms:hint ref="$form-resources/city/hint"/>
                                <xforms:help ref="$form-resources/city/help"/>
                                <xforms:alert ref="$fr-resources/detail/labels/alert"/>
                            </xforms:input>
                        </xhtml:td>
                    </xhtml:tr>
                </fr:grid>
            </fr:section>
        </fr:body>
    </fr:view>
</xhtml:body>

当我在表单运行器中测试它时,我看到“fr-search-changed”事件被触发并且搜索值发生变化,但我看到没有填充项目集。 你能告诉我代码中有什么问题吗? 我也确信该服务确实返回了我测试的结果

Im using orbeon form builder autocomplete control that i changed in edit mode to match the synatx of the autocomplete resource mode, like this:

<xhtml:html xmlns:xhtml="http://www.w3.org/1999/xhtml"
        xmlns:xforms="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:xxforms="http://orbeon.org/oxf/xml/xforms"
        xmlns:exforms="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/">
<xhtml:head>
    <xhtml:title>Test Autocomplete</xhtml:title>
          <xhtml:style>
    .fr-autocomplete-container .yui-ac-content {
overflow-x: hidden;
overflow-y: auto;
max-height: 100px;
*height:expression(this.scrollHeight>100?"100px":"auto");}
    </xhtml:style>
    <xforms:model id="fr-form-model">

        <!-- Main instance -->
        <xforms:instance id="fr-form-instance">
            <form>
                <address>
                    <street/>

                    <number/>
                    <zip/>
                    <city/>
                </address>
            </form>
        </xforms:instance>

        <!-- Bindings -->
        <xforms:bind id="fr-form-binds" nodeset="instance('fr-form-instance')">
            <xforms:bind id="address-bind" nodeset="address">
                <xforms:bind id="number-bind" nodeset="number" name="number"/>
                <xforms:bind id="zip-bind" nodeset="zip" type="xforms:string" readonly="true()" name="zip"/>
                <xforms:bind id="city-bind" nodeset="city" type="xforms:string" readonly="true()"
                             name="city"/>
                <xforms:bind id="street-bind" nodeset="street" type="xforms:string" name="street"/>

            </xforms:bind>
        </xforms:bind>

        <!-- Metadata -->
        <xforms:instance id="fr-form-metadata" xxforms:readonly="true">
            <metadata>
                <application-name>MyApp</application-name>
                <form-name>test_autocomplete</form-name>
                <title xml:lang="en">Test Autocomplete</title>
                <description xml:lang="en"/>
                <author/>
                <logo mediatype="" filename="" size=""/>
            </metadata>
        </xforms:instance>

        <!-- Attachments -->
        <xforms:instance id="fr-form-attachments">
            <attachments>
                <css mediatype="text/css" filename="" size=""/>
                <pdf mediatype="application/pdf" filename="" size=""/>
            </attachments>
        </xforms:instance>

        <!-- All form resources -->
        <!-- Don't make readonly by default in case a service modifies the resources -->
        <xforms:instance id="fr-form-resources" xxforms:readonly="false">
            <resources>
                <resource xml:lang="en">
                    <street>
                        <label>Rue</label>
                        <hint/>
                        <help/>
                        <alert/>
                    </street>

                    <address>
                        <label>Coordonees</label>
                        <help/>
                    </address>
                    <number>
                        <label>Num</label>
                        <hint/>
                        <help/>
                        <alert/>
                    </number>
                    <zip>
                        <label>Code postal</label>
                        <hint/>
                        <help/>
                        <alert/>
                    </zip>
                    <city>
                        <label>Localite</label>
                        <hint/>
                        <help/>
                        <alert/>
                    </city>
                </resource>
            </resources>
        </xforms:instance>


    </xforms:model>
</xhtml:head>
<xhtml:body>
    <fr:view>
        <xforms:label ref="instance('fr-form-metadata')/title"/>
        <fr:body>
            <fr:section id="address-section" bind="address-bind">
                <xforms:label ref="$form-resources/address/label"/>
                <xforms:help ref="$form-resources/address/help"/>
                <fr:grid columns="2">
                  <xhtml:tr>
                        <xhtml:td>
                            <widget:xforms-instance-inspector xmlns:widget="http://orbeon.org/oxf/xml/widget" id="orbeon-xforms-inspector"/>
                        </xhtml:td>
                    </xhtml:tr>
                    <xhtml:tr>
                        <xhtml:td>

                            <fr:autocomplete xmlns:xxbl="http://orbeon.org/oxf/xml/xbl"
                                             xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
                                             xmlns:oxf="http://www.orbeon.com/oxf/processors"
                                             xmlns:xbl="http://www.w3.org/ns/xbl"
                                             xmlns:fb="http://orbeon.org/oxf/xml/form-builder"
                                             xmlns:pipeline="java:org.orbeon.oxf.processor.pipeline.PipelineFunctionLibrary"
                                             bind="street-bind"
                                             appearance="minimal"
                                             id="street-control"
                                             ref="."
                                             resource="https://myHTTPServiceUrl/streets/getByCriteria.do?language=FR&streetName={event('fr-search-value')}"
                                             dynamic-itemset="true" >
                                <xforms:label ref="$form-resources/street/label"/>
                                <xforms:hint ref="$form-resources/street/hint"/>
                                <xforms:help ref="$form-resources/street/help"/>
                                <xforms:alert ref="$fr-resources/detail/labels/alert"/>
                                <xforms:itemset nodeset="/results/result">
                                    <xforms:label ref="/Street/name"/>
                                    <xforms:value ref="/Street/name"/>
                                </xforms:itemset>

                            </fr:autocomplete>




                        </xhtml:td>
                        <xhtml:td>
                            <xforms:input xmlns:xbl="http://www.w3.org/ns/xbl"
                                          xmlns:fb="http://orbeon.org/oxf/xml/form-builder"
                                          xmlns:pipeline="java:org.orbeon.oxf.processor.pipeline.PipelineFunctionLibrary"
                                          bind="number-bind"
                                          id="number-control">
                                <xforms:label ref="$form-resources/number/label"/>
                                <xforms:hint ref="$form-resources/number/hint"/>
                                <xforms:help ref="$form-resources/number/help"/>
                                <xforms:alert ref="$fr-resources/detail/labels/alert"/>
                            </xforms:input>
                        </xhtml:td>
                    </xhtml:tr>
                    <xhtml:tr>
                        <xhtml:td>
                            <xforms:input xmlns:xbl="http://www.w3.org/ns/xbl"
                                          xmlns:fb="http://orbeon.org/oxf/xml/form-builder"
                                          xmlns:pipeline="java:org.orbeon.oxf.processor.pipeline.PipelineFunctionLibrary"
                                          bind="zip-bind"
                                          id="zip-control">
                                <xforms:label ref="$form-resources/zip/label"/>
                                <xforms:hint ref="$form-resources/zip/hint"/>
                                <xforms:help ref="$form-resources/zip/help"/>
                                <xforms:alert ref="$fr-resources/detail/labels/alert"/>
                            </xforms:input>
                        </xhtml:td>
                        <xhtml:td>
                            <xforms:input xmlns:xbl="http://www.w3.org/ns/xbl"
                                          xmlns:fb="http://orbeon.org/oxf/xml/form-builder"
                                          xmlns:pipeline="java:org.orbeon.oxf.processor.pipeline.PipelineFunctionLibrary"
                                          bind="city-bind"
                                          id="city-control">
                                <xforms:label ref="$form-resources/city/label"/>
                                <xforms:hint ref="$form-resources/city/hint"/>
                                <xforms:help ref="$form-resources/city/help"/>
                                <xforms:alert ref="$fr-resources/detail/labels/alert"/>
                            </xforms:input>
                        </xhtml:td>
                    </xhtml:tr>
                </fr:grid>
            </fr:section>
        </fr:body>
    </fr:view>
</xhtml:body>

When i test it in form runner i see that the 'fr-search-changed' event is fired and the search value changing but i see no itemset filled.
Can you tell me what is wrong in the code pls ?
Also i'm sure that the service is really returning results with what i tested

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

失退 2025-01-14 12:33:16

我无法完全运行您的代码,因为它没有指向可访问的服务,但我怀疑自动完成 资源模式 不适合您,因为该功能未在 3.9 版本中使用。为了能够使用资源模式,您需要使用较新的版本(在撰写本文时尚未发布)或每晚构建。

I can't exactly run your code as it doesn't point to an accessible service, but I suspect that the autocomplete resource mode isn't working for you because that feature just didn't make it for the 3.9 release. To be able to use the resource mode, you'll need to use a newer version (yet to be release, at the point of this writing) or a nightly build.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文