Getting value from an XML file and adding conditions to these values

Bookashade

30-10-2015

Hello,

I'm trying to get the value from an xml file and then adding conditions to those values. The code I have goes something like this:

Capture.PNG

for some reason, it is not getting the value.

If the value of the field "vehiclOfNonVehiclFlag" is V, then "N° de chassis: " should appear in the "nrSerieChassisTextField" field. If it's "N", then N° de serie should appear in the "nrSerieChassisTextField" field.

Now the field just remains empty and I have no idea how to resolve this. Here is a snap from the XML file:

xml.PNG

The field I am using, "vehiclOfNonVehiclFlag", currently has the value "V" in the xml file.

Please help

Kind regards

Accepted Solutions (0)

Answers (7)

Answers (7)

_Bruce_Robertson

MVP

05-11-2015

Hi Jens,

I might be easier if you could upload the pdf version of your form (or the XDP and XML), maybe to Google docs or somewhere, and add a link to this thread so I can have a look.

You do seem to have two ".data" element references in your expression now, one inside and one outside the resolveNode method, maybe that's all the problem is.

But without seeing the form it is hard to say for sure.

Regards

Bruce

Bookashade

05-11-2015

Hi Bruce,

I tried but the caption still remains empty, here are some more screenshots of the result:

qsdqsdqsdsdqsdzeazeaz.PNGazazezaezae.PNG

The correct xml is uploaded in adobe, so I don't know why he doesn't fill up the caption 😕

Kind regards,

Jens

_Bruce_Robertson

MVP

05-11-2015

Hi Jens,

If your value is in the data DOM you need to use something like;

xfa.datasets.data.resolveNode("publishingBatch.publishingSubRequest.functionData.vehiclOfNonVehiclFlag").value

Regards

Bruce

Bookashade

05-11-2015

Hello,

Thank you for replying!

I tried changing the code to the following, eventough without any succes:

qsdsqd.PNG

I tried solving this issue with the Action Builder, which in some cases helps, but unfortunately it does not work in this case.

Kind regards,

Jens

_Bruce_Robertson

MVP

05-11-2015

Hi,

Can you provide the code for your getElementById() method?

This approach of dynamically adding methods to the XFA objects can cause problems as unless you set the form to the old style garbage collection, clearing "Enforce Strict Scoping Rules in JavaScript" they can get removed at anytime.

And in this case it seems like you just want to use the standard resolveNode() method?

Regards

Bruce

Bookashade

30-10-2015

Additional info: The "N° de Chassis" or "N° de Serie" will appear in the left box of the text field. The right field will be filled in using a binding.