PC SOFT

FOROS PROFESIONALES
WINDEVWEBDEV y WINDEV Mobile

Inicio → WINDEV 2024 → [WD19] Refresh a control from a server process
[WD19] Refresh a control from a server process
Iniciado por guest, 16,abr. 2015 20:36 - 4 respuestas
Publicado el 16,abril 2015 - 20:36
Hello:

I have a webpage with an edit control (or any other type) and the server is running a process which should update this control with new information. How can I constantly update (every time there is new info) the control in the web browser?
I tried PageRefresh but the control remains blank.

Should I use AJAX? Some example to point me?

Thanks;
Michael
Publicado el 16,abril 2015 - 22:52
Hi Michael,

in the description of the control in the Gui-Tab, did you change the control type to "static"?
If it is a static control in ther server code myEdit..value = "New Value" should work.

Best Regards

Stefan.
Publicado el 16,abril 2015 - 22:58
Sorry,

I ment dynamic, not static!
Publicado el 16,abril 2015 - 23:34
Hello Stefan:

It didn't make any difference.

Most of the examples I saw is using Ajax but the user triggers an action (press a button, etc). What I really want is to update the edit control with information coming from a process running on the server.

What I'm trying now is to use AJAXExecuteAsynchronous function and it seems to be somehow working but it still not very stable. I tried to look an example about how to use it, but I couldn't find. I see some differences to what the help mentions...

Michael
Publicado el 17,abril 2015 - 10:34
example to show the time of the server in one page using ajax:
load of the page (Browser):
Timer(call_page_timer_ajax,100)

local procedures (Broswer):
PROCEDURE call_page_timer_ajax()
AJAXExecuteAsynchronous(proc_srv_ajax,proc_browser_ajax)

PROCEDURE proc_browser_ajax(res_srv,proc_srv)
// time1 is one control of the page
time1=res_srv

local procedure (server):
PROCEDURE proc_srv_ajax()
// this procedure must be AJAX enable (it must have ajax with a green dot in the header)
RESULT TimeSys()