PC SOFT

FOROS PROFESIONALES
WINDEVWEBDEV y WINDEV Mobile

Inicio → WINDEV 2024 → AJAX Confusion
AJAX Confusion
Iniciado por guest, 17,ago. 2015 06:52 - 5 respuestas
Publicado el 17,agosto 2015 - 06:52
Using WB20

I have 3 controls - an EDIT control accepting a date, a button with some code which fills the third control which is a table.

There is a global variable for the page, gd_Date which is DATE
The button server code which is simply

gd_Date = EDT_Date
Refresh_Table

When I don't enable AJAX on that code it all works great, but of course the whole page refreshes which is a little ugly.
When I enable AJAX it refreshes nicely, but the value of EDT_DATE is not updated with the newly typed in value!!

This is very confusing - if anyone can shed light on the matter I'd be grateful!

Rgds
Paul
Publicado el 18,agosto 2015 - 01:10
No one have any ideas? Perhaps I never gave enough information.

Using WB20, AWP pages.

The field EDT_Date initialises correctly and defaults to the current date. However when AJAX is enabled on the control that assigns EDT_Date to another variable (in server code), the value of EDT_Date in that code never reflects the newly entered value from the browser. Yet when I don't enable AJAX on that control, it works correctly.

Really would like some ideas on where I have gone wrong!

Thanks
Paul
Publicado el 18,agosto 2015 - 08:03
Paul,

You have to look to see if the values are send to the server, else the server never gets the updated value of the EDT_Date.

When you use a button, you have a checkmark in the description of the button that indicates send values to server.
It could be that you have to use a dummy button to call your Ajax function so that the values are send to the server. You then call this button from code with EXECUTEPROCESS.
I don't know if there is a seperate command in WLanguage to send the values to the server without making a dummy button.

There are more details in this page from Uncle Pete: http://www.thenextage.com/wordpress/uncle-petes-corner-a-couple-of-webdev-tips/

Danny
Publicado el 18,agosto 2015 - 09:03
Paul,

like Danny said. The values are not send to the server, so the server code still uses the old values.
Global variables also have there counterpart on the browser side, as if there are 2 variables. When you don't use a submit button, you have to keep them in sync yourself.
You can use AkaxExecute or even AjaxExecuteAsynchronous to send these values to the server WITHOUUT refreshing the page.
Publicado el 18,agosto 2015 - 10:20
Thank you very much Danny and Arie. I appreciate the help.
Publicado el 18,agosto 2015 - 19:45
Hi

How do you refresh your table?

You have to keep in mind that there is an order i witch things happen. If you refresh the table with tainit , then the init code of the table is run ( this is one of the firt processes. But tnot the first the initiation of the page is the first. If you devine your variabele in the ini setting of the table and do a table refres with tainit then that might just work.

regards

Allard