One more thing I realized I should have called out explicitly. The proposal above (based on the jr-insert
implementation) includes a big simplification on the properties of the xforms-insert
event: actions are registered on a generic insert event rather than on insert of a specific repeat type and it's the absolute prefix of the action's ref
that determines which actions run.
For example, let's say there were an enemies
repeat in the form above. The generic insertion event would fire when an instance of enemies
was added and this would trigger the setvalue
action. But since the action's ref
starts with /data/friends
and not /data/enemies
, the action
would have no effect.
This means that ref
always needs to be an absolute path which in turn means inserting a repeat can only change values in that new repeat instance. You couldn't, for example, set up a counter of repeat instances that gets updated on insertion (the count
function can be used for that particular requirement).