Submission processing

Mark Birbeck's picture

The submission element is not an action handler, or a form control, but a collection of attributes that guide: how to obtain some data to be sent, whether to validate it first, how to transport the data, what to do with any data that is returned, and so on.

Submission should therefore be seen as a series of phases, with the various attributes controlling what happens at each step of the process:

  1. dispatching of the xforms-submit event to indicate that sending data is about to begin;
  2. selection of the fragment of data to be sent;
  3. validation of the data;
  4. serialisation of the data into a format that can be transferred;
  5. initiation of the data transfer;
  6. if running asynchronously, then the submission returns at this point, and other processing continues until the transfer is complete. If running synchronously, then processing is paused until the transfer is complete;
  7. when the transfer is complete, the returned data is checked for errors;
  8. if there are no errors then the data is placed in the target location, and xforms-submit-done is dispatched;
  9. if there are errors, nothing happens to the data, and xforms-submit-error is dispatched.

Note that if new data arrives and is placed in a target, a rebuild of the model that holds the instance will be necessary.

We'll look at all of these steps in more detail in the following sections.