Need help 'observe_field' to work in Safari or Konqueror

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):

This is no. 1 (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=')})}) //]]> <p>Can anybody point me in the right direction to sort this out?<br> I am relatively ok at ruby / rails, but a beginner regarding java script<br> / ajax.</p> <p>I also had a look on the rails doc page regarding observe_field, but I<br> cannot see what I am doing wrong.</p> <p>I would be grateful for any help.</p>

That’ll teach me to re-read things before I post.
The URL is: http://igsn-application.de/test/
Sorry!

Konquerer isn’t officially supported by Prototype.js which Rails uses
for it’s Ajax stuff.

The latest version of Prototype is compatible with the following
browsers:
Browser Version(s)
Mozilla Firefox ≥ 1.5
Microsoft Internet Explorer ≥ 6.0
Apple Safari ≥ 2.0
Opera ≥ 9.25

There should be no issue with Safari 3 or 2.

On Jun 8, 1:30Â am, Jim B. [email protected]

After a couple of days of tearing my hair out I have solved the problem
another way. I have ditched the use of the ‘observe_field’ helpers and
written the routine from scratch in java script.

Now it works in all of these browsers.

If anyone else stumbles accross this thread, I was greatly helped by
this howto:

Hi,

Thanks for replying

Konquerer isn’t officially supported by Prototype.js which Rails uses
for it’s Ajax stuff.

That’s not so bad. Konqueror I can live without (although it’s not
perfect)

There should be no issue with Safari 3 or 2.

I am running Safari 4 public beta on Windows and the script
(http://igsn-application.de) doesn’t work in this browser.
It also doesn’t work on Chrome 2.0.172.30.

It does however, work fine in FFox, IE and Opera.

What the browsers in which it doesn’t work have in common is that they
are built on KHTML or Webkit (a fork of KHTML). Might this have
something to do with it?

I tried debugging the webpage with Safari’s java script debugger. I get
no errors, one warning and the following output:

Warning. Resource interpreted as script but transferred with MIME type
text/html.(index.js)
XHR finished loading: “http://igsn-application.de/test/get_members_1
prototype.js (line 1437).

It seems to me that the script is fetching the html to display in the
drop down box, but not displaying it for some reason. Or maybe rendering
it off of the page??

I have also updated prototype to the latest version (1.6.1_rc2)

Can anyone give me a hint as to what I am doing wrong or where I could
start looking to solve this problem (all Google searches so far came up
blank).

Thanks for your time.