We have a problem running the application in smart client.
Each form of the solution has an onEdit() and onSearch() methods that set the “editable” and/or “visible” state of relevant fields (to simulate ‘edit mode’ and ‘browse mode’). The methods run subsequently for all forms that sit in the tabs of the form that first runs the method, so it’s sort of cascading.
In developer it works just fine. However, when we import the solution to the server and run it from a link remotely, onEdit and onSearch() behave weird. If we click in the tabs, that should have run the appropriate method and disable the fields, the fields are still enabled. However if we put a button on the top form that will call a testing method which will only read the other form’s field (that we don’t yet see) with application.output(forms[aFormName].elements.fieldName.editable) - and only then will go to that tab, then we will see that the field is disabled as expected.
We tried to create a test solution for that but cannot reproduce the error so far. Any ideas on what it can be? (again, everything runs smoothly in developer but not in remote client)
Yes, onEdit and onSearch are called successfully and set the field to the expected state.
But when the form with the field runs onShow the field returns to its original state set at design time.
I also noticed that it only happens to the forms that are displayed in tabs.
Could you suggest what is happening at onShow and why? (This DOES NOT happen when I test the code in developer, only when running from remote client)
maria:
Yes, onEdit and onSearch are called successfully and set the field to the expected state.
But when the form with the field runs onShow the field returns to its original state set at design time.
I also noticed that it only happens to the forms that are displayed in tabs.
Could you suggest what is happening at onShow and why? (This DOES NOT happen when I test the code in developer, only when running from remote client)
Does it happen every time you run the application ? Please add a case if reproduceable in a sample.
maria:
Yes, onEdit and onSearch are called successfully and set the field to the expected state.
But when the form with the field runs onShow the field returns to its original state set at design time.
I also noticed that it only happens to the forms that are displayed in tabs.
Could you suggest what is happening at onShow and why? (This DOES NOT happen when I test the code in developer, only when running from remote client)
Does it happen every time you run the application ? Please add a case if reproduceable in a sample.
It happens each time the main form of the module is shown. After running onEdit() or onSearch() explicitly by clicking “Edit”/“Save” buttons all works fine.
We cannot reproduce the case, there must be something somewhere in the code we’re not aware of.
But what worries us most is that it works perfectly well in developer and we expected it to work in remote client as well.
Also when I put the cascading method in the onLoad of the main form it goes in an infinite loop in remote client which does not happen in developer.
Something must be happening at onShow() event of the form because the first time onSearch() runs it sets the correct status of the fields. The status changes to incorrect when onShow() event of the ‘faulty’ form runs (the method is empty), at that point the status changes to incorrect (I output the status with application.output() in different points of the solution).
Are there any differences between what happens in onShow() if it’s run from developer and from remote client?
Maybe the problem occurs if the forms that are not visible in the tab panel have been removed from the form cache.
To preserve memory, Servoy may remove non-visible forms, they are reloaded when needed.
Has the onLoad() method been called between the OnSearch/onEdit and the onShow()?
Maybe the problem occurs if the forms that are not visible in the tab panel have been removed from the form cache.
To preserve memory, Servoy may remove non-visible forms, they are reloaded when needed.
Has the onLoad() method been called between the OnSearch/onEdit and the onShow()?
Rob
Rob, it does call onLoad between onSearch and onShow
Now I know what’s going on.
Thank you so much
I’ve been working with Maria on this problem. We have got to the conclusion that Servoy removes the forms from its cache, causing the onLoad event to be called again.
We don’t agree with this behavior, why do they behave different when running from developer or server? What other issues are we going to face because of environment differences? You can imagine how difficult it is to debug this kind of problems.
If Servoy removes the form from its cache, it should return with the state previously set. The question is: should we submit a case in the Support System?
I opened a new topic in ‘Issues and Bugs’ to find out how this kind of behavior can be fixed.
We would like to control when the forms are loaded and unloaded.