"solutionModel" is not defined

Every time I run true onShow, I do the Statements:

history.removeForm(‘main’)
solutionModel.revertForm(‘main’)

But sometimes I get this error.

Any Ideas ? Thanks !

2014-10-18 00:33:06,953 ERROR [http-8080-9] com.servoy.j2db.util.Debug - ReferenceError: “solutionModel” is not defined. (myTestApp/forms/main/onShow_main#47) [FF0159C4-C317-4CBF-AC52-77DAF5B1F511 GigDoodle]
org.mozilla.javascript.EcmaError: ReferenceError: “solutionModel” is not defined. (myTestApp/forms/main/onShow_main#47)
at org.mozilla.javascript.ScriptRuntime.constructError(ScriptRuntime.java:3772)
at org.mozilla.javascript.ScriptRuntime.constructError(ScriptRuntime.java:3756)
at org.mozilla.javascript.ScriptRuntime.notFoundError(ScriptRuntime.java:3825)
at org.mozilla.javascript.ScriptRuntime.nameOrFunction(ScriptRuntime.java:1827)
at org.mozilla.javascript.ScriptRuntime.name(ScriptRuntime.java:1758)
at org.mozilla.javascript.Interpreter.interpretLoop(Interpreter.java:1865)
at script.onShow_main(GigDoodle/forms/main/onShow_main:47)
at script.onSolutionOpen_GigDoodle(GigDoodle/scopes/globals/onSolutionOpen_myTestApp:178)
at script.onSolutionOpen(ProzedSolution/scopes/globals/onSolutionOpen:427)
at script.myDeepLink(ProzedSolution/scopes/globals/myDeepLink:408)
at org.mozilla.javascript.Interpreter.interpret(Interpreter.java:837)
at org.mozilla.javascript.InterpretedFunction.call(InterpretedFunction.java:158)
… and more …
at org.mozilla.javascript.ContextFactory.doTopCall(ContextFactory.java:406)
at org.mozilla.javascript.ScriptRuntime.doTopCall(ScriptRuntime.java:3204)
at org.mozilla.javascript.InterpretedFunction.call(InterpretedFunction.java:156)
at com.servoy.j2db.scripting.ScriptEngine.executeFunction(ScriptEngine.java:626)
at com.servoy.j2db.scripting.ScopesScope.executeGlobalFunction(ScopesScope.java:164)
at com.servoy.j2db.server.headlessclient.SolutionLoader.(SolutionLoader.java:185)
at sun.reflect.GeneratedConstructorAccessor38.newInstance(Unknown Source)
at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(Unknown Source)

that should just always be there (just like the statement just before that so “history”)

What 3th party plugins/beans are you using?

No 3th party plugins/beans …

After a reboot of the 2008 Server the message seamed to disappear …

hmm i now see it, you call on the onshow of a form “main” the remove and revert on that same form that is currently executing?
That should not even be possible i guess (history.remove should block this and return false)

you can’t or shouldn’t alter the form you are executing on, you can not remove it because it is currently in use (executing the function)

ok, the thing with history.remove I understand.

But what, if I want to change the design of the current form by solutionmodel ?
Till now, I just did all this in the onShow_main

  • solutionModel.revertForm(‘main’)
  • then running all the solutionmodell- things
  • forms.main.controller.recreateUI()

what else should I do ?
Call a function in the globals witch closes the form main,
rebuilds the form main by solutionmodell,
an then show the form main ?

i think not removing/destroying the whole form but just adjusting some ui elements and calling recreateUI() could/should work

So I know:

  • No problem to revert the current Form, no mather if the revert-statement is inside the current form (main)
  • The suggested history.removeForm is at the wrong place inside the current form, but with no negative consequences if I do it anyway
  • The suggested history.removeForm is not necessary, but the controller.recreateUI is my friend
  • “solutionModel not defined” had some other reasons, because it’s gone after a Server restart, without changing some Code

Thank you !
Alessandro

as long as the revert of the form doesn’t really revert the data layer (or script execution, so form variables of added methods that kind of stuff)

removeForm should not be used at all in this scenario

A server restart shouldn’t be needed, it could happen just once, but if you start an actual new client then that shouldn’t happen (or you hit exactly the same problem/code)