I''m playing around with the latest Ajax support in Rails 0.11.0. I''m using the observe field helper to invoke a backend method asynchronously. Everything works fine when I pass a value via the :id url value: <%= observe_field ("zipcode_zip", :url => { :controller => ''zipcode'', :action => ''lookup_with_ajax'', :id => @zipcode.zip }, :frequency => 1, :complete => "$(''zipcode_city'').innerHTML = ''Looked up City''") %> But that''s not what I really try to do. I would like to read out the value from my zip code field: <%= text_field "zipcode", "zip", "size" => 5 %> </p> and pass it to the backend, where it finds the associated city and state. I tried '':with'' but does not seem to work. Any advice? Bonus question: I would like to update the fields <%= text_field "zipcode", "city", "size" => 30 %> <%= text_field "zipcode", "state", "size" => 2 %> with the return values. I assume I need to use :complete => ... ? Again, any help is appreciated.
Hi, Christian Kebekus <christian.kebekus-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote:> But that''s not what I really try to do. I would like to read out the > value from my zip code field: > > <%= text_field "zipcode", "zip", "size" => 5 %> </p> > > and pass it to the backend, where it finds the associated city and > state. I tried '':with'' but does not seem to work. Any advice? > > Bonus question: I would like to update the fields > > <%= text_field "zipcode", "city", "size" => 30 %> > <%= text_field "zipcode", "state", "size" => 2 %> > > with the return values. I assume I need to use :complete => ... ?Here is my solution. http://moriq.tdiary.net/20050324.html#p01 http://moriq.tdiary.net/20050323.html#p01 I''m sorry this include in Japanese. But you can read Ruby :) Bonus solution: Selenium with Ruby on Rails http://moriq.tdiary.net/20050325.html#p01 http://moriq.tdiary.net/20050326.html#p05 ---- Kazuhiro Yoshida moriq-g2rar0VqK2oAvxtiuMwx3w@public.gmane.org