These forums are now Read Only. If you have an Acrobat question, ask questions and get help from one of our experts.

Stupid question about fields sum

clueless1942
Registered: Jun 14 2010
Posts: 23
Answered

Hello,

I'm just starting to learn JS, to make some simple scripts for my PDF presentations and forms.

I'm trying to sum different values from a couple of dropdown lists, and showing it in another field:

xfa.resolveNode("form1.page1.NumericField3").rawValue = xfa.resolveNode("form1.page1.DropDownList2").rawValue + xfa.resolveNode("form1.page1.DropDownList3").rawValue + xfa.resolveNode("form1.page1.DropDownList4").rawValue;

I think it is treating the values as strings, cause if the values are 2, 3, 4 the sum field displays 234.

What am I doing wrong?

And: where is the best (free) document to start learning JS from the basics?

Thank you

PS: Sorry about my poor english, in case I made some bad spelling.

gkaiseril
Expert
Registered: Feb 23 2006
Posts: 4308
There is a special forum for LiveCycle Designer forms, and it appears from the code that you are using LiveCycle Designer.

LiveCycle Designer has the 'Sum()' function that returns the sum of the non-null elements of a given set of numbers. You have to be aware that a 'null' value is treated as a string and not the number zero.

George Kaiser

clueless1942
Registered: Jun 14 2010
Posts: 23
Ok, thank you, [b]gkaiseril[/b].

It's true, I'm using Livecycle Designer, but I though that my question was more appropiate for this subforum, as it is script related.

I will post there instead. Thanks.