I'm trying to convert my current solution to servoy 6.
My code is as followed, the on_action is of a button on a form:
- Code: Select all
/**
* @properties={typeid:35,uuid:"416806F7-2E66-4599-A3AB-2E5453438994",variableType:-4}
*/
var testArray = null;
/**
* Perform the element default action.
*
* @param {JSEvent} event the event that triggered the action
*
* @properties={typeid:24,uuid:"11AFE23C-EEBA-43E8-ABAF-8DCD205C0F74"}
*/
function onAction(event)
{
testArray = new Array();
testArray[-999999] = "hello";
testArray[1] = "Hello to you";
// ex 1) Execute simple Client-Side Javascript (Web-Client only)
var jsToExecute = "alert('"+testArray[-999999]+"');";
plugins.WebClientUtils.executeClientSideJS(jsToExecute);
// ex 1) Execute simple Client-Side Javascript (Web-Client only)
var jsToExecute = "alert('"+testArray[1]+"');";
plugins.WebClientUtils.executeClientSideJS(jsToExecute);
}
The first time i click the button, the code works.
The second time i click the button, it breaks on 'testArray = new Array();' with the following error:
- Code: Select all
-999999
Wrapped java.lang.ArrayIndexOutOfBoundsException: -999999 (C:\Servoy_Workspaces_6\TestSol\forms\test.js#17)
at C:\Servoy_Workspaces_6\TestSol\forms\test.js:17 (onAction)
I don't understand why?
What do I have to change to get this working in servoy 6?