I have a table that lists domain names, with a form next to it to add
new domains.
I have AJAXified this so that new domains are immediately added as table
rows. This works fine in Firefox 1.5/Win, but not in IE6/Win. Domains
are added into the database, but the HTML table is not updated unless
you reload the page.
Some googling tells me there are issues with e.g. link_to_remote
updating tables in IE (I tried updating a div and that worked fine), so
I’m simply asking if anyone knows of a decent solution, other than going
non-AJAX, dropping IE support or using something other than a table.
Also, has anyone written code to get validations with link_to_remote? So
if someone attempts to add a non-valid domain, you would get some sort
of readable error message.
Some of my code:
View:
<%= form_remote_tag(
:url => { :action => ‘create’ },
:update => “items”,
:position => :bottom,
:complete => ‘focus_field()’) %>
Controller:
def create
@domain = Domain.new(params[:domain])
if @domain.save
render(:partial => ‘domain’, :object => @domain, :layout => false)
else
#FIXME: No decent error handling yet - try adding duplicate
domains
render :action => ‘new’
end
end
where “items” is a table and the domain partial a table row.