Expand my Community achievements bar.

Guidelines for the Responsible Use of Generative AI in the Experience Cloud Community.

Can't call ScriptObject function after xfa.host.importData()

Avatar

Level 2

I have a button with a click event in which I first call a function from the ScriptObject Helper, the subsequently I perform the importData() command and after that is done I do a recall of the same function in the ScriptObject helper.

The first call works,

then the dialog to import xml data works and gets imported

but then the new call fails with error that the Helper does not exists.

See screenshots.

Screenshot 2021-02-10 at 16.55.56.pngScreenshot 2021-02-10 at 16.56.19.png

Can somebody explain and maybe give a solution?

I want to hide the Import button after a successful import.

Thnx in advance!

5 Replies

Avatar

Level 10

It's because the import executes a remerge of the imported data with the template into a new form. It's like a start over. 

Avatar

Level 2
Thnx, but is there any event I can then use to check if the data has been loaded? doc:ready, form:ready or anything else?

Avatar

Level 10
No. The remerge clears all existing scriptings from the memory. So you can call a script after. Also, the importData() method doesn't return a value you could use to verify if it has been executed successfully or been aborted. The imported data is loaded into the form, so you can see it directly in the form fields.

Avatar

Level 10

You can try antoher approach. This solution works different to the importData() method.
https://thelivecycle.blogspot.com/2014/07/import-xml-via-script-into-adobe-reader.html