1

我创建了一个自定义控件(带有一些预定义值的隐藏文本框),我想在文件中设置visibility=false(), controlName="Mycustom", 。因此,每当我们使用 Orbeon Form Builder 中的自定义控件时,它将带有所有默认值,无需设置任何内容。default value="This is my custom control"XBL

XBL:

<xbl:xbl xmlns:xh="http://www.w3.org/1999/xhtml"
         xmlns:xf="http://www.w3.org/2002/xforms"
         xmlns:xs="http://www.w3.org/2001/XMLSchema"
         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:xxf="http://orbeon.org/oxf/xml/xforms"
         xmlns:fr="http://orbeon.org/oxf/xml/form-runner"
         xmlns:saxon="http://saxon.sf.net/"
         xmlns:xbl="http://www.w3.org/ns/xbl"
         xmlns:exf="http://www.exforms.org/exf/1-0"
         xmlns:xxbl="http://orbeon.org/oxf/xml/xbl">

     <metadata xmlns="http://orbeon.org/oxf/xml/form-builder">
        <display-name lang="en">Epson Custom Controls</display-name>
    </metadata>

    <xbl:binding id="fr-custom" element="fr|custom" >
        <metadata xmlns="http://orbeon.org/oxf/xml/form-builder">
            <display-name lang="en">My Custom Control</display-name>
            <icon lang="en">
                <small-icon>/forms/orbeon/builder/images/input.png</small-icon>
                <large-icon>/forms/orbeon/builder/images/input.png</large-icon>
            </icon>
            <templates>
                <bind xxf:whitespace="trim"/>
                <view>
                    <xf:input id="myCustom" ref="" xmlns="">
                       <xf:label>My Custom lable</xf:label>
                        <xf:hint ref=""/>
                        <xf:help ref=""/>
                        <xf:alert ref=""/>
                    </xf:input>
                </view>
            </templates>
        </metadata>
    </xbl:binding>
</xbl:xbl>

使用上面的控件,我想要隐藏的文本框,value='This is my custom control'它的控件名称应该是Mycustom.

更新

我尝试了以下更改,但它不起作用

        <templates>
            <bind xxf:whitespace="trim" relevant="false()" xxf:default="'This is my custom control'"/>
            <view>
                <xf:input id="myCustom" ref="" xmlns="">
                   <xf:label>Success Message</xf:label>
                    <xf:hint ref=""/>
                    <xf:help ref=""/>
                    <xf:alert ref=""/>
                </xf:input>
            </view>
        </templates>

通过上述更改,它现在可以正常工作(控件被一些默认值隐藏)。

你能告诉我如果条件怎么写吗 properties-local.xml:

 <property as="xs:string"  name="oxf.fr.detail.process.save-final-custom.*.*">
            require-uploads
            then validate-all
            then save
            if({xxf:instance('fr-form-instance')//customMessage} != null)
              {
                then success-message(message = "{xxf:instance('fr-form-instance')//customMessage}")
              }
            recover error-message("database-error") 
     </property>

如果它从支持正确配置,我想在这里覆盖这个成功消息。如果它的值为 null 则要显示 OOTB 消息(不要覆盖)。

更新2

Hybris 的综合变化。以下是我在 Hybris 中所做的更改

  • 创造XBL > orbeon > custom > custom.xbl

<bind xxf:whitespace="trim" relevant="false()" xxf:default="'This is my custom control'"/>

问题:-当我们选择自定义控件时,它将绑定没有任何标签/消息/可见性等。但是如果我刷新左侧控制面板,则标签开始出现在表单上。但仍未设置默认消息。

4

1 回答 1

1

让我们一一列举您提到的项目:

  1. visibility="false()"– 我想您指的relevant是 XForms 中的属性,而不是visibility属性。(Form Builder 称其为“可见性”,因为它就是这样,但在 XForms 中,属性是relevant。)这可以通过在<templates>a中实现<bind relevant="false()"/>
  2. controlName="Mycustom"– 您不能在 XBL 中设置控件的 id。(顺便说一句,当使用 Form Builder 时,XForms id 是从 Form Builder 中的表单作者定义的控件名称中推断出来的。) id 由使用控件的人设置,而不是由定义它的人设置,否则,一方面,这会阻止您可以在表单中拥有该控件的多个实例。
  3. default value="This is my custom control"– 与上面的 #1 一样,您可以使用<bind xxf:default="'This is my custom control'">. 注意添加的单引号,因为 的值xxf:default是一个 XPath 表达式。
于 2016-09-07T05:27:46.587 回答