Send state to server upon server RPC request

Hi.

I have a problem with transmitting the state of a TextField to the server. The problem is quite tricky…

I have a simple (immediate = true) TextField with some text in it. The second part of the problem is an extension (on the UI) that I developed, which sends a request to the server. When this request is processed at the server I need the data currently present in the TextField. The problem is that the state of the TextField is not transmitted when the ServerRPC call happens and is not included in it.

The default behaviour of the TextField is to send the data on Blur (TextChangeEventMode.LAZY) or after each keypress (EAGER). While in theory TextChangeEventMode.EAGER does what I want, it has two downsides. 1. If you type something in the text field it becomes quite laggy. 2. Because it is transmitted asynchronous their is a good chance that the last key presses haven’t arrived at the server yet.

Is it possible to send the client side changes with the rpc request to the server similar to how vaadin does it or trigger a blocking transmit of the changes first before doing the server rpc call?

My Extension is hooked to the NativePreviewEvent und through it I can retrive the EventTarget, which i guess(!) is the TextField which still holds the focus. Sadly I don’t have any idea how to trigger an update on the field with the reference.

Thank You

I still trying to circumvent this problem, but it gets harder and harder to do.

Does anyone know if there is something that I could call, that sends the client state to the server before I do my original request?

I would be really happy for any ideas that would help to solve this.

PS: Maybe this would fit better to the “Addons” section.