on 2005-11-22 05:45
on 2005-11-22 06:53
I had to implement similar behavior and got stuck just like you did. I did implement a solution that is less than optimal but it works. Perhaps someone out there has a better solution. The way I have solved this is in your ajax callback from the first combo list spew out the select html for the second based on the observer pattern. Thus when the user changes the selection on combo1 you can define a div in the original page which content will populated using the html block returned by the ajax callback. In you callback you 'compute' something like that: render_text "<select id='combo2> <option1...> <option2...>...</select>" This makes it harder to style and maintain... But it does get the job done.. Hope this helps...
on 2005-11-22 16:01
The first parameter of observer_field should be the id and not the name of the select So in your case it would have to be: observe_field 'call_client_id' bogdan
on 2005-11-22 17:50
Thanks, Bogdan! That did the trick. I was trying different names, but I had not thought about the tag id. Also I needed to get the value selected from the first drop-down box to build the data for the second. Here is what I determined I needed for the controller to populate the second box. def load_contacts client_id = request.raw_post @contacts = ClientContact.find :all, :order =>"privilege desc,name", :conditions=>["client_id=?",client_id] render :layout=>false end