Hi, I'm following the learning article at http://theformspider.com/learningcenter/how-to-use-external-method/, and everything works fine except the cookie is not read when getUserCoolie method is invoked in the PostOpen event. I added a logging call in the getUserCookie procedure to display the cookie:
And here is the result: USER : 05-05-2016 13:42:18 cookie retrieved: result: However, if I create a button on the LoginPanel, and make the same procedure called from the button pressed event, it works. Also tried putting it onto panel's postInitialize event - didn't work. Is there any other way to make it retrieve the cookie automatically during the app loading process? Thanks! |
Hi Ilia, You can read cookies in the postMethodInvoke event of externalMethod but not before. Appliction's postOpen and Panel's postInitialize are fired before external methods are executed. That's why you cannot read cookies. Kind Regards Serdar |
Thanks, Serdar. The learning tutorial and the demo application posted here link text specifically states -
We have to invoke the external method getCookie during the page load process, otherwise the cookie is useless. And then we call
This works in the Demo app, but I can't make it work in my app. It seems that as though the external method is invoked, the post external method procedure is not, and the cookie is not read. Here is my setup:
' result: '||api_externalMethod.issuccessful('getUserCookie')); api_debug.log('exiting getUserCookie'); exception when others then api_debug.log('error: '||sqlerrm);raise; end getUserCookie;
So, when I execute this procedure in the Application Post Open action, here is the output in my debug window:
Yet if I execute the same procedure from a button on the same panel, I can see my cookie being read:
And my second procedure is still not being executed. Is there anything else that needs to be done apart from what is indicated in the learning material? Can you please share the entire demo app XML? Thanks! Hi Ilia, Have you set the "post method completed" action in the external method edit dialog? Kind Regards Serdar
(11 May '16, 07:47)
Serdar ♦♦
|
Yes, Serdar, I have. Please see the screenshot. Thanks!
|