XForms spec proposal: add event fired when new repeat instance is created

To be explicit, you are suggesting an alternative to both this and XLSForm spec proposal: add syntax to make it easy to use a value from the last saved instance which is to change the semantics of once() from running when the context node's value is empty to once on instance first load and to use that to define dynamic defaults, did I get that right?

I see in the last message in the last saved instance XLSForm syntax thread that the spec was approved during the TSC call. Did y'all discuss your alternative suggestion by any chance?

I agree that once() is not a very good name for what it does. I suspect it was added as a quick hack for functions that rely on state outside the form such as random() and now() and that the ramifications were not thought through at the time. I put it in the same "not-my-favorite-but-users-rely-on-it" bucket as jr:choice-name and indexed-repeat.

I see what you are getting at and it does have a certain simplicity. That said, I'm even less comfortable with this new version of once() which knows when it's being run. I think it's also unfortunate to have both a calculation and a user interface control for the same instance node.

XForms is fundamentally event-driven and provides a nice mechanism for triggering behavior based on events so using events and actions in this case certainly seems more XForms-y. I also can't think of a function-driven way to support things like the xforms-value-changed event so it seems we'll want to continue making use of the event/action paradigm.

I would not be opposed to putting once() as it exists today on a deprecation path.

1 Like