pbakker:
I guess in your example, the name would be ‘onLoad’
But as Patrick points out, it looks like you didn’t get a proper reference to the JSForm…
Paul
Heres what I get from the _jsForm property: com.servoy.j2db.scripting.solutionmodel.JSForm@9c3a21
So I dont think its null? Using this loop I can get it (thanks McCourt…)
var _jsForm = solutionModel.getForm(formName)
//application.output(_jsForm)
var methods = _jsForm.getFormMethods()
methods.forEach(function(x){if (x.getName()=='onLoad')
{
onLoadFound = true
application.output('On Load Found')}})
var _jsForm = solutionModel.getForm(formName)
//application.output(_jsForm)
var method = _jsForm.getFormMethod('onLoad');
if (method)
{
application.output("I load, therefore I am");
}
else
{
application.output("onLoad does not exist.");
}
It is not “solution model code”. But couldn’t you use this anyway:
Code: Select all
if (!forms[_jsForm].onLoad)
Regards
Birgit
That would be a possibility, but this thread is more or less a spin-off of another thread…
The initial problem was a performance issue when looping through forms using the forms[_form] syntax.
This way all forms are touched, thus loaded, which caused the performance problem.