Reputation: 1584
If there are multiple date fields that have the same constraint or multiple text-area with the same constraint
Is it possible to reuse the constraint used by a bind, across similar constraints?
say text-area 1 has constraint
if(string-length(.) > 500)
then substring(.,1,500)
else .
and text-area 2 has constraint
if(string-length(.) > 500)
then substring(.,1,500)
else .
is it possible to have the constraint at a common location and at each bind call the particular constraint and reuse the code?
Upvotes: 0
Views: 193
Reputation: 31763
You can declare a single bind
where the nodeset
expression points to the two nodes corresponding to your two text areas. For instance:
<bind nodeset="/my-root/(text-area-1 | text-area-2)" constraint="…"/>
(In the future, a capability to define functions that are more like reusable XPath expressions might be added to XForms, allowing you to also easily reuse XPath expressions in other situations.)
Upvotes: 1