Your achievements

Level 1

0% to

Level 2

Tip /
Sign in

Sign in to Community

to gain points, level up, and earn exciting badges like the new
BedrockMission!

Learn More

View all

Sign in to view all badges

loadXML problem

Avatar

Avatar
Level 2
dylan_vr
Level 2

Likes

0 likes

Total Posts

24 posts

Correct Reply

0 solutions
View profile

Avatar
Level 2
dylan_vr
Level 2

Likes

0 likes

Total Posts

24 posts

Correct Reply

0 solutions
View profile
dylan_vr
Level 2

01-08-2008

Hi



I have a form in which I call a web service to get XML and then take that XML and use xfa.datasets.data.loadXML(theXml,0,1) to load the xml into the DOM. The problem i'm having is that I need to hide/show pages after I load the xml but once its loaded I cant show/hide my pages. If I remove the loadXML() the pages show/hide so I know that the problem is coming from that method call, can someone help me please?



Thanks

Replies

Avatar

Avatar
Boost 500
Level 10
pguerett
Level 10

Likes

611 likes

Total Posts

7,689 posts

Correct Reply

692 solutions
Top badges earned
Boost 500
Boost 50
Boost 5
Boost 3
Boost 250
View profile

Avatar
Boost 500
Level 10
pguerett
Level 10

Likes

611 likes

Total Posts

7,689 posts

Correct Reply

692 solutions
Top badges earned
Boost 500
Boost 50
Boost 5
Boost 3
Boost 250
View profile
pguerett
Level 10

05-08-2008

Can you post a sample to livecycle8@gmail.com and I will have a look.

Avatar

Avatar
Validate 1
Level 1
shiv179
Level 1

Likes

0 likes

Total Posts

16 posts

Correct Reply

0 solutions
Top badges earned
Validate 1
View profile

Avatar
Validate 1
Level 1
shiv179
Level 1

Likes

0 likes

Total Posts

16 posts

Correct Reply

0 solutions
Top badges earned
Validate 1
View profile
shiv179
Level 1

01-06-2010

I am having the same issue!

No need for a sample form.
Just put a button and a text field on the form.

On button click, call loadXML() and then try setting the value of the text field, for example TextField1.rawValue = "test";

The TextField's value remains unchanged.

Any code that modifies form objects (setting values, hiding/showing objects, etc) is IGNORED after the call to loadXML.

I can't seem to find a suitable workaround.

Feedback much appreciated!!

Thanks,

Shiv

Avatar

Avatar
Boost 500
Level 10
pguerett
Level 10

Likes

611 likes

Total Posts

7,689 posts

Correct Reply

692 solutions
Top badges earned
Boost 500
Boost 50
Boost 5
Boost 3
Boost 250
View profile

Avatar
Boost 500
Level 10
pguerett
Level 10

Likes

611 likes

Total Posts

7,689 posts

Correct Reply

692 solutions
Top badges earned
Boost 500
Boost 50
Boost 5
Boost 3
Boost 250
View profile
pguerett
Level 10

01-06-2010

The loadXML command loads data into the dataDom. The bindings of the object are bound to nodes in the datadom. My bet is that when you issue yor loadXML command you are overwriting the current Dom and hence all of the bindings to the current object are getting clobbered and hence any changes are not what you expected. In the loadXML command there are three parameters  - the data you want to load, a bool indicating whether to ignore the root node of the xml you are trying to load and a bool that indicates whether you want to replace the current loaded nodes. So based on what you have told me so far your command should be:

xfa.datasets.data.loadXML(fieldname that holde the data.rawValue, false, false)

This will load the somedata.xml file at the root level of the datadom and will append to the existing dom.

Paul

Avatar

Avatar
Validate 1
Level 1
shiv179
Level 1

Likes

0 likes

Total Posts

16 posts

Correct Reply

0 solutions
Top badges earned
Validate 1
View profile

Avatar
Validate 1
Level 1
shiv179
Level 1

Likes

0 likes

Total Posts

16 posts

Correct Reply

0 solutions
Top badges earned
Validate 1
View profile
shiv179
Level 1

01-06-2010

Hi Paul

Thanks for the quick reply.

My command is actually: xfa.datasets.data.loadXML(payload,1,1);

payload is an XML file returned from a web service call.

Let me explain my situation:

The user fills in the form.

The data in the form is exported to XML (using the saveXML function) to a database .

The user can retrieve the data they captured previously in the form by entering a reference number and hitting Search.

A web service call is made and the XML data is retrieved from the database.

This XML file is loaded into the form using the loadXML function,

