Web MessageBox Doesn't display synchronously?

In trapping user input in a Web Text Field, I handle the TextChanged Event. If the value falls outside of allowable parameters, I post a MessageBox with a note to get the user back on track.

While this works, it is so slow that it doesn’t appear until the user has moved two more fields away.

Is there a way to cause the MessageBox to be Modal at the point it’s called?

You do not specify if your project is of type Web 1 or Web 2. In Web 1 - maybe in Web 2 also - the client is not updated by the server until the last return is hit.

NO

For that, Xojo has to allow client side code as many other tools but they said that it is not going to happen.

So, you have to consider the delay in the TextChanged Event nof firing each keystroke, the delay for the client to send the event. After you send the MessageBox command, another delay for the framework to actually send it, the delay of the actual comunication, and finally the browser showing it.

1 Like

With Web, everything is asynchronous.

On top of it, depending on the distance between the server and the client, the round trip for the client to report an event in the server side program can easily take 200 ms.

Using TextChanged is probably much too slow to really do data validation real time.

The only way to obtain something close to Desktop is to use a JavaScript client side validation.

https://www.w3schools.com/js/js_validation.asp

If you are not comfortable enough with Javascript, perhaps you can refactor your WebTextField with an OK button which validates only when entry is complete.

2 Likes

It is important to remember that Web apps are not desktop apps. +1 for this, it is the route I would go:

It turns out that the applet running live (CGI) is snappy enough to catch the user’s input in close enough to real time as to make it work.