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?
You can declare a single
bindwhere thenodesetexpression points to the two nodes corresponding to your two text areas. For instance:(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.)