forgets my elements

I have a form that contains 61 elements. OnShow I trigger a method that makes some elements visible and others not visible. Most of the time it works OK. Under some conditions I get a message that says ‘undefined has not proerties’. When I analyze this in the debugger it is because Servoy no longer regonizes some of the elements. When I have this problem, if I look in the method editor at the list of elements it only list about ten of my 61 elements. If I restart Servoy it list all 61 of the elements. I cannot reproduce it with a small sample solution but have no trouble reproducing it in my large solution.

John McCann

it would be nice to have reproduced (large or small solution)
How do you reproduce it in youre large solution? What are the steps?

Do you have to restart the solution? What happens if you switch to design and back again and then do an extra SHIFT-F5 (refresh) in the method editor?

It would be nice if i could take a look at that solution.

Johan,

Now I am having a problem reproducing it in the developer. I still have the problem when I use the client but it is harder to track it from here. I noticed that the forms that this error comes up on had 3 things in commen.

  1. They are always displayed in a tabpanel
  2. They have many elements >50
  3. Each form had several named elements off of the visible portion of the form.

Does servoy handle elements off the visible portion of the form differently than elements on the visible portion of the form? I am suspicious that this may be what causes the problem. I deleted the elements off the visible portion of the form and next week I will let you know if this fixes the problem when we are using the client.

John McCann

no visible or not doesn’t make any difference.
If i could see it in a client then maybe i can test and see it a bit clearer.

Johan,

I noted that elements placed below the printable portion of the form do not show up in the elelments tree in the developer but elements placed to the right of the printable portion of the form do show up as elements. Still testing to be sure, if removing the elements from the non-printing portion of the form solves the original problem where elements were sometimes identified by servoy and other times forgotten. It only happens during production so you probably couldn’t reproduce it.

John McCann

Windows 2003, XP
SQL Server
2.1.2 rc1

Johan,

Removing the elements from the non-printing portion of the form did not fix the problem. Sorry for being verbose but I have spent many hours trying to figure this one out and need answers to a couple of questions.

I think the problem may have to do with the timing of the triggering of the onShow. The error occurse in the client when the server is under load and I almost never see it in the developer. I think I have two different problems.

Problem 1:
Sometimes I get an error message during execution of the onShow method that suggest servoy does not recognize an element on a form. I can restrart the client or go to another client and the same form with exactly the same data loads without error. Does Servoy have to load the arrary of elements on a form each time the form is shown? If this is the case, one interpretation of what is happening is that Servoy is running the onShow method before it is finished loading the Array of elements. The solution would be to delay trigger of onShow until the array of elements is fully loaded.

Problem 2:
When I use a tab panel to switch between two forms that are both based on the same table and same relationship and the forms share a commen foundset I sometimes get an error when the onShow triggers suggesting that [dataprovider] is not defined. [Dataprovider] is a dataprovider in a column on the table that the form is based on. Does Servoy have to load the data everytime a form is shown from a tabpanel? If this is the case then one interpretation of what is happening is that onShow is triggering before the data is loaded. If this is the case then Servoy should delay trigger of the onShow till after the form data is loaded.

Before using the solution today I forced Servoy to load the troublesome forms on startup of the solution with supression of executing the entire onShow. if(globals.IgnoreOnShow) {return;} // Probably has nothing to do with it

and I also put the following code at the top of the troublesome onShow methods.

// I thought this might hold things up till all data has loaded
while(controller.getMaxRecordIndex() == 0)
{
application.sleep(1000)
}
application.updateUI() // I thought this might force the elements to “load”

These changes seemed to supress the onShow error.

Sorry for being verbose and thanks for looking into this possible timing issue.

John McCann

I was able to reproduce problem #1 on a number of different forms by having the MS Sql Server do a full backup while I used the solution in the developer on a seperate machine. This suggest that the problem is related to the load on the server. After I got the error onShow I could go into the method editor and see that some of the elements were missing from the element treee. Even in this situation the problem was intermittant. When the backup finished I was no longer able to reproduce it in the developer. I think it is triggering onSHow prior to loading the arrary of elements.

