Hi,

I have a form with two drop down menus.
Depending on what the user selects in the first, the second should be
populated accordingly.

Here is the code I am using to do this.

View (test.html.erb):
<% form_for :applicant, :url=> {:action => "index"} do |f| %>

<%= f.label :topic_1 %>
<%= f.select :topic_1, ["a", "b", "c", "d", "e", "f"], :include_blank =>
true %>

<%= observe_field "applicant_topic_1", :update => "applicant_member_1",
:with => "topic_1", :url => { :controller => "form", :action =>
"get_members_1" } %>

<%= f.label :member_1 %>
<%= f.select :member_1, ["Please select topic 1 first"] %>

---
Controller:
def get_members_1
@members_1 = Member.find_all_by_topic params[:topic_1]
end

---
View (get_members_1.html.erb):
<option value="1">This is no. 1</option>
(I have shortened this for sake of simplicity. Normally a lookup of all
members would take place here)

As you can see, when the user enters something in 'topic_1' the
observe_field helper calls the method 'get_members_1' in the controller,
and updates the field 'member_1' dynamically.

Here is this example in action: http://localhost:3000/test

My problem is that this works fine in FF, IE, Chrome and Opera, but it
doesn't work at all in Konqueror.

I have Googled the problem and come up empty handed.

This is the java script that the helper generates:

<![CDATA[
new Form.Element.EventObserver('applicant_topic_1', function(element,
value) {new Ajax.Updater('applicant_member_1', '/test/get_members_1',
{asynchronous:true, evalScripts:true, parameters:'topic_1=' +
encodeURIComponent(value) + '&authenticity_token=' +
encodeURIComponent('EWNBpyzHQtObzxZbuXqg2s0tUHw8JWJhaeKZiyvWO9E=')})})
//]]>

Can anybody point me in the right direction to sort this out?
I am relatively ok at ruby / rails, but a beginner regarding java script
/ ajax.

I also had a look on the rails doc page regarding observe_field, but I
cannot see what I am doing wrong.

I would be grateful for any help.
-- 
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@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