Expand my Community achievements bar.

SOLVED

How to add two numeric fields in livecycle es2

Avatar

Former Community Member

Hi I have created a form in es2.

I have two fields both numberic t1 and t2. I want to add the total of t1 and t2 and the total to appear in the 3rd field tot.

so on the calculate using javascript i tried this

topmostSubform.Page1.tot::calculate - (JavaScript, client)

var

ad1 = this.getField("t1").rawValue;

var

ad2 = this.getField("t2").rawValue;

var

total = ad1+ ad2;

tot

=total;

// where tot is the name of the 3rd numeric field

but this doesn't work. I'll really appreciate if some one can tell me what would be the correct code for this.

1 Accepted Solution

Avatar

Correct answer by
Level 10

Hi,

this.getField() is core/AcroForm javascript. The syntax in LC Designer javascript is different.

Try this javascript in the calculate event of tot:

tot.rawValue = ad1.rawValue + ad2.rawValue;

.rawValue access (and sets) the value of an object.

Good luck,

Niall

View solution in original post

1 Reply

Avatar

Correct answer by
Level 10

Hi,

this.getField() is core/AcroForm javascript. The syntax in LC Designer javascript is different.

Try this javascript in the calculate event of tot:

tot.rawValue = ad1.rawValue + ad2.rawValue;

.rawValue access (and sets) the value of an object.

Good luck,

Niall