Since I rerender the form using ajax, I am not sure if
document.myform.myfield.focus() will work and I have not had any luck.
Is there a way to focus through RJS ?

 The best approach I can think of is to get rid of the form and have a
field observer for each field, save the values in a session and when
the user clicks the save button, I treat it as if it was a form
submit. I'm not so much of a web expert on these kinds of things and I
end up doing whatever I can make sense of if I can't find a decent
example someplace ..



On Sep 24, 6:03 pm, Hassan Schroeder <hassan.schroe...@gmail.com>
wrote:
> On Thu, Sep 24, 2009 at 2:11 PM, Jedrin <jrubia...@gmail.com> wrote:
> >  Actually, the problem with re rendering the form and setting the
> > focus is knowing what the focus was before observe_form sent the
> > request to the server. The most obvious hack way is to keep the form
> > values in a session and see which one changed since the last time.
>
> I'd think the most obvious would be to have each focus() event save
> the target element's id to a single global variable, and use that value
> to reset the focus afterwards.
>
> Just a thought.
> --
> Hassan Schroeder ------------------------ hassan.schroe...@gmail.com
> twitter: @hassan
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups "Ruby 
on Rails: Talk" group.
To post to this group, send email to rubyonrails-talk@googlegroups.com
To unsubscribe from this group, send email to 
rubyonrails-talk+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/rubyonrails-talk?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to