Expand my Community achievements bar.

Don’t miss the AEM Skill Exchange in SF on Nov 14—hear from industry leaders, learn best practices, and enhance your AEM strategy with practical tips.
SOLVED

Inconsistent result for my JavaScript code across different programs

Avatar

Level 1

Hi all,

At first I should say this topic is  a replica of this tread (which I did not receive any response at the time of writing this post).

I am designing my very first dynamic PDF form using Adobe LiveCycle Designer ES4 v11 and in my form I have two SUM field which is nothing more than a simple total calculation. One of them is the pure SUM of PRICE column, the other is the SUM of PRICE column whenever another drop-down menu is set to NO.

The problem is I get inconsistent result when I open my form in different application. For instance, if I open my form in Acrobat Reader DC, I get following results (with some imaginary figures):

1.jpg

Above is what I want to see across all PDF softwares. However, when I open the same document in another software like PDF Xchange Editor v7.0, I get following result for the same input figures (note the first total field is shown as $0.00 this time):

2.jpg

Similarly, I tested my form in Bluebeam Revu Standard 2017.0.30 as well and here is what I get:

3.jpg

For the sake of argument, here is the JavaScript code I use for my SUM foeld Calculate event:

var num = 0,  rowList = xfa.resolveNodes("MainTableSubform.Table1.DataRow[*]"); 

for (var i = 0; i< rowList.length; i++){ 

    if (!rowList.item(i).PriceTextCell.isNull && parseFloat(rowList.item(i).PriceTextCell.rawValue) != 0) { 

        num += parseFloat(rowList.item(i).PriceTextCell.rawValue); 

    } 

this.rawValue = parseFloat(num);


and

var num = 0,  rowList = xfa.resolveNodes("MainTableSubform.Table1.DataRow[*]"); 

for (var i = 0; i< rowList.length; i++){ 

    if (!rowList.item(i).HiddenPriceCell.isNull && parseFloat(rowList.item(i).HiddenPriceCell.rawValue) != 0) { 

        num += parseFloat(rowList.item(i).HiddenPriceCell.rawValue); 

    } 

this.rawValue = parseFloat(num);

Codes are pretty much copy and paste of one another.

I wonder why do I get different result trying to use my form in different applications? Any idea?

1 Accepted Solution

Avatar

Correct answer by
Level 10

Hi there,

I understand your issue, but PDF can be constructed in many different ways. (Static, image, dynamic) It all depends on the software reading the PDF if they fully support the XFA based PDF... It is not PDF that is not portable, it's the other software that should update their compatibility with Dynamic XFA based PDF.

Tracker Software Products :: Knowledge Base :: Why can't I open my file in PDF-XChange Viewer? I get...

Bluebeam Revu Release Notes | Revu 2016 & Above

By reading the software compatibility of the two software you have mentioned, it seems like both does not fully support XFA-based forms. It looks like they are still working on enhancing the software for XFA based compatibility. Say if your PDF is working on Adobe Reader, but not working with another software, then you may conclude that the other software lack of compatibility with JavaScript or XFA-based form at this moment.

Unfortunately, I'm only explaining based on my experience and what I read about other software.

I can't test with the software you have mentioned.

View solution in original post

5 Replies

Avatar

Level 10

Hi there,

First of all, other software than Adobe products tend to be unfamiliar with XFA dynamic forms compatibility... When creating XFA dynamic forms I always inform users to always use Adobe Reader and preferably the latest version available.

So in regards to compatibility, you might want to try other approaches to end up with the same result... instead of doing resolveNodes, try to use resolveNode each time you get through the loop... Try using the "!=" comparison operator with null value instead of isNull. Maybe using FormCalc will have better results as well...

These are only suggestions, hopefully, there's a solution to this... unfortunately I can't help the testing.

Good luck

Avatar

Level 1

Thanks for your reply.

Hmmm. Last time I checked PDF stands for Portable Document Format. From what you replied, I gathered it's not portable anymore as it is only bound to Adobe products.

Switching to Formcalc is not an option now as I have so much code in JS already. Plus my company does not use Acrobat Reader.

I also try your other suggestions re- resolveNode and != but I am afraid they did not change anything in terms of odd results explained in first post

Avatar

Correct answer by
Level 10

Hi there,

I understand your issue, but PDF can be constructed in many different ways. (Static, image, dynamic) It all depends on the software reading the PDF if they fully support the XFA based PDF... It is not PDF that is not portable, it's the other software that should update their compatibility with Dynamic XFA based PDF.

Tracker Software Products :: Knowledge Base :: Why can't I open my file in PDF-XChange Viewer? I get...

Bluebeam Revu Release Notes | Revu 2016 & Above

By reading the software compatibility of the two software you have mentioned, it seems like both does not fully support XFA-based forms. It looks like they are still working on enhancing the software for XFA based compatibility. Say if your PDF is working on Adobe Reader, but not working with another software, then you may conclude that the other software lack of compatibility with JavaScript or XFA-based form at this moment.

Unfortunately, I'm only explaining based on my experience and what I read about other software.

I can't test with the software you have mentioned.

Avatar

Level 10

I'd say try using app.alert(); at some places in your code to display what value you're able to retrieve on each program see if it is similar and try different approaches maybe... also test each javascript functionality you are using inside of a button to see if they work distinctly.

Avatar

Level 1

You are quite right. After updating PDF Xchange Editor program, issue was resolved. It looks like their software development team had addressed some known XFA glitches in a recent minor update.

Thanks for your time and assistance.