Hey there :)
Ive got clients and domains and a form containing this:
<%@clients = Client.find(:all, :order => "business_name")
collection_select(:service, :client_id, @clients, :id, :business_name)
%>
Then Ive got an observer field:
<%=observe_field("service[client_id]", :update =>
:domains_container,
:url => {:action => :ajax_domains}, :on => "changed") %>
and the 2nd select
<div id="domains_container">
<%@domains = Domain.find(:all, :order => "name ASC").map {|d|
[d.name,
d.id]}
                                select(:service, :domain_id, domains)
%>
</div>
And the controller bit:
def ajax_domains
       render_text("test")
end
For some reason "test" doesnt appear anywhere. it doesnt look like the
observer is working.
Any clues?
Petr
-- 
Posted via http://www.ruby-forum.com/.
--~--~---------~--~----~------------~-------~--~----~
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-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org
To unsubscribe from this group, send email to
rubyonrails-talk-unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org
For more options, visit this group at
http://groups.google.com/group/rubyonrails-talk?hl=en
-~----------~----~----~----~------~----~------~--~---
And I do have <%=javascript_include_tag :defaults%> In the layout. -- Posted via http://www.ruby-forum.com/. --~--~---------~--~----~------------~-------~--~----~ 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-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk-unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en -~----------~----~----~----~------~----~------~--~---
Petr Janda wrote:> Hey there :) > Ive got clients and domains and a form containing this: > > <%> @clients = Client.find(:all, :order => "business_name") > collection_select(:service, :client_id, @clients, :id, :business_name) > %> >When I look at the HTML produced by collection_select(:service, :client_id, [''1'',''2'',''3''], :to_s,:to_i) I get <select id="service_client_id" name="service[client_id]"> <option value="1">1</option> <option value="2">2</option> <option value="3">3</option> </select>> Then Ive got an observer field: > > <%=observe_field("service[client_id]", :update => :domains_container, > :url => {:action => :ajax_domains}, :on => "changed") %>So it seems your observe_field should go for the id service_client_id, and not service[client_id] Stephan -- Posted via http://www.ruby-forum.com/. --~--~---------~--~----~------------~-------~--~----~ 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-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk-unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en -~----------~----~----~----~------~----~------~--~---