Link_to_remote possible with :class AND progress indicators?

I have the following code:

<%= image_tag "spinner.gif" %>

<%= link_to_remote(‘Add Entry’, {:update => ‘add-entry’,
:url => { :action => “show_add_entry” }},
:loading => “Element.show(‘loader’)”,
:complete => “Element.hide(‘loader’)”,
:class => “create”) %>

It seems that I can either have a :class styling the link and not have
the progress indicators via :loading/:complete or the other way around
but not both. It there a way to modify this code to have my link styled
via my class and also have the :loading/:complete callbacks work on
click as well? Thanks.

Marston A. wrote:

I have the following code:

<%= image_tag "spinner.gif" %>

<%= link_to_remote(‘Add Entry’, {:update => ‘add-entry’,
:url => { :action => “show_add_entry” }},
:loading => “Element.show(‘loader’)”,
:complete => “Element.hide(‘loader’)”,
:class => “create”) %>

It seems that I can either have a :class styling the link and not have
the progress indicators via :loading/:complete or the other way around
but not both. It there a way to modify this code to have my link styled
via my class and also have the :loading/:complete callbacks work on
click as well? Thanks.

The problem with your code is that :class should be in another hash.
link_to_remote takes two hashes, options and html_options. By closing
the first hash (the one with :update), you’re putting the loading and
complete ones into html_options. Try reorganizing your options a little
and it should work.