The user now has a form that looks exactly like the way they had submitted it previously... well not quite.

I want to change the text of a certain text field and also hide certain fields AFTER calling loadXML -> doesn't work!!

So there's my problem.

Any suggestions?

Thanks a mil.

Shiv

Avatar

Avatar
Boost 500
Level 10
pguerett
Level 10

Likes

611 likes

Total Posts

7,689 posts

Correct Reply

692 solutions
Top badges earned
Boost 500
Boost 50
Boost 5
Boost 3
Boost 250
View profile

Avatar
Boost 500
Level 10
pguerett
Level 10

Likes

611 likes

Total Posts

7,689 posts

Correct Reply

692 solutions
Top badges earned
Boost 500
Boost 50
Boost 5
Boost 3
Boost 250
View profile
pguerett
Level 10

01-06-2010

The parameter that holds the xml is a string ...I am assuming that you have defined a var called payload and are using that to pass the xml to the command.

Can you dump the data dom onto the screen to make sure that it is as it was before saving? You can either make a big multiline field and use this command to populate it:

fieldname.rawValue = xfa.datasets.data.saveXML("pretty")

or if there is not much data you can use app.alert(xfa.datasets.data.saveXML("pretty"))

This will allow us to see what is in the dom after the load ...we can then verify that the bindings are correct.

One other thought is that when you load the data it is not doing a mergeing of the data onto the form. You could force this by using th ecommand xfa.form.remerge()

Paul

Avatar

Avatar
Validate 1
Level 1
shiv179
Level 1

Likes

0 likes

Total Posts

16 posts

Correct Reply

0 solutions
Top badges earned
Validate 1
View profile

Avatar
Validate 1
Level 1
shiv179
Level 1

Likes

0 likes

Total Posts

16 posts

Correct Reply

0 solutions
Top badges earned
Validate 1
View profile
shiv179
Level 1

01-06-2010

The XML data that gets written to the datbase is xfa.data.saveXML();

This data is exactly the same when it gets retrieved from the web service call.

I even went into the database and pulled up the data that was written.

So the data isn't the problem!

When I call loadXML, the data does come back into the form.

However, as I have stated, I want to hide certain fields and set the value of a field, AFTER calling loadXML.

This is where my problem lies - the code afterwards gets ignored.

I have tried using xfa.form.remerge(), no difference!

I have tried juggling code inbetween different events (exit event of the button that was clicked, for example), but it still doesn't work.

I have tried putting code in a function and calling that function, still nothing!!

I really need to be able to manipulate form objects AFTER calling loadXML.

Please can you find a workaround or a solution to my problem?

Many Thanks,

Shiv

Avatar

Avatar
Boost 500
Level 10
pguerett
Level 10

Likes

611 likes

Total Posts

7,689 posts

Correct Reply

692 solutions
Top badges earned
Boost 500
Boost 50
Boost 5
Boost 3
Boost 250
View profile

Avatar
Boost 500
Level 10
pguerett
Level 10

Likes

611 likes

Total Posts

7,689 posts

Correct Reply

692 solutions
Top badges earned
Boost 500
Boost 50
Boost 5
Boost 3
Boost 250
View profile
pguerett
Level 10

02-06-2010

If you can send me the form and a sample data file I will see what I can do.

Send it to LiveCycle8@gmail.com

Please include a reference back to this forum post so I know what it is you are looking for.

Paul

Avatar

Avatar
Validate 1
Level 1
shiv179
Level 1

Likes

0 likes

Total Posts

16 posts

Correct Reply

0 solutions
Top badges earned
Validate 1
View profile

Avatar
Validate 1
Level 1
shiv179
Level 1

Likes

0 likes

Total Posts

16 posts

Correct Reply

0 solutions
Top badges earned
Validate 1
View profile
shiv179
Level 1

03-06-2010

Hi pguerett

I have sent a mail to you.

Thanks for your asistance!

Regards,

Shiv

Avatar

Avatar
Validate 1
Level 2
Don400
Level 2

Likes

2 likes

Total Posts

44 posts

Correct Reply

1 solution
Top badges earned
Validate 1
Boost 1
Affirm 1
View profile

Avatar
Validate 1
Level 2
Don400
Level 2

Likes

2 likes

Total Posts

44 posts

Correct Reply

1 solution
Top badges earned
Validate 1
Boost 1
Affirm 1
View profile
Don400
Level 2

14-07-2011

For anyone looking for a solution here is what worked for me:  add the line

    xfa.form.remerge();

to the form's docReady event handler section and the new data should be remerged successfully without generating any loops.