Link_to_remote (AJAX) and tables: IE issues, validation?


#1

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.


#2

On 2/12/06, Henrik N removed_email_address@domain.invalid wrote:

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.

I’ve written an article on this subject, which you can find at
http://www.bigsmoke.us/ajax-validations-in-rails

Please let me know if you find anything uncomplete, unclear or missing,

  • Rowan

#3

BigSmoke wrote:

On 2/12/06, Henrik N removed_email_address@domain.invalid wrote:

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.

I’ve written an article on this subject, which you can find at
http://www.bigsmoke.us/ajax-validations-in-rails

Please let me know if you find anything uncomplete, unclear or missing,

  • Rowan

Hi,

I need help in this matter but that link doesnt seem to be working.
Can u help me.

Neha