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

Javascript- Calculated fields from variables . event.value

Manuel Lastra
Registered: Mar 29 2009
Posts: 6
Answered

I got a problem in a calculated field

Let me put an example:

1.- I define var A and assign it a value "100" through a javascript asociated to a button

var A = "100";

2.- I create a calculated field B and I want assign it the A value using the formula

event.value=A.value

however I get an "undefined" value.

Could you help me?

Thanks in advance

My Product Information:
Acrobat Pro Extended 9.1.1, Windows
gkaiseril
Online
Expert
Registered: Feb 23 2006
Posts: 4308
A "variable" is not an "object". An "objet" will have properties and methods, one of which is a "value". A variable is just that a variable and the only propterties or methods associated with it are those that are available to the "type of" for the value of the variable, for example, a stirng can have a length.

var A = "100"; console.println("A: " + A);console.println("typeof A: " + (typeof A));console.println("A.length: " + A.length);console.println("isNaN(A): " + isNaN(A) );console.println("Nubmer(A): " + Number(A));console.println("typeof Number(A): " + typeof Number(A));console.println("Number(A).length: " + Number(A).length); event.value = A;

George Kaiser

Manuel Lastra
Registered: Mar 29 2009
Posts: 6
Thanks gkaiseril, it works perfectly.
Now I realized that I have to learn a lot about javascript.

best regards

Manuel