RJS render :action not working?

Hi,everyone

I almost give up in this problem.I simply want to flash a notice at the
bottom of the page when add_place is done.

in my view,i have
<%= start_form_tag({:action => “add_place”}) %>


<%= submit_tag(‘Add Place’) %> or <%= cancel %>
<%= end_form_tag %>

I have a method in the controller

def add_place


render :action=>“flash_notice”
end

I want to display a flashed notice “place is saved in the database” at
the end of the method.

and flash_notice.rjs is like

page.insert_html :bottom,‘my_notice’, :partial=>‘add_place’
page.visual_effect :highlight, ‘my_notice’

_add_place.rhtml

<%= flash[:notice] = ‘Place was successfully saved’ %>

when I do this, the page refreshes, instead of doing the right thing,
the page simply displays my code.

new Insertion.Bottom(“my_notice”, “Place was successfully saved”);
new Effect.Highlight(“my_notice”,{});

anybody has some ideas?
greatly appreciated for any help!

Jacquie,

Use form_remote_tag instead. form_tag fires a regular POST requests, and
the
browser is correctly displaying the results. If you want an AJAX call
(as
you do), use form_remote_tag instead of start_form_tag.

Make sure you check the API docs (api.rubyonrails.org) because the
parameters for form_remote_tag are slightly different than form_tag.

Matt

On 12/6/06, jacquie [email protected] wrote:

    ...

end


Posted via http://www.ruby-forum.com/.


Matt W.

Thermal Creative
http://blog.thermalcreative.com

No problem… I like the easy ones :wink:

On 12/7/06, jacquie [email protected] wrote:

Use form_remote_tag instead. form_tag fires a regular POST requests, and
On 12/6/06, jacquie [email protected] wrote:


Matt W.

Thermal Creative
http://blog.thermalcreative.com

Geez. Thanks so much, Matt.

I’ve changed start_form_tag to form_remote_tag, and it works straight
away!!!

Matt W. wrote:

Jacquie,

Use form_remote_tag instead. form_tag fires a regular POST requests, and
the
browser is correctly displaying the results. If you want an AJAX call
(as
you do), use form_remote_tag instead of start_form_tag.

Make sure you check the API docs (api.rubyonrails.org) because the
parameters for form_remote_tag are slightly different than form_tag.

Matt

On 12/6/06, jacquie [email protected] wrote:

    ...

end


Posted via http://www.ruby-forum.com/.


Matt W.

Thermal Creative
http://blog.thermalcreative.com