pp108 : xforms-onbeforesynchronize

xforms-onbeforesynchronize

This event is fired before the data (businessObject) changed in the HTML is synchronized with the backend.

Event Information

To invoke

Modify the data displayed in the UI, and click the Save button or call the synchronize() method of the model to synchronize the modifications with the backend.

Default Action

Appends the update requests in the request body, prepares the request, and initiates any action associated with this event. Sends the request to the back end based on the returnValue property set by the user on the event object.

Named Script

xforms-onbeforesynchronize

Event Object Properties

Property

Description

updateDocument

Object that denotes the complete update document that is to be sent to the back end for synchronization.

returnValue

Boolean that denotes whether the data is to be synchronized with the back end or not.

  • true: Default. Data will be synchronized with the back end.
  • false: Data will not be synchronized with the back end.

removeAggregation

Boolean that denotes whether the aggregated business elements (data or business elements that are part of a different business object) are to be removed or not, before synchronizing with the back end.

  • true: Aggregated business elements will be removed. Synchronization with the back end will take place successfully.
  • false: Default. Aggregated business elements will not be removed. Saving the request will result in an error.

An event handler can access the event object and its properties through the eventObject available as a parameter on the handler.

Remarks

The xforms-onbeforesynchronize event applies only for models that have transactional data. For a non-transactional model, it does not apply.

Example

This sample code demonstrates how the method can be used.

function EmployeesModel_xformsonbeforesynchronize(eventObject)
{
 //Confirm for saving from the user
 eventObject.returnValue = (confirm("Are you sure you want to synchronize the data to the backend?"));
}

Applies to

Model, synchronize()