Client side function executeFunctionAsynchronously

Post any questions you have about using the Verj.io Studio, including client and server-side programming with Javascript or FPL, and integration with databases, web services etc.

Moderators: Jon, Steve, Ian, Dave

Segi
Ebase User
Posts: 649
Joined: Mon Dec 09, 2013 6:37 pm

Client side function executeFunctionAsynchronously

#1

Postby Segi » Mon Jul 23, 2018 3:27 pm

I have a button with a client side click event that executes a server side function. This is the code:

Code: Select all

var partnum=$('.PARTNUM').val();

if (partnum==null || partnum=="") {
     alert("Unable to get the part number");
     return false;	
}

var successCallBack=function(data){alert(data)};
var failureCallBack = function(reason){alert(reason)};

$eb.executeFunctionAsynchronously(successCallBack, failureCallBack,"BOMAnalysis",partnum);

return false;
This code does run the server side function but while the function is executing, the popup window that the form is displayed in hangs meaning you can't interact with the form by clicking on the save or cancel button.

I have another form that also calls executeFunctionAsynchronously in a similar way but you can still interact with the form and it responds to events normally.
0 x

Jon
Moderator
Moderator
Posts: 1342
Joined: Wed Sep 12, 2007 12:49 pm

Re: Client side function executeFunctionAsynchronously

#2

Postby Jon » Tue Jul 24, 2018 8:33 am

Segi,

I'm not sure if this is the cause of your hang, but there is a restriction that the Ebase server can only process one event per user at any given time. So it's not possible to simultaneously execute an executeFunction() - asynchronous or not - and any other event, client or server side. Your first executeFunction() effectively acts as a blocker and any subsequent requests should just be ignored i.e. thrown away, until the first one completes.

Regards
jon
0 x

Segi
Ebase User
Posts: 649
Joined: Mon Dec 09, 2013 6:37 pm

Re: Client side function executeFunctionAsynchronously

#3

Postby Segi » Tue Jul 24, 2018 2:56 pm

jon,

Do you mean that you can only call $eb.executeFunctionAsynchronously( once per client side script (which is the case here) or that it can't be called simultaneously by different users who are on the same form ? This 2nd situation is not happening for sure since it is still being tested by only one person and the form is not being used by more than 1 person at a time.
0 x

Jon
Moderator
Moderator
Posts: 1342
Joined: Wed Sep 12, 2007 12:49 pm

Re: Client side function executeFunctionAsynchronously

#4

Postby Jon » Tue Jul 24, 2018 3:46 pm

No, neither of these. I'll try and clarify..

For a single client - i.e. one browser, you can only execute one event at any given moment. So for example, if $eb.executeFunctionAsynchronously is called, you can't execute anything else e.g. another client API call or just a button click, until the asynchronous call completes. So if for example you call $eb.executeFunctionAsynchronously and then the user clicks a save button - the save event on the server may or may not be executed depending on whether the asynchronous call has completed.
0 x

Segi
Ebase User
Posts: 649
Joined: Mon Dec 09, 2013 6:37 pm

Re: Client side function executeFunctionAsynchronously

#5

Postby Segi » Tue Jul 24, 2018 4:30 pm

jon,

I am not doing anything else on the client side besides the one call to $eb.executeFunctionAsynchronously which you can see in the snippet of code below which comes directly from the click event.

However, while the function is executing, when you try and click on a save button which is supposed to execute a server side script to save the current record, the button doesn't respond. There's nothing else being done on the client side.

I have another form that also calls $eb.executeFunctionAsynchronously and the page is still responsive while the server is running the function on the server side
0 x

Jon
Moderator
Moderator
Posts: 1342
Joined: Wed Sep 12, 2007 12:49 pm

Re: Client side function executeFunctionAsynchronously

#6

Postby Jon » Wed Jul 25, 2018 7:31 am

However, while the function is executing, when you try and click on a save button which is supposed to execute a server side script to save the current record, the button doesn't respond.
That's exactly what I would expect.
0 x

Segi
Ebase User
Posts: 649
Joined: Mon Dec 09, 2013 6:37 pm

Re: Client side function executeFunctionAsynchronously

#7

Postby Segi » Wed Jul 25, 2018 11:25 pm

Jon,

How is that asynchronous if the form doesn't respond to events while it's executing a function ?
0 x

Jon
Moderator
Moderator
Posts: 1342
Joined: Wed Sep 12, 2007 12:49 pm

Re: Client side function executeFunctionAsynchronously

#8

Postby Jon » Fri Jul 27, 2018 7:37 am

Well it still operates asynchronously. But I do see your point - just discarding any subsequent events is not much use to anyone.
0 x

Segi
Ebase User
Posts: 649
Joined: Mon Dec 09, 2013 6:37 pm

Re: Client side function executeFunctionAsynchronously

#9

Postby Segi » Fri Jul 27, 2018 8:33 pm

Are there any plans to address/fix this ?

Since the function is named executeFunctionAsynchronously, it seems fair to assume that the task runs in its own thread so that other tasks could be performed in parallel.
0 x


Who is online

Users browsing this forum: No registered users and 8 guests