问题
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?
回答1:
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.
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
.
来源:https://stackoverflow.com/questions/9327294/passing-values-between-a-section-template-and-an-other-section