With Servoy 5.1, you need to name the parameters in the method signature, so instead of doing this:
function uploadMethod() {
var v_documentsid = arguments[0];
var v_version_number = arguments[1];
// do your stuff
}
you should write it this way:
function uploadMethod(v_documentsid, v_version_number ) {
// do your stuff
}
This is much cleaner, concise and less error prone, it will help reading your methods, and you can also add jsdocs to the header of your methods this way:
/**
* This method does some stuff...
*
* @param (Integer) v_documentsid the id of the document which represent this or that...
* @param (String) v_version_number the version number, used to do that or the other...
* @return something
*/
function uploadMethod(v_documentsid, v_version_number ) {
// do your stuff
}
Then you will benefit from code completion everywhere in Servoy, and when you type yourForm.uploadMethod, it will show you your comments and the parameters that are to be passed to the method.
And you can even generate html documentation out of it (see my JSDocPlugin for this)!
function uploadMethod() {
var v_documentsid = arguments[0];
var v_version_number = arguments[1];
// do your stuff
}
that means that you should now do this:
function uploadMethod(event, v_documentsid, v_version_number) {
// do your stuff
}
because this is a function that is attached to a ui elements event. So servoy will now give you a JSEvent parameter with some info about the call.
in other words: arguments[0] != always what you expect (that v_documentsid) !!