RE: Can someone explain why this global variable will not work?
[quote user="Adrian Begovich"
Hi JFulfordMS,
You need to declare the SomeDataValue variable.
FullscreenXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
var SomeDataValue = "Hello";
function OnFormLoad(executionContext) {
}
function OnFormSaved(executionContext) {
alert(SomeDataValue);
}
[/quote
The issue I was facing was that the variables were staying 'undefined'. Take the following example.
var variableOne = false;
var variableTwo = false;
function OnLoad(executionContext) {
formContext.getAttribute("my_variableOne").addOnChange(VariableOneChanged);
formContext.getAttribute("my_variableTwo").addOnChange(VariableTwoChanged);
}
function VariableOneChanged(executionContext) {
variableOne = true;
}
function VariableTwoChanged(executionContext) {
variableTwo = true;
}
function OnSave(executionContext) {
alert("VariableOne is: " variableOne);
alert("VariableTwo is: " variableTwo);
}
In this example, assume that only the variableOne field has been changed.
The output of this example would be.
VariableOne is: true
VariableTwo is: undefined