RJS creates JavaScript, which prints to screen instead of evaluating

I have a partial named "_mailing_list.rhtml" ~

<% remote_form_for(:recipient, :url=> { :controller => 'recipients', :action => 'create' }) do |f| %>   <p>     Email: <%= f.text_field :email_address, :size => 20 -%>     <%= submit_tag "Subscribe", :disable_with => "Please wait..." %>   </p> <% end %>

I have a create action in my recipients controller ~

def create   @recipient = Recipient.new(params[:recipient])   @recipient.save end

I have a create.rjs ~


The Recipient ActiveRecord correctly updates the database and the RJS creates the JavaScript I want, but rather than executing the JavaScript, I see it printed to my screen and the URL changed to / recipients/create

What am I doing wrong?

Thanks, Dan

Have you included the prototype.js library in your layout?

<%= javascript_include_tag :defaults -%>



Yes, and the source file shows prototype.js, etc. included.

Have you updated the default javascript files since you created your rails project? I don't know exactly why that might break your code, but I had the same problem you're describing after I tried to update the prototype and scriptaculous files to the latest versions. Once I reverted back to what shipped with my version of Rails, my RJS templates worked again.