ExecuteJavaScript and Push update issue

I’m using push to update some textfields and I’m also using ExecuteJavaScript interact with the content of an iFrame.

I’m having an issue where when ExecuteJavaScript is used it pushes out some old content at the same time.

For example this happens after doing ExecuteJavaScript. The only thing correct here is the do_iframe_update the rest is old and was not done in my code example at the bottom of this post.

{"jsSource":"Xojo.controls['JQGzgqE3'].setVisible(false);\
Xojo.controls['JQGzgqE3'].refresh();\
try { window.frames[0].do_iframe_update(); } catch(err) { }\
Xojo.controls['RB8eGLXB'].setValue(\" 1\");\
Xojo.controls['Gu7WH83j'].setValue(\" 2\");\
Xojo.controls['ZIPVuSFX'].setValue(\" 3\");\
Xojo.controls['PbDVJa2m'].setValue(\" 4\");\
Xojo.controls['F5a7cS0Q'].setValue(\" 5\");\
Xojo.controls['WkFuEvyY'].setValue(\" 6\");\
Xojo.controls['LVfOPZfX'].setValue(\" 7\");\
Xojo.controls['EFwAu6ZZ'].setValue(\" 8\");\
Xojo.controls['W3n5JECm'].setValue(\" 9\");\
Xojo.controls['F1PqPeof'].setValue(\"  \");\
Xojo.controls['BIVfhOvy'].setValue(\"P\");\
Xojo.controls['Kaugwbxz'].setValue(\"Bethany Firth\");\
Xojo.controls['PFfrQFBU'].setValue(\"SM14 - Newcastle\");\
Xojo.controls['NmigZVXs'].setValue(\" 2:22.14\");\
Xojo.controls['ZTAolkWB'].setValue(\"4\");\
Xojo.controls['GmXBM5f9'].setValue(\"1044\");\
Xojo.controls['Q0W4xW1B'].setValue(\"Eleanor Simmonds\");\
Xojo.controls['PD6r8r2i'].setValue(\"Jessica-Jane Applegate\");\
Xojo.controls['O1Calrfb'].setValue(\"Sarah Louise Rung\");\
Xojo.controls['LnnKOLtu'].setValue(\"Chloe Davies\");\
Xojo.controls['UWFBwfkc'].setValue(\"Elisabeth Egel\");\
Xojo.controls['SPFCqKsQ'].setValue(\"Amy Marren\");\
Xojo.controls['N9ueoAEr'].setValue(\"Ellen Keane\");\
Xojo.controls['BI7BA3An'].setValue(\"\");\
Xojo.controls['WW81GQme'].setValue(\"SM6 - Loughboro Un\");\
Xojo.controls['JhqkN8wS'].setValue(\"SM14 - UEA Norwich\");\
Xojo.controls['Vh6Qbewj'].setValue(\"SM5 - Norway\");\
Xojo.controls['GnJS46Ny'].setValue(\"SM14 - Swansea Aq\");\
Xojo.controls['PCxqyp49'].setValue(\"SM11 - Estonia\");\
Xojo.controls['V8OC52EC'].setValue(\"SM9 - Romford Town\");\
Xojo.controls['JIos5WGe'].setValue(\"SM9 - Ireland\");\
Xojo.controls['F40NSByU'].setValue(\"\");\
Xojo.controls['Erx7GvWZ'].setValue(\" 3:06.44\");\
Xojo.controls['Av9xqvay'].setValue(\" 2:27.37\");\
Xojo.controls['Hde8nlGt'].setValue(\" 3:19.67\");\
Xojo.controls['A96VQyYN'].setValue(\" 2:35.15\");\
Xojo.controls['VhIDNLBI'].setValue(\" 2:59.65\");\
Xojo.controls['IcxLh0WW'].setValue(\" 2:39.64\");\
Xojo.controls['VmH4zbDm'].setValue(\" 2:42.20\");\
Xojo.controls['SRJVIP2L'].setValue(\"\");\
Xojo.controls['NKrOu8F8'].setValue(\"962\");\
Xojo.controls['CPinRRNl'].setValue(\"936\");\
Xojo.controls['EhNiDuCc'].setValue(\"909\");\
Xojo.controls['FXaw4GhV'].setValue(\"803\");\
Xojo.controls['JlDNm2os'].setValue(\"802\");\
Xojo.controls['HzvzF4Zu'].setValue(\"794\");\
Xojo.controls['OAC8BQVn'].setValue(\"757\");\
Xojo.controls['HG5ihue3'].setValue(\"\");\
Xojo.controls['DHsmZZyT'].setValue(\"5\");\
Xojo.controls['PvjqSE1j'].setValue(\"9\");\
Xojo.controls['LRysbebt'].setValue(\"3\");\
Xojo.controls['AwV65EiK'].setValue(\"8\");\
Xojo.controls['KAez0kVx'].setValue(\"6\");\
Xojo.controls['OWmWoi06'].setValue(\"2\");\
Xojo.controls['MlN878sO'].setValue(\"7\");\
Xojo.controls['L1F8odRR'].setValue(\"  \");\
Xojo.controls['FF4rWJZK'].setValue(\"\");\
Xojo.controls['M8eP2454'].setValue(\"L\");\
Xojo.controls['OklxQ2DJ'].setValue(\"0\");\
Xojo.controls['L6MMcy3u'].setValue(\"RESULT\");\
Xojo.controls['L6MMcy3u'].setVisible(true);\
Xojo.controls['L6MMcy3u'].refresh();\
Xojo.comm.ajax.begin();"}

Directly after that has happen it then does this, which is changing the content to what it should be. (What I’ve done in my code example at the bottom)

