NetTalk Central

Author Topic: Capturing JavaScript Event  (Read 2345 times)

Sibuya

  • Jr. Member
  • **
  • Posts: 65
    • View Profile
    • Email
Capturing JavaScript Event
« on: April 04, 2016, 03:47:43 PM »
Hi,

I'm using an applet that reads a Digital Certificate and is working fine in LoginForm. I used two SetSessionValue (JavaScript from netweb.js) that sends two variables as a two GET messages to the server. But I could not found a way to catch them in LoginForm.

In WebHandler I can get it these two variables by GetValue and Store in SessionVariables. But LoginForm does not receive them until I call the applet again.

Sometimes these variables are sent to the server by two different threads because their generation does not occurs at the same time.

Could anyone help me where I can put a code to catch these variables in LoginForm?

Thank you,

Marcos

Bruce

  • Global Moderator
  • Hero Member
  • *****
  • Posts: 11186
    • View Profile
Re: Capturing JavaScript Event
« Reply #1 on: April 05, 2016, 06:13:43 AM »
>> Sometimes these variables are sent to the server by two different threads because their generation does not occurs at the
same time.

Right. Which is why you want to do a StoreValue when they do come in, and use only GetSessionValue in your code.

and of course if you are sending the information on multiple threads then there's no guarentee that the first one has completed before the next one arrives. So you may need to delay the POST a bit so the SetSessionValue has a chance to finish first.

cheers
Bruce

Sibuya

  • Jr. Member
  • **
  • Posts: 65
    • View Profile
    • Email
Re: Capturing JavaScript Event
« Reply #2 on: April 07, 2016, 04:16:18 AM »
Hi Bruce,

I got those SessionValues (and StoredValue) synchronized using other SessionValues as flags that I created to test if all variables has arrived. It worked. I put this code in WebHandler that is receiving events because they don't reach LoginForm. I put traces on the very beginning of LoginForm to confirm it.

The same thread that have the correct SessionValues calls a Clarion Window procedure (window hidden and because I have to use an ActiveX component) that have to call an external WebService using NetWebClient passing a json structure with these SessionValues. But randomly any SessionValue is truncated or cleared when is used from inside this Clarion Window procedure.

Is there any restriction?

Thank you.

Marcos

Sibuya

  • Jr. Member
  • **
  • Posts: 65
    • View Profile
    • Email
Re: Capturing JavaScript Event
« Reply #3 on: April 08, 2016, 04:05:07 AM »
Hi Bruce!

Thank you for explanations on Webinar #100!

Cheers,

Marcos