John McCAnn

hmm
i walked through the code but can’t find any clue why this c ould happen
the elements are always made before the onload and then the onshow call!

how does onload work at youre place? what you do in onshow with the elements can you do that once also in the onload? (so don’t toch data that isn’t possible but just access an element)

This is a medical record application so I want to be able to lock records at midnight on the day they are created. So each time I show a form or select a record [I always get the error onShow and never onRecordSelectioin] I have to call a method that compares a column called date_created to the server time stamp. If the record was not created on the day it is being viewed then it locks. If it is locked I have to disable many buttons and make many of the fields Read Only. So I need the form data and the form elements to run the method.

I have one form that it hangs on rarely. This form only accesses elements and global variables.

I don’t understand why Servoy needs to keep loading the element array from the backend. Isn’t that cached? Why is this intermittant error so dependent on server load?

John McCann

there is nothing loaded from the backend that has something to do with GUI elements. Only data (the foundset) does come from the backend.

and as i said before the elements should be there at the moment off the onLoad event. That is even before onShow

What kind of form is this happening? Record/List or tableview? How is that form displayed? As the main form or in a tabpanel?
could you also try this:

application.output(elements.length)

in youre method? That should print the number of elements in the element scope/array at that time.

The only place I have seen this problem is when I display the form view within a tabpanel.

John McCann

John,

You can make a form (and ALL objects) readonly by:

controller.readOnly = true

You don’t have to loop through all items.

Unfortunatly, I want all fields except one to be read only and all buttons except on to be disabled.

John McCann

Hi John,

You still don’t have to loop through all elements. Try this code:

controller.readOnly = true
elements.myField.readOnly = false

i need to have a test case for this.

are you not by any change using controller.view?
because that will trigger a reload of the elements.

I am not using controller.view. I don’t have a simple test case and I only see the problem intermittantly when the application is used in production. I am logging the output to the clients and I have put a couple of tracers in using your application(output) trick. I think finding out which elements it knows about and which ones it has forgotten might give us some useful information. Should have more information later this week.

John McCann

Johan,

This is the ouput from the java log when the error occurs. Note the two “0.0” lines in a row. This the output.elements.length. The proper number which it comes up with most of the time is 38. The output line is contained in a script called VisibleElements which is called by a method called onShow. Does this tell you anything?

John McCann

