I am using a form_remote_tag to create a new object in my web page. When the save is successful, then it displays the list and added current object in a partial. I have two questions: 1. When the save fails, i want it to just revert back to the original list, and close the form that allows users to add new objects. 2. I would like my Cancel button on creating this new object to work, presently I can close the form, but then I get a MIssing Template message in the screen, or with some hacking, the objects list duplicates itself in the render. :- so on this 2nd point, I want to know how to escapoe the render and revert back to the main list, on when first entering the page. I have tried :render and :redirect_to but this just duplicates the list again in the same page. MY CONTROLLER: # create a new product def create @products = Product.find(:all) @product = Product.new(params[:product]) if @product.save render :partial => ''product'' else redirect_to :action => ''list'', :id => @product end end MY VIEW: <h3>Products</h3> <div id ="test"> <ul id="product_list"> <% @products.each do |p| %> <li><%= link_to p.title, :action => ''show_versions'', :id => p.id %> <%= "(#{p.versions.count})" -%></li> <b><%= link_to ''Edit'', {:action => ''edit'', :id => p.id} %></b> <b> <%= link_to "Delete", {:action => ''delete'', :id => p.id}, :confirm => "Are you sure you want to delete this product?" %></b> <% end %> </ul> </div> <p id=''add_link''><%= link_to_function("Add a new Product", ''Element.show(add_product)'')%></p> <div id=''add_product'' style="display:none;"> <%= form_remote_tag(:url => {:action => ''create''}, :update => "product_list", :position => :bottom, :html => {:id => ''product_list''})%> <p>Name: <%= text_field "product", "title" %> </p> <p>Description: <%= text_area "product", "description", :size => "30x10" %></p> <%= submit_tag ''Add'', :onclick=> ''Element.hide(add_product)'' %> <%= button_to ''Cancel'', :onclick=> ''Element.hide(add_product)'' %> </div> Even some suggestions would be great, because googling this issue, doesnt really churn up much. -- Posted via http://www.ruby-forum.com/. --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To post to this group, send email to rubyonrails-talk-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk+unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en -~----------~----~----~----~------~----~------~--~---