Re: dynamic form problem

Jedrin
Fri, 25 Sep 2009 15:04:02 -0000

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...-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>
wrote:
> On Thu, Sep 24, 2009 at 2:11 PM, Jedrin
<jrubia...-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> 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...-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org
> twitter: @hassan