RJS element is null, Prototype Error?

Hi there,

if got some problems getting the Ajax.Request to work with rails.

sending the request via onclick works but the interpretaition fails
if I execute:

render :update do |page|
page.replace 'test', :text => 'it works'

I get 2 alerts:
RJS error:
TypeError: $("#test") is null

$("#test").replaceWith("it works");

TypeError: $("#test").replaceWith is not a function

$("#test").replaceWith("it works");

I did <%= javascript_include_tag :default %> in the application, but i'm
not quite sure if prototype is really implemented. How can I check this?

WIth prototype if an element's id is test then you'd want $('test') to
get that element (if you want css selectors with prototype use $$)

Prototype v.2.0.0

Unlikely - the latest version of prototype is the 1.7 release


page.replace seems to be a helper which automatically searchs for
in other rails-projects it always worked liked that.

the v.2.0.0 I got by listing my gems via command line.

Isn't there a possibility to get the "page.replace" to work?

if i do
everything is fine

How can I get the "page.replace" to work?

new infos:

If i try the page.insert_html in my errored application, i get for
page.insert_html, :bottom, "test", :text => "it works."

try {
$("#test").append("it works.");
} catch (e) { alert('RJS error:\n\n' + e.toString());
alert('$(\"#test555\").append(\"it works.\");'); throw e }

In an application where all works fine, page.insert_html, :bottom,
"test", :text => "it works." is interpreted as:

Element.insert("test", { bottom: ... ...

Why is it not interpreted in my first application this way?

Thank you very much.