I am having problems utilizing the ":update => {:success =>
''item_list''}" option for form_remote_tag.
How do I indicate to form_remote_tag that the function "create" was
successful?
If I just use the line ":update => "item_list" everything
works fine,
except that when I get an error, the error message is added to the
''item_list'' div tags since I can''t distinguish a
failure from a
success.
my app/views/item/index.rhtml for the controller in question is:
<%= form_remote_tag :url => {:action => :create},
:position => "top",
:update => {:success =>
''data_list''},
:loading => ''item_loading()'',
:complete => ''item_added()'' %>
<%= render :partial => "form" %>
<%= end_form_tag %>
my app/controllers/item_controller.rb is:
def create
@item = Item.new(@params[:item])
if @item.save
render :partial => "item", :object => @item
else
render :text => "form error"
end
end
I am using ruby 1.8.2 and rails 0.13.1 on lighttpd 1.3.13 and webrick 1.3.1
Thanks,
Mark