{"jsSource":"Xojo.controls['RB8eGLXB'].setValue(\"                                                            \");\
Xojo.controls['Gu7WH83j'].setValue(\"1\");\
Xojo.controls['ZIPVuSFX'].setValue(\"2\");\
Xojo.controls['PbDVJa2m'].setValue(\"3\");\
Xojo.controls['F5a7cS0Q'].setValue(\"4\");\
Xojo.controls['WkFuEvyY'].setValue(\"5\");\
Xojo.controls['LVfOPZfX'].setValue(\"6\");\
Xojo.controls['EFwAu6ZZ'].setValue(\"7\");\
Xojo.controls['W3n5JECm'].setValue(\"8\");\
Xojo.controls['F1PqPeof'].setValue(\"                                                            \");\
Xojo.controls['BIVfhOvy'].setValue(\"L\");\
Xojo.controls['Q0W4xW1B'].setValue(\"Matthew Gibson\");\
Xojo.controls['PD6r8r2i'].setValue(\"Aymeric Parmentier\");\
Xojo.controls['O1Calrfb'].setValue(\"Mikhail Kuliabin\");\
Xojo.controls['LnnKOLtu'].setValue(\"Isaac Bouckley\");\
Xojo.controls['UWFBwfkc'].setValue(\"Emanuel Goncalves\");\
Xojo.controls['M3phJ6iy'].setValue(\"Adam Ismael Wenham\");\
Xojo.controls['SPFCqKsQ'].setValue(\"Ka Man Li\");\
Xojo.controls['N9ueoAEr'].setValue(\"Jean-Michel Lavalliere\");\
Xojo.controls['WW81GQme'].setValue(\"SM14 - Derwentside\");\
Xojo.controls['JhqkN8wS'].setValue(\"SM14 - Belgium\");\
Xojo.controls['Vh6Qbewj'].setValue(\"SM14 - Russia\");\
Xojo.controls['GnJS46Ny'].setValue(\"SM10 - Canada\");\
Xojo.controls['PCxqyp49'].setValue(\"SM10 - Portugal\");\
Xojo.controls['GkNtbhwM'].setValue(\"SM14 - Norway\");\
Xojo.controls['V8OC52EC'].setValue(\"SM14 - Hong Kong\");\
Xojo.controls['JIos5WGe'].setValue(\"SM7 - Canada\");\
Xojo.controls['Erx7GvWZ'].setValue(\"\");\
Xojo.controls['Av9xqvay'].setValue(\"\");\
Xojo.controls['Hde8nlGt'].setValue(\"\");\
Xojo.controls['A96VQyYN'].setValue(\"\");\
Xojo.controls['VhIDNLBI'].setValue(\"\");\
Xojo.controls['H2fZKbXi'].setValue(\"\");\
Xojo.controls['IcxLh0WW'].setValue(\"\");\
Xojo.controls['VmH4zbDm'].setValue(\"\");\
Xojo.controls['FF4rWJZK'].setValue(\"P\");\
Xojo.controls['M8eP2454'].setValue(\"Lap\");\
Xojo.controls['L6MMcy3u'].setValue(\"RESET\");\
Xojo.controls['QkKf9IZE'].setValue(\"C Final\");\
Xojo.comm.ajax.begin();"}

Followed by this which I believe is blanking some fields (What I’ve done in my code example at the bottom)

{"jsSource":"Xojo.controls['Kaugwbxz'].setValue(\"\");\
Xojo.controls['PFfrQFBU'].setValue(\"\");\
Xojo.controls['NmigZVXs'].setValue(\"\");\
Xojo.controls['ZTAolkWB'].setValue(\"\");\
Xojo.controls['GmXBM5f9'].setValue(\"\");\
Xojo.controls['NKrOu8F8'].setValue(\"\");\
Xojo.controls['CPinRRNl'].setValue(\"\");\
Xojo.controls['EhNiDuCc'].setValue(\"\");\
Xojo.controls['FXaw4GhV'].setValue(\"\");\
Xojo.controls['JlDNm2os'].setValue(\"\");\
Xojo.controls['F4HBVu1L'].setValue(\"\");\
Xojo.controls['HzvzF4Zu'].setValue(\"\");\
Xojo.controls['OAC8BQVn'].setValue(\"\");\
Xojo.controls['DHsmZZyT'].setValue(\"\");\
Xojo.controls['PvjqSE1j'].setValue(\"\");\
Xojo.controls['LRysbebt'].setValue(\"\");\
Xojo.controls['AwV65EiK'].setValue(\"\");\
Xojo.controls['KAez0kVx'].setValue(\"\");\
Xojo.controls['OWmWoi06'].setValue(\"\");\
Xojo.controls['MlN878sO'].setValue(\"\");\
Xojo.controls['L1F8odRR'].setValue(\"\");\
Xojo.controls['OklxQ2DJ'].setValue(\"\");\
Xojo.comm.ajax.begin();"}

The code in Xojo is simple

for i = 0 to y

For x = 0  to 10
' etc etc, it does this for each field I'm changing
Pages(i).lblname(x) = 'details here' 
Pages(i).lbltt(x) = 'details here' 
Pages(i).lblbb(x) = ''
next x

' it then does 
pages(i).ExecuteJavaScript

next i

what I want to happen is have the ExecuteJavaScript and the changes I’ve made in my pages loop to happen at the same time, any suggestions would be appreciated.

ExecuteJavaScript just adds the source code to an internal buffer – and internal framework source code which needs to be sent to the client is also append to this buffer. At the end of the WebApplication event loop this buffered JavaScript source code is sent in once to the client. So what you attempt to do is AFAIK not possible.