Hi all
i’m using link_to_remote to render different sets of text-input fields.
i’m setting up links in a sidebar to do this
so, in my _sidebar.rhtml i have
<%= SidebarItem(‘catalogue’) %>
this works…(in works.helper.rb)
def SidebarItem(name)
link_to_remote “#{name}”,
:update => ‘EditFields’,
:url=> {:action => name, :id => @work.id, :layout => false }
end
and i have the following in works.controller.rb
def catalogue
@work = Work.find(params[:id])
render :partial => 'catalogue'
end
but when i try to save the @work before moving to a new set of fields,
making this change doesn’t work how i want…
def SidebarItem(name)
link_to_remote “#{name}”,
:update => ‘EditFields’,
:before => “document.form1.submit();”,
:url=> {:action => name, :id => @work.id, :layout => false }
end
my form is this
my question is this - how do i define the action ‘update_part’ in
works.controller.rb so that it just saves the current work but doesn’t
redirect anywhere or render anything?
if i use the out-of-the-box :action => ‘update’, i briefly see my new
set of fields but it’s then clobbered by the
redirect_to :action => ‘show’, :id => @work
if i swap this with render: nothing => :true i briefly see the new
fields before getting a blank screen
thanks guys