Since the whole page isn't reloading, can't you capture what is being typed 
using Javascript and then fill the content back in once the component 
refreshes (i.e., do everything client side)?

On Friday, October 28, 2011 5:56:54 PM UTC-4, TheSweetlink wrote:
>
> Hi Anthony and thanks for your reply. 
>
> I do not believe that I can separate the form from the component. 
>
> Think of the component like a message board with a form up top for a 
> main post with comment forms for each post all wrapped into one 
> component. 
>
> All of the forms get blanked upon component reload as that's their 
> original state. 
>
> Any post or comment being typed retains focus for the correct form, 
> but is blanked. 
>
> Even if I broke the component down to two (post and comment) comments 
> would get blanked upon component refresh showing new posts. 
>
> I will attempt my first idea of using web2py's ajax() and a session 
> var and test the performance as it may not be so horrible but I would 
> prefer to have a more efficient method if possible. 
>
> Do you have any other tricks to try? 
>
> David 
>
> On Oct 28, 3:48 pm, Anthony <abas...@gmail.com> wrote: 
> > Can you separate the form being typed in from the data being displayed 
> by 
> > the refresh (i.e., maybe used two separate components)? 
> > 
> > On Friday, October 28, 2011 3:16:41 PM UTC-4, TheSweetlink wrote: 
> > 
> > > 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