if both extracts are an exact copy of your code, it’s obvious:
you’ve created a form with the name ‘test’ but your trying to access the elements of form ‘testform’
you’ve created a form with the name ‘test’ but your trying to access the elements of form ‘testform’
And this code was running from the .js file of the testform.
from my POV I thus created an object IN testform, so that makes ‘test’ an object on the form ‘testform’.
meaning I created an object ‘test’ in ‘testform’, so I should be able to access that object from anywhere in the testform.
So I want to be able to access the ‘test’ object from whatever function or other object on the form ‘testform’.
I do come from an OOP environment and adding objects to a form there means I can access objects on a form from anywhere.
Also, a property or object on a form is not a variable
so I can code like:
// creating a variable.
local loObject as object
loObject = createObject(“form”)
a local variable is like a var in a function. only accessible in that function.
//creating an object
this.addproperty(‘oObject’, createObject(‘form’))
a property is accessible from anywhere (unless made hidden or protected).
or
thisform.newobject(“mytextbox”,“MyTextBoxClass”,“”,“param 1”, param nn")
In any method of the form I can now access this textbox as “this.mytextbox”
From any object on the form I can access this object as thisform.mytextbox
I sure hope I am not stepping on any toes here. it seems roclasi is quite P**ed off by the way I aks my questions.
then if you created a form “test” then you can access the element through
forms['test'].elements['test']
Also when doing solutonModel.newForm() you are defining forms on a global level. it doesn’t matter where you call those
that newForm is a factory method going inside servoy, not a “normal” js object construction like:
var myobject = new Object()
The above would create a object in the current scope (in the function you are in or in the file if that is a global/form variable in the js file)
But that is not the same as solutionModel.newXXXX() those are servoy object generators on the global solution level.