HTTP: Uncaught TypeError


Mario Steinbacher

Hello David!

I dont't now if it is possible ... but if it would be great. My idea would be to change in the done_handler and fail_handler of the http control the self variable from:

... to:

So when the response from the server comes back, but I have changed to another view during this wait time, the response can be handled by the correct http control handler.

I hope this is possible and I am waiting for your response.

best regards

mario


decsoft

Hello Mario,

I was tempted to propose some possible workaround, even when, certainly, the issue that you describes occurs. But then I figure out that the same issue can happen with other controls like the Websocket, AudioPlayer, VideoPlayer and Timer controls. So I decide to handle this and rewrite how the DecSoft App Builder compiler set the "self" variable of all the controls. I published a new release of the product right now as you can see in this forum post, Mario.



Mario Steinbacher

Hello David!

Thank you!

Important to note would be that if you use the response in the done handler, you should suggest to call it via views.[name of view].[name of http control].response because view.[http-control name].response would lead to an other error when you are on an other view.

best regards

mario


decsoft

Hello Mario,

I personally commonly use the "views.view1.http1.response" way since this works as expected even if we are in another view. Certainly the "view" variable must be taken with some precaution, since we can be in another view as you said. In the control help I use the first way. And now we can use the "self" variable even if we are in another view too. In fact the help refers to the "view" (inside events) variable like below:

Stores the current app view or dialog. This variable allow us to access to that view or dialog properties and methods and also their controls properties and methods. For example, you can access to a control properties using the variable "view.yourControlName", suposing the control is named "yourControlName".

However, may you are right and I can enhance the help, even when probably, if the view is the unexpected one, may we can imagine more or less easy that that is because we are not in the view to what we want to refer. May I can take a look at the help in order to add some information about this for the "view" variable.


Everybody can read the DecSoft support forum for learning purposes, however only DecSoft customers can post new threads. Purchase one or more licenses of some DecSoft products in order to give this and other benefits.

This website uses some useful cookies to store your preferences.

I agree. Hide this note. Give me more information.