Bindings are fore-ever

Sorry for the pun - couldn't resist

ModelItems

In short model items attach constraints or calculations to the nodes of your data.

Imagine your data as a tree of nodes. With bindings you can add additional constraints to those nodes (the colored dots) which will be recalculated and revalidated automatically when a data change requires it.

Each fx-bind requires a ref attribute pointing to the node(s) it applies to.

With following attributes you can add calculations and validations as needed:

calculate XPath calculation expression whose result will be stored in node referenced by ref.
constraint XPath expression resolving to boolean. When resolving to true the referenced node is considered valid.
readonly boolean XPath expression - when resolving to true it won't be possible any more to change its value with a UI control or by using a setvalue action.
required boolean XPath expression - when resolving to true the node must have a value to allow submission.
relevant boolean XPath expression - when resolving to false the node is considered non-relevant. UI controls binding to the referenced node are not rendered in that case. Non-relevant nodes are also not submitted but get filtered out by default.

Each of these attributes will use XPath expressions that evaluate in the context of the node(s) given by the ref attribute

In this example the node 'item' will get a value of '33'

Calculated nodes are always readonly!

ModelItem Tester

Use the buttons to toggle the state of the respective modelitem facet below. Hitting twice will have no additional effect.

The fx-bind defines a boolean condition for each of the facets. Here we depend on the value of a node which can be set with the corresponding button.