Expand my Community achievements bar.

Guidelines for the Responsible Use of Generative AI in the Experience Cloud Community.

LiveCycle Designer ES2 global variable manipulation trouble

Avatar

Level 1

I'm using LiveCycle Designer ES2.  I've created a global form variable and would like to increment and decrement it based on the state of many checkboxes across many subforms.  Ultimately, a script on a button will query the value of this variable and decide whether to display one or more objects.  I can't seem to get the variable to update (increment/decrement) and was hoping someone could give me some pointers on getting this done properly.  Thanks in advance for your help.

Chuck

1 Reply

Avatar

Level 7

How are you setting the variable? You could be able to set the variable by doing the following:

variableName.value = "value";

Note that all variables are strings. So to do arithmetic, you must cast the variable to a number then cast back to a string prior to assignment.

//increment variableName by one

variableName.value = (parseInt(variableName.value) + 1) + "";

Also note that variables do not retain their state when a form is saved in Acrobat / Reader, so it cannot be relied on for forms that can be saved and revisited.