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
Bedrock Mission!

Learn more

View all

Sign in to view all badges

SOLVED

how do I add "code" to field...

Avatar

Level 2

I'm lost here, I use LiveCycle Designer ES and I'm trying to fix few fields to interact with each other in pdf. I've studied few examples, calculation field has marked in value tab "Calculated - Read Only" and code is added in Script editor (Ctrl+Shift+F5)

What I am trying to do is add two numbers inserted by user and display score in third field. I've created 3 "Numeric Fields" named:

NumericField1

NumericField2

NumericField3

last ones value is set to "Calculated- Read Only".

I mark last field and go to script editor (ctrl+shift+f5 or window->script editor)

there I set language for Java Script (which is enabled btw) and I put either seen in some AA9pro examples (like holidays chart)

Sum(NumericField1, NumericField2);

or seen in adobe javascript tutorial

var f = this.getField("NumericField1");

var g = this.getField("NumericField2");

event.value = f.value + g.value;  //or NumericField3 instead of event.value

none of these couses any errors in syntax checker and none of this works. What do I do wrong?

Please advice.

1 Accepted Solution

Avatar

Correct answer by
Level 4

Hi

Let Val1 , val2, Val3 are three Numeric fields  fields .

then script Editor ,

In Javascript ,

val3.rawValue = val1.rawValue + val2.rawValuwe ;

thats it . Try Good Luck .

View solution in original post

3 Replies

Avatar

Correct answer by
Level 4

Hi

Let Val1 , val2, Val3 are three Numeric fields  fields .

then script Editor ,

In Javascript ,

val3.rawValue = val1.rawValue + val2.rawValuwe ;

thats it . Try Good Luck .

Avatar

Level 10

Since you set the 3rd Numeric field value to Calculated-Read Only, then you should place your code in the Calculate event of the 3rd Numeric field.

Try placing the below line of code in the Calculate event and set the language to FormCalc instead of Java script in the Script window. (Sum is a function supported in FormCalc).

Sum(NumericField1, NumericField2);

Thanks

Srini