在节模板和其他节之间传递值 [英] passing values between a section template and an other section

查看:43
本文介绍了在节模板和其他节之间传递值的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我在以多种形式使用的公共库中使用 Orbeon 部分模板.

i'm using Orbeon section templates in a common library that i use in multiple forms.

我需要给定部分模板的一些值来确定表单其他部分中某些控件的可见性.所以我正在寻找一种解决方案来参数化节模板,以便永远不会访问其内部控制值.

I need some values of a given section template to determine the visibility of some controls in other sections of my form. So i'm looking for a solution to parametrize the section template in order to never access its inner control values.

有人可以向我解释如何实现吗?

Can someone pls explain to me how to achieve that?

推荐答案

要从该部分模板之外的字段(并且本身不在另一个部分模板中)引用该部分模板内的字段的值,您不能使用 $field-name 语法.您可以从部分模板内部,但不能从部分模板外部.这是因为部分模板确实封装了它们的内容,例如,允许您在表单中拥有同一部分模板的多个实例,或使用相同字段名称的多个部分模板.

To refer to the value of a field which is inside a section template from a field outside of that section template (and itself not in another section template), you can't use the $field-name syntax. You can from inside the section template, but not from outside the section template. This is because section templates really encapsulate their content, thus allowing you, for instance, to have multiple instances of the same section template in your form, or multiple section templates using the same field names.

所以,要回答您的问题,这是您需要使用路径表达式的情况.假设您要引用的字段名为 street 并且您将模板的特定实例命名为 shipping,那么您可以使用表达式 <代码>/form/shipping/street.如果您添加同一模板的另一个实例,并将该实例命名为 billing,那么您可以将该其他街道字段称为 /form/billing/street.

So, to answer your question, this is a case where you need to use a path expression. Say the field you want to refer to is named street and you named that particular instance of the template shipping, then you can refer to the value of the field with the expression /form/shipping/street. If you add another instance of that same template, and name that instance billing, then you could refer to that other street field as /form/billing/street.

这篇关于在节模板和其他节之间传递值的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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