Reflect xfa data updates into form fields without xfa.form.remerge()



Following the very useful sample provided here:

Re: SaveXML and LoadXML problem

I noticed that if you update the field values, then the data model is updated immediately, however, if you update the data model node values, then the bound field values are not reflected unless you execute xfa.form.remerge() or xfa.datasets.loadXML(...).

I was looking for a solution to update the data model node values on the form initialize event or load event, and all bound element values to be reflected accordingly. The purpose is to execute a web-service before data binding occurs, and load the data model with the result of the web-service, but without executing remerge() nor loadXML() since both will trigger the "init" events for all elements, and it will be a problem.

The reason for this is that we are binding the element captions to the data model (Data Connection) to implement localization for the form fields.

If this is not possible, this means the only way is to load the data with the XML Data File used to merge with the form template when the form is generated.

The other solution is to load the data using the web service, and write code to update the caption values directly. But this approach removes the abstraction layer of the data model and data binding which helps make the code easier to maintain.

Appreciate your feedback.


Accepted Solutions (0)