我可以使用属性在解释性文本中配置 URL 吗? [英] Can I use a property to configure a URL in Explanatory Text?

查看:55
本文介绍了我可以使用属性在解释性文本中配置 URL 吗?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

在表单生成器中,我有一个包含解释性文本字段的表单.文本包含一个链接.我希望该链接的 URL 在每个环境中都不同.对于表单中的 HTTP 服务,我使用的是我在 博客文章.

In Form Builder I have a form that includes an Explanatory Text field. The text includes a link. I want the URL for that link to be different in each environment. For my HTTP Services in forms I am using a property that I have defined as described in this blog post.

是否可以使用属性来配置解释性文本中的 URL?

Is it possible to use a property to configure the URL in the Explanatory Text?

推荐答案

Once RFE 2427 实施后,您的问题将得到真正的解决方案.现在,fr:explanation 显示的文本完全是静态的.

Once RFE 2427 is implemented, you'll have a real solution to your problem. Right now, the text shown by fr:explanation is entirely static.

您可以通过创建自己的来解决这个问题自定义模型逻辑,在表单加载时,用您定义的属性值替换文本中的某个字符串:

You could work around this though, by creating your own custom model logic that, on form load, replaces a certain string from the text by the value of the property you defined:

  1. 在表单生成器中,创建一个解释性文本字段,并为 URL 输入 SITEURL.
  2. 仍然在 Form Builder 中,编辑表单源以删除 fr-form-resources 实例上的 xxf:readonly="true".这是结果形式.
  3. 在您的 properties-local.xml 中添加自定义模型逻辑:<property as="xs:anyURI" name="oxf.fr.detail.model.custom.*.*" value="oxf:/forms/resources/model.xml"/>.
  4. 仍然在properties-local.xml中,用一个属性定义占位符的值:<property as="xs:string" name="com.example.siteurl" value="http://www.orbeon.com/"/>.
  5. model.xml 中,在表单加载时,将 SITEURL 替换为属性值.
  1. In Form Builder, create an Explanatory Text field, and for the URL enter SITEURL.
  2. Still in Form Builder, edit the source of the form to remove the xxf:readonly="true" on the fr-form-resources instance. This is the resulting form.
  3. In your properties-local.xml add a custom model logic: <property as="xs:anyURI" name="oxf.fr.detail.model.custom.*.*" value="oxf:/forms/resources/model.xml"/>.
  4. Still in the properties-local.xml, define the value of the placeholder with a property: <property as="xs:string" name="com.example.siteurl" value="http://www.orbeon.com/"/>.
  5. In the model.xml, on form load, replace SITEURL by the value of the property.

这里是model.xml的内容:

<xf:model xmlns:xf="http://www.w3.org/2002/xforms"
          xmlns:xxf="http://orbeon.org/oxf/xml/xforms">
    <xf:action event="xforms-model-construct-done">
        <xf:action iterate="instance('fr-form-resources')/resource/text-with-link/text">
            <xf:setvalue ref="."
                         value="
                            replace(
                                .,
                                'SITEURL',
                                xxf:property('com.example.siteurl')
                            )"/>
        </xf:action>
    </xf:action>
</xf:model>

这篇关于我可以使用属性在解释性文本中配置 URL 吗?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