简体   繁体   English

xforms动态下拉列表自动完成/自动插入

[英]xforms dynamic dropdown autocomplete/autoinsert

Based on the field value (eg - 1,2,3,...) of the xml_my_field , through the REST service, I receive dropdown list options to choose in my dynamic dropdown. 基于xml_my_field的字段值(例如-1,2,3,...),通过REST服务,我会收到下拉列表选项,可以在动态下拉列表中进行选择。 Options are the same as the xml_my_field value (1,2,3,...). 选项与xml_my_field值(1,2,3,...)相同。 REST service generate xml like this: REST服务生成这样的xml:

<item>
    <label>name1</label>
    <value>1</value>
</item>
<item>
    <label>name2</label>
    <value>2</value>
</item>

Is there any possibility, when I have only one value (eg - 1 or 2) in my xml_my_field , to automatically insert this to my dropdown field, not only in dropdown options, but auto fill field? 当我在xml_my_field中只有一个值(例如-1或2)时,是否有可能将其自动插入到我的下拉字段中,不仅在下拉选项中,而且在自动填充字段中? Here is my itemset: 这是我的项目集:

<fr:databound-select1 xmlns:exf="http://www.exforms.org/exf/1-0"
    xmlns:xxbl="http://orbeon.org/oxf/xml/xbl"
    id="xml_dropdown_field-control"
    appearance="minimal"
    resource="http://wfw-forms:8080/workflow/seam/resource/restv1/podmiotNumber/getPodmiot?numerPodmiotu={//xml_my_field}"
    bind="xml_dropdown_field-bind">
    <xf:label ref="$form-resources/xml_dropdown_field/label" xh:style=""/>
    <xf:hint ref="$form-resources/xml_dropdown_field/hint"/>
    <xf:help ref="$form-resources/xml_dropdown_field/help"/>
    <xf:alert ref="$fr-resources/detail/labels/alert"/>
    <xf:itemset ref="item">
        <xf:label ref="label"/>
        <xf:value ref="value"/>
    </xf:itemset>       
</fr:databound-select1>

I try to add to my fr:databound-select1 something like this, but it seems to not working 我试图将这样的东西添加到我的fr:databound-select1中 ,但似乎无法正常工作

<xforms:action ev:event="fr-search-changed">
    <xxforms:variable name="search-value" select="event(//xml_my_field)"/>
    <xxforms:variable name="make-suggestion" select="string-length($search-value) = 1"/>
    <xforms:action if="$make-suggestion">
        <xforms:setvalue ref="xxf:instance('fr-form-instance')//xml_dropdown_field"      value="$search-value"/>
    </xforms:action>
</xforms:action>

Any suggestions? 有什么建议么?

Ok I was able to solve this by using xpath expression in calculate attribute. 好的,我能够通过在calculate属性中使用xpath表达式来解决此问题。 This gave me the opportunity to autamic insert the value and do not disturb my REST functionality. 这为我提供了自动插入值的机会,并且不会打扰我的REST功能。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM