I have an app that polls for new messages and reloads a component when
there are new messages.

My problem is that when the component is refreshed/reloaded while a
user is typing, the message being typed disappears.

This makes sense because the component contains the form being
submitted.  For example refreshing the page before a form submission,
the refreshed page won't contain whatever was being typed.

I wish to retain the form data after the component is refreshed so
that the user can continue typing a message without having everything
blanked every time a new message appears.

What do you recommend as a method to keep what is being typed across a
component reload?

All I can think of right now is using web2py's ajax() to keep feeding
a session var whatever is being typed using JQuery's .change()

If there is anything in the session var, display it after the
component reload.  Upon form submission, clear the session var.

It just seems awfully inefficient to update a session var with the
ajax function for every character typed.

Can you suggest a smarter way of retaining the form's data after a
component reload?

Your help is most appreciated.

David

Reply via email to