RJS creates JavaScript, which prints to screen instead of ev

I have a partial named “_mailing_list.rhtml” ~

<% remote_form_for(:recipient, :url=> { :controller =>
‘recipients’, :action => ‘create’ }) do |f| %>

Email: <%= f.text_field :email_address, :size => 20 -%> <%= submit_tag "Subscribe", :disable_with => "Please wait..." %>

<% 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 ~

page[:mailing_list].reload

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

On 8/8/07, Dan C. [email protected] wrote:

<% end %>
page[:mailing_list].reload

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 -%>

HTH
Daniel

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.