Get the last focus





Is there a possiblity to check within a click event of a button the field that got the focus before clicking on the button?

Thank you in advance!





You will have to create a variable with a document level scope and save the field name into this variable as each field losses focus.



From LiveCycle Scripting Basics, available form the documentation pages.

To define a text variable

1. Select File > Form Properties.

2. In the Variables tab, click New (Insert) .

3. In the Variables list, type a unique name for the variable and press Enter. Variable names are

case-sensitive and should not contain spaces.

4. Click once in the box to the right and type the text you want to associate with the variable.

The variable appears in the Hierarchy palette at the form level.

Using variables in calculations and scripts

After you have created form variables, you only need to reference the variable name in your calculations and scripts in order to obtain the value of the variable.

Caution: When naming variables, you should avoid using names that are identical to the names of any XML Form Object Model properties, methods, or object names. For information about XML Form Object Model properties, methods, and objects, see the Adobe XML Form Object Model Reference at www.adobe.com/devnet/livecycle/designing_forms.html.

For example, create the following form variable definitions.

New form variable

Variable name Value

firstName Tony

lastName Blue

age 32

In FormCalc, you can access the variable values in the same manner that you access field and object values. In this example, the values are assigned to three separate fields:

TextField1 = firstName

TextField2 = lastName

NumericField1 = age

You can also use variables in FormCalc functions in the same way, as shown in this example:

Concat( "Dear ", firstName, lastName )

In JavaScript, you reference variable values by using the .value property instead of the .rawValue property that is used for field and object values, as shown in this example:

TextField1.rawValue = firstName.value;

See the following links for more documentation about LiveCycle Designer: