Avatar

Correct answer by
Level 10

Hi Greg,

There are two types of variables (as far as I know). The first is a script variable, which you create in your script using the "var" function. Once you have created / declared it in the script, you can refer to it by its name. The str above is an example.

The second is a global variable, which is created and declared in the File / Form Properties / Variable tab. Once you have created a global variable you do not need to create it again in the script. In fact once you have created the global variable, you can see them in the hierarchy under variables. When you reference these in script you need to use the .value property in order to set and retrieve the contents of the global variable.

So the script would look something like this:

var str = this.rawValue;

try{

     if(!js.isEmpty(this.rawValue))

     {

          fnUP.value = js.allUpper(str);

     }

}

catch(e){app.alert(e)}

Sample attached. The two extra field are just displaying the current value of the global variables. Also test this solution, because (even with the form set to automatic saving of script changes) the global variables may revert to the defaults when reopened.

Good luck,

Niall

View solution in original post