Obtaining data from a submission that's in error

Paul Butcher's picture

Some services return non-successful HTTP status codes, but still expect the client to respond to the body of the response. For example, a SOAP request to add a new customer to a database might return an HTTP 500 code to indicate that the customer already exists, but the actual body of the response might be perfectly usable XML.

Since XForms discards returned data when there is a submission error, and classes HTTP 500 as an error, we have introduced the instance-error attribute on submission.

The instance-error attribute is an IDREF, pointing to an instance in the host document. If no instance-error attribute is present on that submission then processing continues as normal for xforms-submit-error.

However, when an error response is received from a formsPlayer submission with an instance-error attribute, one of the following things may happen:

  1. If the instance-error attribute does not refer to a real instance, processing continues as defined in the XForms spec.
  2. If an instance-error attribute points to an instance in the document:
    • if the response is XML, the response XML is loaded into that instance replacing the existing contents;
    • if the response is not XML, the instance is replaced with a document containing a root element of instanceData, which contains the response data as CDATA.

This feature is available from version 1.5.0.1030 onwards.

Post new comment

The content of this field is kept private and will not be shown publicly.
CAPTCHA
This question is for testing whether you are a human visitor and to prevent automated spam submissions.