ReferenceError

Hello,

recently I am getting reference errors once in a while. The object in question does exist. The method that throws this error is attached to the onShow event of a form. The error occurs only the first time the form is shown.

My impression is that this only happens if a form has been duplicated. Any ideas, anyone?

Thanks
Patrick

ReferenceError: “bgcolor_liste_aktuell” is not defined. (_formOnShow; line 2)ReferenceError: “bgcolor_liste_aktuell” is not defined. (_formOnShow; line 2)
at org.mozilla.javascript.NativeGlobal.constructError(NativeGlobal.java:580)
at org.mozilla.javascript.NativeGlobal.constructError(NativeGlobal.java:540)
at org.mozilla.javascript.ScriptRuntime.name(ScriptRuntime.java:1102)
at org.mozilla.javascript.Interpreter.interpret(Interpreter.java:2003)
at org.mozilla.javascript.InterpretedFunction.call(InterpretedFunction.java:94)
at com.servoy.j2db.scripting.e.call(Unknown Source)
at com.servoy.j2db.develop.debugger.k.a(Unknown Source)
at com.servoy.j2db.develop.debugger.k.executeFunction(Unknown Source)
at com.servoy.j2db.FormPanel.a(Unknown Source)
at com.servoy.j2db.FormPanel.a(Unknown Source)
at com.servoy.j2db.FormPanel.a(Unknown Source)
at com.servoy.j2db.FormPanel.co(Unknown Source)
at com.servoy.j2db.dataui.l$1.run(Unknown Source)
at java.awt.event.InvocationEvent.dispatch(Unknown Source)
at com.servoy.j2db.util.SwingHelper.dispatchEvents(Unknown Source)
at com.servoy.j2db.scripting.JSApplication.js_updateUI(Unknown Source)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
at java.lang.reflect.Method.invoke(Unknown Source)
at org.mozilla.javascript.NativeJavaMethod.call(NativeJavaMethod.java:289)
at org.mozilla.javascript.ScriptRuntime.call(ScriptRuntime.java:1242)
at org.mozilla.javascript.Interpreter.interpret(Interpreter.java:1942)
at org.mozilla.javascript.InterpretedFunction.call(InterpretedFunction.java:94)
at com.servoy.j2db.scripting.e.call(Unknown Source)
at org.mozilla.javascript.ScriptRuntime.call(ScriptRuntime.java:1242)
at org.mozilla.javascript.Interpreter.interpret(Interpreter.java:1942)
at org.mozilla.javascript.InterpretedScript.call(InterpretedScript.java:68)
at org.mozilla.javascript.NativeGlobal.evalSpecial(NativeGlobal.java:517)
at org.mozilla.javascript.ScriptRuntime.callOrNewSpecial(ScriptRuntime.java:1258)
at org.mozilla.javascript.ScriptRuntime.callSpecial(ScriptRuntime.java:1298)
at org.mozilla.javascript.Interpreter.interpret(Interpreter.java:1909)
at org.mozilla.javascript.InterpretedFunction.call(InterpretedFunction.java:94)
at com.servoy.j2db.scripting.e.call(Unknown Source)
at com.servoy.j2db.develop.debugger.k.a(Unknown Source)
at com.servoy.j2db.develop.debugger.k.executeFunction(Unknown Source)
at com.servoy.j2db.FormPanel.a(Unknown Source)
at com.servoy.j2db.FormPanel.a(Unknown Source)
at com.servoy.j2db.FormPanel.a(Unknown Source)
at com.servoy.j2db.FormPanel.cw(Unknown Source)
at com.servoy.j2db.FormPanel.a(Unknown Source)
at com.servoy.j2db.FormPanel.a(Unknown Source)
at com.servoy.j2db.FormPanel.valueChanged(Unknown Source)
at com.servoy.j2db.util.gui.q.a(Unknown Source)
at com.servoy.j2db.util.gui.q.a(Unknown Source)
at com.servoy.j2db.util.gui.q.a(Unknown Source)
at com.servoy.j2db.dataprocessing.g.setSelectedIndex(Unknown Source)
at com.servoy.j2db.dataprocessing.FoundSet.js_setSelectedIndex(Unknown Source)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
at java.lang.reflect.Method.invoke(Unknown Source)
at org.mozilla.javascript.NativeJavaMethod.call(NativeJavaMethod.java:289)
at org.mozilla.javascript.ScriptRuntime.call(ScriptRuntime.java:1242)
at org.mozilla.javascript.Interpreter.interpret(Interpreter.java:1942)
at org.mozilla.javascript.InterpretedFunction.call(InterpretedFunction.java:94)
at com.servoy.j2db.scripting.e.call(Unknown Source)
at com.servoy.j2db.develop.debugger.k.a(Unknown Source)
at com.servoy.j2db.develop.debugger.k.access$14(Unknown Source)
at com.servoy.j2db.develop.debugger.k$3.run(Unknown Source)
at java.awt.event.InvocationEvent.dispatch(Unknown Source)
at java.awt.EventQueue.dispatchEvent(Unknown Source)
at java.awt.EventDispatchThread.pumpOneEventForHierarchy(Unknown Source)
at java.awt.EventDispatchThread.pumpEventsForHierarchy(Unknown Source)
at java.awt.EventDispatchThread.pumpEvents(Unknown Source)
at java.awt.EventDispatchThread.pumpEvents(Unknown Source)
at java.awt.EventDispatchThread.run(Unknown Source)

you where running the first method from the method editor?
Then you are setting a selected index on one form. That is triggering a record selection changed method.
In that method you call other methods that eventually calls a updateUI that runs another method that normally should run AFTER the current call is done. So i would first say please remote that updateUI call. That is a call that must be very carefully dealt with! Because that can influence that order behaviour of the methods…

Hello Johan,

I am not sure I understood you. I can explain where this happens:

A form has a two panels. One shows a navigation form, the other has several tabs for content. On the navigation form you see a list of records that represent menu items. You click on a record and a method gets evaluated that is stored in the menu table. This method basically jumps to a certain tab on the content tab.

The content where this happens has another tab panel with three tabs. The first on has an onShow method that does this:

elements.bgcolor_liste_aktuell.bgcolor = bgcolor_liste_aktuell

It sets the background color of a field to the color stored in the field.

This is where I get

ReferenceError: “bgcolor_liste_aktuell” is not defined.

I hope you understood the trigger sequence that leads to this.

Once that error is thrown, it never occurs again. Every other onShow fired by that form goes without this error.

hmm but the question is what is not found?
The element or the dataprovider?
Can you rename the elements name so that we can see the difference?

If I do that it seems to be the dataprovider,

still i think the problem is youre applicaiton.updateUI call
can you remove it and then recheck it?