hi - i''ve been stumped on this for a while now, though i''ve read through the ajax section of ''agile development'', and searched the list archives to no avail. i would like a link_to_remote() tag that can ''Element.hide(''search-indicator'')"'' when the request is complete, as well as have the new view appear in an ajax effect. in the ''agile development'' book it has, in separate sections, both these things being done in the '':complete'' category. so far i haven''t managed to successfully combine them. below is the (modified for simplicity) code i''ve got so far which is producing errors: <%link_to_remote( image_tag("arrowsmall.gif"), :update => ''msgdiv'', :url => { :action => :get_msg, :id => msg.date }, :loading => "Element.show(''search-indicator'')", :complete => {"Element.hide(''search-indicator'')", "new Effect.Puff(''msgdiv'')" } # this bit i''m having trouble with ) %> any help would be appreciated thanks luke
It''s JavaScript that goes inside :complete, so you need to seperate by using ";". :complete => "Element.hide(''search-indicator''); new Effect.Puff (''msgdiv'')" Thomas Am 03.08.2005 um 10:43 schrieb luke:> below is the (modified for simplicity) code i''ve got so far which > is producing > errors: > > <%> link_to_remote( > image_tag("arrowsmall.gif"), > :update => ''msgdiv'', > :url => { :action => :get_msg, :id => msg.date }, > :loading => "Element.show(''search-indicator'')", > :complete => {"Element.hide(''search-indicator'')", "new Effect.Puff > (''msgdiv'')" } > # this bit i''m having trouble with > ) %>
another way in this instance may be to also use the :success callback which would be called just before the :complete callback is called. Regards, Francois Paul luke wrote:>hi - > >i''ve been stumped on this for a while now, though i''ve read through the ajax >section of ''agile development'', and searched the list archives to no avail. > >i would like a link_to_remote() tag that can >''Element.hide(''search-indicator'')"'' when the request is complete, as well as >have the new view appear in an ajax effect. in the ''agile development'' book it >has, in separate sections, both these things being done in the '':complete'' >category. so far i haven''t managed to successfully combine them. > >below is the (modified for simplicity) code i''ve got so far which is producing >errors: > ><%>link_to_remote( >image_tag("arrowsmall.gif"), >:update => ''msgdiv'', >:url => { :action => :get_msg, :id => msg.date }, >:loading => "Element.show(''search-indicator'')", >:complete => {"Element.hide(''search-indicator'')", "new Effect.Puff(''msgdiv'')" } ># this bit i''m having trouble with >) %> > >any help would be appreciated > >thanks > >luke > >_______________________________________________ >Rails mailing list >Rails-1W37MKcQCpIf0INCOvqR/iCwEArCW2h5@public.gmane.org >http://lists.rubyonrails.org/mailman/listinfo/rails > > >