This is the case:
- Create an application, lets say a control or grid application.
- Go to onScriptInit event and put the following code:
?>
<script type="text/javascript">
var letterIndex = 0;
var competenceLetter = ["A", "B", "C", "D", "E"];
function letter(){
var letra = '';
if (letterIndex == 5){
letterIndex = 0;
}
letra = competenceLetter[letterIndex];
letterIndex ++;
return letra;
}
</script>
<?php
When you run the application, the following error is displayed: “undefined global variable: competenceLetter;”
Debugging the “error” I have found that this line letra = competenceLetter[letterIndex] is the root cause. ScriptCase thinks that letterIndex var is not initialized at the moment of passing it as an index in the array. The code is actually correct, works in blank application and standalone php/javascript project.
Other references:
Looks like this bug has been reported before at 2012, not use if something was done at that moment.