Java Web Start 1.4.2_03 Console, started Wed Dec 08 08:35:37 PST 2004
Java 2 Runtime Environment: Version 1.4.2_03 by Sun Microsystems Inc.
Logging to file: C:\Documents and Settings\PlasticsExam2\Desktop\java_log.txt
Java Web Start 1.4.2_03 Console, started Wed Dec 08 08:35:44 PST 2004
Java 2 Runtime Environment: Version 1.4.2_03 by Sun Microsystems Inc.
Logging to file: C:\Documents and Settings\PlasticsExam2\Desktop\java_log.txt
Starting Servoy from C:\Documents and Settings\PlasticsExam2\Desktop
Servoy R2 2.1.2 build-315 on Windows XP using Java 1.4.2_03
getWebStartURL http://149.142.139.100:8080/
Destination adress set: 149.142.139.100 on port: 1099
getWebStartURL http://149.142.139.100:8080/
getWebStartURL http://149.142.139.100:8080/
Leave createUserClient registered:true in 1281 ms
0.0
0.0
org.mozilla.javascript.EvaluatorException: The undefined value has no properties.
org.mozilla.javascript.EvaluatorException: The undefined value has no properties.
at org.mozilla.javascript.DefaultErrorReporter.runtimeError(DefaultErrorReporter.java:61)
at org.mozilla.javascript.Context.reportRuntimeError(Context.java:560)
at org.mozilla.javascript.Context.reportRuntimeError(Context.java:598)
at org.mozilla.javascript.Context.reportRuntimeError0(Context.java:568)
at org.mozilla.javascript.Undefined.reportError(Undefined.java:136)
at org.mozilla.javascript.Undefined.getPrototype(Undefined.java:98)
at org.mozilla.javascript.ScriptRuntime.setProp(ScriptRuntime.java:842)
at org.mozilla.javascript.gen.c296.call(VisibleElements:18)
at org.mozilla.javascript.ScriptRuntime.call(ScriptRuntime.java:1242)
at org.mozilla.javascript.gen.c274.call(OnShow:96)
at com.servoy.j2db.scripting.f.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.ct(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.FormPanel.r(Unknown Source)
at com.servoy.j2db.dataui.l.t(Unknown Source)
at com.servoy.j2db.dataui.SpecialTabPanel.stateChanged(Unknown Source)
at javax.swing.JTabbedPane.fireStateChanged(Unknown Source)
at javax.swing.JTabbedPane$ModelListener.stateChanged(Unknown Source)
at javax.swing.DefaultSingleSelectionModel.fireStateChanged(Unknown Source)
at javax.swing.DefaultSingleSelectionModel.setSelectedIndex(Unknown Source)
at javax.swing.JTabbedPane.setSelectedIndexImpl(Unknown Source)
at javax.swing.JTabbedPane.setSelectedIndex(Unknown Source)
at javax.swing.plaf.basic.BasicTabbedPaneUI$MouseHandler.mousePressed(Unknown Source)
at java.awt.AWTEventMulticaster.mousePressed(Unknown Source)
at java.awt.Component.processMouseEvent(Unknown Source)
at java.awt.Component.processEvent(Unknown Source)
at java.awt.Container.processEvent(Unknown Source)
at java.awt.Component.dispatchEventImpl(Unknown Source)
at java.awt.Container.dispatchEventImpl(Unknown Source)
at java.awt.Component.dispatchEvent(Unknown Source)
at java.awt.LightweightDispatcher.retargetMouseEvent(Unknown Source)
at java.awt.LightweightDispatcher.processMouseEvent(Unknown Source)
at java.awt.LightweightDispatcher.dispatchEvent(Unknown Source)
at java.awt.Container.dispatchEventImpl(Unknown Source)
at java.awt.Window.dispatchEventImpl(Unknown Source)
at java.awt.Component.dispatchEvent(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)
0.0
0.0
org.mozilla.javascript.EvaluatorException: The undefined value has no properties.
org.mozilla.javascript.EvaluatorException: The undefined value has no properties.
at org.mozilla.javascript.DefaultErrorReporter.runtimeError(DefaultErrorReporter.java:61)
at org.mozilla.javascript.Context.reportRuntimeError(Context.java:560)
at org.mozilla.javascript.Context.reportRuntimeError(Context.java:598)
at org.mozilla.javascript.Context.reportRuntimeError0(Context.java:568)
at org.mozilla.javascript.Undefined.reportError(Undefined.java:136)
at org.mozilla.javascript.Undefined.getPrototype(Undefined.java:98)
at org.mozilla.javascript.ScriptRuntime.setProp(ScriptRuntime.java:842)
at org.mozilla.javascript.gen.c296.call(VisibleElements:18)
at org.mozilla.javascript.ScriptRuntime.call(ScriptRuntime.java:1242)
at org.mozilla.javascript.gen.c274.call(OnShow:96)
at com.servoy.j2db.scripting.f.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.cl(Unknown Source)
at com.servoy.j2db.dataui.l$1.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)
ReferenceError: “doctor_initials_phone” is not defined. (OnShow; line 7)
ReferenceError: “doctor_initials_phone” is not defined. (OnShow; line 7)
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.gen.c312.call(OnShow:7)
at com.servoy.j2db.scripting.f.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.cl(Unknown Source)
at com.servoy.j2db.dataui.l$1.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)
ReferenceError: “surgery_centersid” is not defined. (New_Procedure; line 4)
ReferenceError: “surgery_centersid” is not defined. (New_Procedure; line 4)
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.gen.c314.call(New_Procedure:4)
at com.servoy.j2db.scripting.f.executeFunction(Unknown Source)
at com.servoy.j2db.FormPanel.a(Unknown Source)
at com.servoy.j2db.FormPanel.a(Unknown Source)
at com.servoy.j2db.FormPanel$b.actionPerformed(Unknown Source)
at javax.swing.AbstractButton.fireActionPerformed(Unknown Source)
at javax.swing.AbstractButton$ForwardActionEvents.actionPerformed(Unknown Source)
at javax.swing.DefaultButtonModel.fireActionPerformed(Unknown Source)
at javax.swing.DefaultButtonModel.setPressed(Unknown Source)
at javax.swing.plaf.basic.BasicButtonListener.mouseReleased(Unknown Source)
at java.awt.AWTEventMulticaster.mouseReleased(Unknown Source)
at java.awt.Component.processMouseEvent(Unknown Source)
at java.awt.Component.processEvent(Unknown Source)
at java.awt.Container.processEvent(Unknown Source)
at java.awt.Component.dispatchEventImpl(Unknown Source)
at java.awt.Container.dispatchEventImpl(Unknown Source)
at java.awt.Component.dispatchEvent(Unknown Source)
at java.awt.LightweightDispatcher.retargetMouseEvent(Unknown Source)
at java.awt.LightweightDispatcher.processMouseEvent(Unknown Source)
at java.awt.LightweightDispatcher.dispatchEvent(Unknown Source)
at java.awt.Container.dispatchEventImpl(Unknown Source)
at java.awt.Window.dispatchEventImpl(Unknown Source)
at java.awt.Component.dispatchEvent(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)
ReferenceError: “surgery_centersid” is not defined. (New_Procedure; line 4)
ReferenceError: “surgery_centersid” is not defined. (New_Procedure; line 4)
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.gen.c314.call(New_Procedure:4)
at com.servoy.j2db.scripting.f.executeFunction(Unknown Source)
at com.servoy.j2db.FormPanel.a(Unknown Source)
at com.servoy.j2db.FormPanel.a(Unknown Source)
at com.servoy.j2db.FormPanel$b.actionPerformed(Unknown Source)
at javax.swing.AbstractButton.fireActionPerformed(Unknown Source)
at javax.swing.AbstractButton$ForwardActionEvents.actionPerformed(Unknown Source)
at javax.swing.DefaultButtonModel.fireActionPerformed(Unknown Source)
at javax.swing.DefaultButtonModel.setPressed(Unknown Source)
at javax.swing.plaf.basic.BasicButtonListener.mouseReleased(Unknown Source)
at java.awt.AWTEventMulticaster.mouseReleased(Unknown Source)
at java.awt.Component.processMouseEvent(Unknown Source)
at java.awt.Component.processEvent(Unknown Source)
at java.awt.Container.processEvent(Unknown Source)
at java.awt.Component.dispatchEventImpl(Unknown Source)
at java.awt.Container.dispatchEventImpl(Unknown Source)
at java.awt.Component.dispatchEvent(Unknown Source)
at java.awt.LightweightDispatcher.retargetMouseEvent(Unknown Source)
at java.awt.LightweightDispatcher.processMouseEvent(Unknown Source)
at java.awt.LightweightDispatcher.dispatchEvent(Unknown Source)
at java.awt.Container.dispatchEventImpl(Unknown Source)
at java.awt.Window.dispatchEventImpl(Unknown Source)
at java.awt.Component.dispatchEvent(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)
ReferenceError: “doctor_initials_phone” is not defined. (OnShow; line 7)
ReferenceError: “doctor_initials_phone” is not defined. (OnShow; line 7)
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.gen.c312.call(OnShow:7)
at com.servoy.j2db.scripting.f.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.cl(Unknown Source)
at com.servoy.j2db.dataui.l$1.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)
ReferenceError: “surgery_centersid” is not defined. (New_Procedure; line 4)
ReferenceError: “surgery_centersid” is not defined. (New_Procedure; line 4)
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.gen.c314.call(New_Procedure:4)
at com.servoy.j2db.scripting.f.executeFunction(Unknown Source)
at com.servoy.j2db.FormPanel.a(Unknown Source)
at com.servoy.j2db.FormPanel.a(Unknown Source)
at com.servoy.j2db.FormPanel$b.actionPerformed(Unknown Source)
at javax.swing.AbstractButton.fireActionPerformed(Unknown Source)
at javax.swing.AbstractButton$ForwardActionEvents.actionPerformed(Unknown Source)
at javax.swing.DefaultButtonModel.fireActionPerformed(Unknown Source)
at javax.swing.DefaultButtonModel.setPressed(Unknown Source)
at javax.swing.plaf.basic.BasicButtonListener.mouseReleased(Unknown Source)
at java.awt.AWTEventMulticaster.mouseReleased(Unknown Source)
at java.awt.Component.processMouseEvent(Unknown Source)
at java.awt.Component.processEvent(Unknown Source)
at java.awt.Container.processEvent(Unknown Source)
at java.awt.Component.dispatchEventImpl(Unknown Source)
at java.awt.Container.dispatchEventImpl(Unknown Source)
at java.awt.Component.dispatchEvent(Unknown Source)
at java.awt.LightweightDispatcher.retargetMouseEvent(Unknown Source)
at java.awt.LightweightDispatcher.processMouseEvent(Unknown Source)
at java.awt.LightweightDispatcher.dispatchEvent(Unknown Source)
at java.awt.Container.dispatchEventImpl(Unknown Source)
at java.awt.Window.dispatchEventImpl(Unknown Source)
at java.awt.Component.dispatchEvent(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)
ReferenceError: “surgery_centersid” is not defined. (New_Procedure; line 4)
ReferenceError: “surgery_centersid” is not defined. (New_Procedure; line 4)
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.gen.c314.call(New_Procedure:4)
at com.servoy.j2db.scripting.f.executeFunction(Unknown Source)
at com.servoy.j2db.FormPanel.a(Unknown Source)
at com.servoy.j2db.FormPanel.a(Unknown Source)
at com.servoy.j2db.FormPanel$b.actionPerformed(Unknown Source)
at javax.swing.AbstractButton.fireActionPerformed(Unknown Source)
at javax.swing.AbstractButton$ForwardActionEvents.actionPerformed(Unknown Source)
at javax.swing.DefaultButtonModel.fireActionPerformed(Unknown Source)
at javax.swing.DefaultButtonModel.setPressed(Unknown Source)
at javax.swing.plaf.basic.BasicButtonListener.mouseReleased(Unknown Source)
at java.awt.AWTEventMulticaster.mouseReleased(Unknown Source)
at java.awt.Component.processMouseEvent(Unknown Source)
at java.awt.Component.processEvent(Unknown Source)
at java.awt.Container.processEvent(Unknown Source)
at java.awt.Component.dispatchEventImpl(Unknown Source)
at java.awt.Container.dispatchEventImpl(Unknown Source)
at java.awt.Component.dispatchEvent(Unknown Source)
at java.awt.LightweightDispatcher.retargetMouseEvent(Unknown Source)
at java.awt.LightweightDispatcher.processMouseEvent(Unknown Source)
at java.awt.LightweightDispatcher.dispatchEvent(Unknown Source)
at java.awt.Container.dispatchEventImpl(Unknown Source)
at java.awt.Window.dispatchEventImpl(Unknown Source)
at java.awt.Component.dispatchEvent(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)
com.servoy.j2db.persistence.RepositoryException: java.sql.SQLException: [Microsoft][SQLServer 2000 Driver for JDBC][SQLServer]Incorrect syntax near the keyword ‘is’. [Microsoft][SQLServer 2000 Driver for JDBC][SQLServer]Incorrect syntax near the keyword ‘is’.
com.servoy.j2db.persistence.RepositoryException: java.sql.SQLException: [Microsoft][SQLServer 2000 Driver for JDBC][SQLServer]Incorrect syntax near the keyword ‘is’. [Microsoft][SQLServer 2000 Driver for JDBC][SQLServer]Incorrect syntax near the keyword ‘is’.
at com.servoy.j2db.dataprocessing.SQLEngine.a(Unknown Source)
at com.servoy.j2db.dataprocessing.SQLEngine.performCustomQuery(Unknown Source)
at sun.reflect.GeneratedMethodAccessor134.invoke(Unknown Source)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
at java.lang.reflect.Method.invoke(Unknown Source)
at sun.rmi.server.UnicastServerRef.dispatch(Unknown Source)
at sun.rmi.transport.Transport$1.run(Unknown Source)
at java.security.AccessController.doPrivileged(Native Method)
at sun.rmi.transport.Transport.serviceCall(Unknown Source)
at sun.rmi.transport.tcp.TCPTransport.handleMessages(Unknown Source)
at sun.rmi.transport.tcp.TCPTransport$ConnectionHandler.run(Unknown Source)
at java.lang.Thread.run(Unknown Source)
at sun.rmi.transport.StreamRemoteCall.exceptionReceivedFromServer(Unknown Source)
at sun.rmi.transport.StreamRemoteCall.executeCall(Unknown Source)
at sun.rmi.server.UnicastRef.invoke(Unknown Source)
at com.servoy.j2db.dataprocessing.SQLEngine_Stub.performCustomQuery(Unknown Source)
at com.servoy.j2db.dataprocessing.ae.if(Unknown Source)
at com.servoy.j2db.dataprocessing.JSDatabaseManager.js_getDataSetByQuery(Unknown Source)
at sun.reflect.GeneratedMethodAccessor34.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.gen.c339.call(OnShow:12)
at com.servoy.j2db.scripting.f.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.cl(Unknown Source)
at com.servoy.j2db.FormManager$5.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)
com.servoy.j2db.persistence.RepositoryException: java.sql.SQLException: [Microsoft][SQLServer 2000 Driver for JDBC][SQLServer]Incorrect syntax near the keyword ‘is’. [Microsoft][SQLServer 2000 Driver for JDBC][SQLServer]Incorrect syntax near the keyword ‘is’.
com.servoy.j2db.persistence.RepositoryException: java.sql.SQLException: [Microsoft][SQLServer 2000 Driver for JDBC][SQLServer]Incorrect syntax near the keyword ‘is’. [Microsoft][SQLServer 2000 Driver for JDBC][SQLServer]Incorrect syntax near the keyword ‘is’.
at com.servoy.j2db.dataprocessing.SQLEngine.a(Unknown Source)
at com.servoy.j2db.dataprocessing.SQLEngine.performCustomQuery(Unknown Source)
at sun.reflect.GeneratedMethodAccessor134.invoke(Unknown Source)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
at java.lang.reflect.Method.invoke(Unknown Source)
at sun.rmi.server.UnicastServerRef.dispatch(Unknown Source)
at sun.rmi.transport.Transport$1.run(Unknown Source)
at java.security.AccessController.doPrivileged(Native Method)
at sun.rmi.transport.Transport.serviceCall(Unknown Source)
at sun.rmi.transport.tcp.TCPTransport.handleMessages(Unknown Source)
at sun.rmi.transport.tcp.TCPTransport$ConnectionHandler.run(Unknown Source)
at java.lang.Thread.run(Unknown Source)
at sun.rmi.transport.StreamRemoteCall.exceptionReceivedFromServer(Unknown Source)
at sun.rmi.transport.StreamRemoteCall.executeCall(Unknown Source)
at sun.rmi.server.UnicastRef.invoke(Unknown Source)
at com.servoy.j2db.dataprocessing.SQLEngine_Stub.performCustomQuery(Unknown Source)
at com.servoy.j2db.dataprocessing.ae.if(Unknown Source)
at com.servoy.j2db.dataprocessing.JSDatabaseManager.js_getDataSetByQuery(Unknown Source)
at sun.reflect.GeneratedMethodAccessor34.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.gen.c339.call(OnShow:12)
at com.servoy.j2db.scripting.f.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.cl(Unknown Source)
at com.servoy.j2db.FormManager.a(Unknown Source)
at com.servoy.j2db.FormManager.do(Unknown Source)
at com.servoy.j2db.FormPanel.cy(Unknown Source)
at com.servoy.j2db.FormPanel$JSForm.js_show(Unknown Source)
at inv9.invoke()
at org.mozilla.javascript.FunctionObject.doInvoke(FunctionObject.java:537)
at org.mozilla.javascript.FunctionObject.call(FunctionObject.java:453)
at org.mozilla.javascript.ScriptRuntime.call(ScriptRuntime.java:1242)
at org.mozilla.javascript.gen.c337.call(New_Contact:2)
at com.servoy.j2db.scripting.f.executeFunction(Unknown Source)
at com.servoy.j2db.FormPanel.a(Unknown Source)
at com.servoy.j2db.FormPanel.a(Unknown Source)
at com.servoy.j2db.FormPanel$b.actionPerformed(Unknown Source)
at javax.swing.AbstractButton.fireActionPerformed(Unknown Source)
at javax.swing.AbstractButton$ForwardActionEvents.actionPerformed(Unknown Source)
at javax.swing.DefaultButtonModel.fireActionPerformed(Unknown Source)
at javax.swing.DefaultButtonModel.setPressed(Unknown Source)
at javax.swing.plaf.basic.BasicButtonListener.mouseReleased(Unknown Source)
at java.awt.AWTEventMulticaster.mouseReleased(Unknown Source)
at java.awt.Component.processMouseEvent(Unknown Source)
at java.awt.Component.processEvent(Unknown Source)
at java.awt.Container.processEvent(Unknown Source)
at java.awt.Component.dispatchEventImpl(Unknown Source)
at java.awt.Container.dispatchEventImpl(Unknown Source)
at java.awt.Component.dispatchEvent(Unknown Source)
at java.awt.LightweightDispatcher.retargetMouseEvent(Unknown Source)
at java.awt.LightweightDispatcher.processMouseEvent(Unknown Source)
at java.awt.LightweightDispatcher.dispatchEvent(Unknown Source)
at java.awt.Container.dispatchEventImpl(Unknown Source)
at java.awt.Window.dispatchEventImpl(Unknown Source)
at java.awt.Component.dispatchEvent(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)
com.servoy.j2db.persistence.RepositoryException: java.sql.SQLException: [Microsoft][SQLServer 2000 Driver for JDBC][SQLServer]Incorrect syntax near the keyword ‘is’. [Microsoft][SQLServer 2000 Driver for JDBC][SQLServer]Incorrect syntax near the keyword ‘is’.
com.servoy.j2db.persistence.RepositoryException: java.sql.SQLException: [Microsoft][SQLServer 2000 Driver for JDBC][SQLServer]Incorrect syntax near the keyword ‘is’. [Microsoft][SQLServer 2000 Driver for JDBC][SQLServer]Incorrect syntax near the keyword ‘is’.
at com.servoy.j2db.dataprocessing.SQLEngine.a(Unknown Source)
at com.servoy.j2db.dataprocessing.SQLEngine.performCustomQuery(Unknown Source)
at sun.reflect.GeneratedMethodAccessor134.invoke(Unknown Source)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
at java.lang.reflect.Method.invoke(Unknown Source)
at sun.rmi.server.UnicastServerRef.dispatch(Unknown Source)
at sun.rmi.transport.Transport$1.run(Unknown Source)
at java.security.AccessController.doPrivileged(Native Method)
at sun.rmi.transport.Transport.serviceCall(Unknown Source)
at sun.rmi.transport.tcp.TCPTransport.handleMessages(Unknown Source)
at sun.rmi.transport.tcp.TCPTransport$ConnectionHandler.run(Unknown Source)
at java.lang.Thread.run(Unknown Source)
at sun.rmi.transport.StreamRemoteCall.exceptionReceivedFromServer(Unknown Source)
at sun.rmi.transport.StreamRemoteCall.executeCall(Unknown Source)
at sun.rmi.server.UnicastRef.invoke(Unknown Source)
at com.servoy.j2db.dataprocessing.SQLEngine_Stub.performCustomQuery(Unknown Source)
at com.servoy.j2db.dataprocessing.ae.if(Unknown Source)
at com.servoy.j2db.dataprocessing.JSDatabaseManager.js_getDataSetByQuery(Unknown Source)
at sun.reflect.GeneratedMethodAccessor34.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.gen.c339.call(OnShow:12)
at com.servoy.j2db.scripting.f.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.cl(Unknown Source)
at com.servoy.j2db.FormManager.a(Unknown Source)
at com.servoy.j2db.FormManager.do(Unknown Source)
at com.servoy.j2db.FormPanel.cy(Unknown Source)
at com.servoy.j2db.FormPanel$JSForm.js_show(Unknown Source)
at inv9.invoke()
at org.mozilla.javascript.FunctionObject.doInvoke(FunctionObject.java:537)
at org.mozilla.javascript.FunctionObject.call(FunctionObject.java:453)
at org.mozilla.javascript.ScriptRuntime.call(ScriptRuntime.java:1242)
at org.mozilla.javascript.gen.c337.call(New_Contact:2)
at com.servoy.j2db.scripting.f.executeFunction(Unknown Source)
at com.servoy.j2db.FormPanel.a(Unknown Source)
at com.servoy.j2db.FormPanel.a(Unknown Source)
at com.servoy.j2db.FormPanel$b.actionPerformed(Unknown Source)
at javax.swing.AbstractButton.fireActionPerformed(Unknown Source)
at javax.swing.AbstractButton$ForwardActionEvents.actionPerformed(Unknown Source)
at javax.swing.DefaultButtonModel.fireActionPerformed(Unknown Source)
at javax.swing.DefaultButtonModel.setPressed(Unknown Source)
at javax.swing.plaf.basic.BasicButtonListener.mouseReleased(Unknown Source)
at java.awt.AWTEventMulticaster.mouseReleased(Unknown Source)
at java.awt.Component.processMouseEvent(Unknown Source)
at java.awt.Component.processEvent(Unknown Source)
at java.awt.Container.processEvent(Unknown Source)
at java.awt.Component.dispatchEventImpl(Unknown Source)
at java.awt.Container.dispatchEventImpl(Unknown Source)
at java.awt.Component.dispatchEvent(Unknown Source)
at java.awt.LightweightDispatcher.retargetMouseEvent(Unknown Source)
at java.awt.LightweightDispatcher.processMouseEvent(Unknown Source)
at java.awt.LightweightDispatcher.dispatchEvent(Unknown Source)
at java.awt.Container.dispatchEventImpl(Unknown Source)
at java.awt.Window.dispatchEventImpl(Unknown Source)
at java.awt.Component.dispatchEvent(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)

looking at the stack i think the onShow is executed through onRecordSelect() But when it does the elements should just be there.
Is the method visibleElements a form method that you are trying to show?
(to make sure you are testing the right elements length)

But i need youre solution and some data to be able to test this. Because which paths i do follow everywhere the right method (that constructs the elements) is called before the script is runned.

I do get the feeling that you are talking to another elements object somehow. Because now i think about it. If there is an
elements object (where you call elements.length on) then the the fields should also be there because the elements object is made at the same time fields that are in the elements object…

What kind of view is youre formpanel in that you are trying to show?

Never able to make a reproducible test case. I finally just rewrote this entire section and this problem went away.

John McCann