See below for spec proposal.
For the "remembering previously entered values (auto-fill)" feature, a
setvalue action triggered when a form instance is opened for the first time will be used to pull a previously-saved value and use it as a default. As I was starting to think about how XLSForm might make this functionality easy to use, I ran into a possible issue that I think should be discussed before the feature is released.
The examples shared in the spec discussion and the Collect PR use the
The ODK XForms specification says this about
notification event dispatched after all form controls have been initialized.
I would expect that to mean that it fires each time a specific form instance is loaded. That is, that it would fire again when an existing form instance is opened for editing.
I've read the W3C XForms documentation here several times and I think it also says that
xforms-ready should fire on each load but it's not totally clear to me.
JavaRosa definitely fires it exactly once the first time that a form instance is loaded. That is, if a form instance is opened again for editing,
xforms-ready is not fired. However, the code that ensures this has this comment:
// TODO: Hm, not 100% sure that this is right. Maybe we should be // using a slightly different event for "First Load" which doesn't // get fired again, but always fire this one?
This implies to me that the intended behavior of
xforms-ready was unclear to the original JavaRosa developers.
I'm inclined not to dig further and to simply amend the documentation (and that comment!) to make it clear that in the ODK XForms world,
xforms-ready is only fired once ever for a given form instance. This may not be "correct" as far as W3C XForms is concerned but it maintains backwards compatibility and compatibility with CommCare and others in the ecosystem.
Otherwise, I don't know what the implications of changing its meaning would be. It's unlikely many forms use it explicitly but we don't know that for sure.
@martijnr does Enketo define
xforms-ready? If so, when is it fired?