Get html value

Hi,
I need that when I enter a value in a textfield and press enter it add a new row in a table. This is easily implemented with normal vaadin, but I need it in javascript because I don`t want to connect to the server each time I add a row to the table. This is because the internet connection in the place the application is gonna run is very low.
I get this working fine using a widget, the problem now is that I need to get in the server the values that the table contains.

Thanks for your help.

Well, you could easily add multiple rows by having multiple input fields.
Imho, a Java Servlet is not the right thing for you, if you look for really low communication.
In your case, I’d use plain HTML and a intelligent server.
The less pictures and code you have to transfer, the less data has to be transferred.
In the beginnings of the web, the connections were slow, and the layout had to be small enough to load in acceptable amounts of time.
So, go with simple HTML and POST-Requests.

Apexys

Argh, I hate this forum, it logged me out while I wrote the answer, and Firefox cannot recover text from a JavaScript-generated text field. Good old HTML indeed has some good sides (or this forum should do auto-save of drafts).

Anyway, to the point, again.
In short, Vaadin shines on modern networks with good throughput, but might not be the best suited for high latency/low bandwidth networks. Other GWT frameworks might be more suited for this, as more logic lives on the client side, allowing more operations without server intervention.
Although I doubt they are able to update a table directly from a form. On validation, I think a server roundtrip is necessary.

If you want to stick to Vaadin, since it is a nice environment, I see two choices for you:

  • Develop your own custom component with direct JavaScript communication between the form and the table. Quite some work… And the data must be sent at the end, anyway.
  • If you have only one text field as your post suggest, you can make a multiline one, and upon validation, split the lines and use them to feed the rows. Somehow, it allows a better user experience (fast switch between fields to fix a previous one, etc.).