# "solutionModel" is not defined

**URL:** <https://forum.servoy.com/t/solutionmodel-is-not-defined/18222>\
**Category:** Classic Servoy\
**Created:** [October 20, 2014, 2:37pm UTC](https://forum.servoy.com/t/solutionmodel-is-not-defined/18222 "2014-10-20T14:37:37Z")\
**Posts on this page:** 8\
**Page:** 1

<div class="post-metadata">

**Author:** ![stefanoni](https://avatars.discourse-cdn.com/v4/letter/s/bb73d2/32.png) [@stefanoni](https://forum.servoy.com/u/stefanoni)\
**Post date:** [October 20, 2014, 2:37pm UTC](https://forum.servoy.com/t/solutionmodel-is-not-defined/18222/1 "2014-10-20T14:37:37Z")

</div>

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)

---

<div class="post-metadata">

**Author:** ![jcompagner](https://yyz2.discourse-cdn.com/flex010/user_avatar/forum.servoy.com/jcompagner/32/4889_2.png) [@jcompagner](https://forum.servoy.com/u/jcompagner)\
**Post date:** [October 23, 2014, 7:34am UTC](https://forum.servoy.com/t/solutionmodel-is-not-defined/18222/2 "2014-10-23T07:34:08Z")

</div>

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

What 3th party plugins/beans are you using?

---

<div class="post-metadata">

**Author:** ![stefanoni](https://avatars.discourse-cdn.com/v4/letter/s/bb73d2/32.png) [@stefanoni](https://forum.servoy.com/u/stefanoni)\
**Post date:** [November 5, 2014, 2:51pm UTC](https://forum.servoy.com/t/solutionmodel-is-not-defined/18222/3 "2014-11-05T14:51:36Z")

</div>

No 3th party plugins/beans …

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

---

<div class="post-metadata">

**Author:** ![jcompagner](https://yyz2.discourse-cdn.com/flex010/user_avatar/forum.servoy.com/jcompagner/32/4889_2.png) [@jcompagner](https://forum.servoy.com/u/jcompagner)\
**Post date:** [November 6, 2014, 12:20pm UTC](https://forum.servoy.com/t/solutionmodel-is-not-defined/18222/4 "2014-11-06T12:20:35Z")

</div>

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)

---

<div class="post-metadata">

**Author:** ![stefanoni](https://avatars.discourse-cdn.com/v4/letter/s/bb73d2/32.png) [@stefanoni](https://forum.servoy.com/u/stefanoni)\
**Post date:** [November 10, 2014, 11:34am UTC](https://forum.servoy.com/t/solutionmodel-is-not-defined/18222/5 "2014-11-10T11:34:14Z")

</div>

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 ?

---

<div class="post-metadata">

**Author:** ![jcompagner](https://yyz2.discourse-cdn.com/flex010/user_avatar/forum.servoy.com/jcompagner/32/4889_2.png) [@jcompagner](https://forum.servoy.com/u/jcompagner)\
**Post date:** [November 10, 2014, 12:24pm UTC](https://forum.servoy.com/t/solutionmodel-is-not-defined/18222/6 "2014-11-10T12:24:26Z")

</div>

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

---

<div class="post-metadata">

**Author:** ![stefanoni](https://avatars.discourse-cdn.com/v4/letter/s/bb73d2/32.png) [@stefanoni](https://forum.servoy.com/u/stefanoni)\
**Post date:** [November 10, 2014, 4:15pm UTC](https://forum.servoy.com/t/solutionmodel-is-not-defined/18222/7 "2014-11-10T16:15:13Z")

</div>

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

---

<div class="post-metadata">

**Author:** ![jcompagner](https://yyz2.discourse-cdn.com/flex010/user_avatar/forum.servoy.com/jcompagner/32/4889_2.png) [@jcompagner](https://forum.servoy.com/u/jcompagner)\
**Post date:** [November 10, 2014, 5:00pm UTC](https://forum.servoy.com/t/solutionmodel-is-not-defined/18222/8 "2014-11-10T17:00:27Z")

</div>

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)
