XForms initialization use case in response to ACTION-606


Here is a typical initialization use case that I would like to submit
to the group. Here is some simple markup for it which should speak for



More often than not, an XForms page needs to load data dynamically
before it can operate. In addition to initial data to be shown/edited
by the user, this might control i18n resources, itemsets, etc.

We start loading such data upon xforms-model-construct-done, for
performance reasons:

* When the xforms-model-construct-done is dispatched, the controls
  have not yet been initialized (this occurs once as the default
  action of all xforms-model-construct-done being completed). This
  means that if you are to modify instances, there is no cost
  associated with updating the (non-existing) controls.

* If you were to do this upon xforms-ready, modifying data with
  insert/delete (which also occurs upon instance replacement) requires
  repeat processing: identifying modifications to repeat node-sets,
  and creating/deleting repeat iterations.

Submissions might be asynchronous. This allows parallelizing data
retrieval and can reduce latency.

In order to complete initialization of data before the controls are
initialized, we use a custom action called
<xxf:join-submissions/>. This action waits for all pending
asynchronous submissions to complete. It defers the completion of the
xforms-model-construct-done handler, and therefore initialization of
controls, until all the data is ready.


* There are performance benefits from doing initialization tasks
  before controls are initialized.

* xforms-model-construct-done is a crucial event.

* Asynchronous submissions during page initialization make a lot of

* There is a need for a mechanism to wait until such submissions have
  completed (e.g. <xxf:join-submissions/>).

For implementations that have a server-side component, the scenario
above is even more important because it is costly to send an entire
HTML page to the client, and then have a second round-trip to update
data that was necessary for properly displaying the page anyway.

NOTE: There are other use cases where it makes sense to display the
page first with incomplete data and then load some additional data
asynchronously as it arrives. That's different from the use case
discussed above.

Next steps:

* Have other WG members encountered this or similar scenarios?

* Is there a better way of achieving it?

* xforms-model-construct-done, which might have previously been
  thought as a rarely used event, is actually heavily used in such
  scenarios, but it is terribly named. Can anything be done about it,
  e.g. proposing a shorter name?

* Does it make sense for XForms to standardize an action like


Received on Wednesday, 10 February 2010 17:34:59 UTC