在表单生成器中,我有一个包含解释性文本字段的表单。文本包括一个链接。我希望该链接的URL在每个环境中都是不同的。对于表单中的HTTP,我使用了我在这个博客帖子中定义的属性。
是否可以使用属性来配置解释性文本中的URL?
发布于 2017-04-28 22:54:04
一旦实现了RFE 2427,您就有了真正的问题解决方案。现在,fr:explanation显示的文本完全是静态的。
不过,您可以通过创建自己的自定义模型逻辑来解决这一问题,在表单加载时,用定义的属性值替换文本中的某个字符串:
SITEURL。fr-form-resources实例上的fr-form-resources。这是结果形式。properties-local.xml中添加一个自定义模型逻辑:<property as="xs:anyURI" name="oxf.fr.detail.model.custom.*.*" value="oxf:/forms/resources/model.xml"/>。properties-local.xml中,使用属性:<property as="xs:string" name="com.example.siteurl" value="http://www.orbeon.com/"/>定义占位符的值。model.xml中,在表单加载时,用属性值替换SITEURL。下面是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>https://stackoverflow.com/questions/43689388
复制相似问题