Migrating from Servoy 4 to Servoy 5 we got some warnings like:
“Event parameter(s) is passed to event method, make sure it is used with right type (change method signature).”
These warnings look like all based on Methods where “arguments” are used.
Example:
var newValue = arguments[1]
Any idea what to change or whats wrong?
Many Thanks
Thomas
if you have a method that is used by a button onclick event (or any other ui event like focus,double click doesnt matter)
and you use in that method arguments[1] then that is normally because you also reuse that method for something else where you give it parameters.
There are some exceptions where servoy already gives you some arguments (like form onshow) then that would be ok.
Best thing to do is look where the method is called in the event and let that event generate a new test method, then you see the arguments that servoy will give you
and you can change your method signature to have the right parameters.
Thank you, but where can I change the method signature ?
Hi Thomas,
In Servoy 5 you can now add parameters in the method function like so:
function myMethod(param1,param2) {
// your code
}
This is the equivalent of:
function myMethod() {
var param1 = arguments[0];
var param2 = arguments[1];
// your code
}
So putting them in the function signature it will declare them and hold the proper values.
Hope this helps.