Forum: Ruby on Rails problems with scriptaculous..

Announcement (2017-05-07): www.ruby-forum.com is now read-only since I unfortunately do not have the time to support and maintain the forum any more. Please see rubyonrails.org/community and ruby-lang.org/en/community for other Rails- und Ruby-related community platforms.
Fddbb3cd16868f4741c2e86ef015a639?d=identicon&s=25 Sergio T. Ruiz (sergio101)
on 2009-05-06 21:38
for some reason, i am having the hardest time with the simplest possible
use of a visual effect..

i have done this a million times, and this is first time i have had this
much trouble.

here's what i am trying to do:

1. set up a div with a link_to_remote that references its containing div
[1].
2. once some backend processing is done, the generated javascript will
remove the div[2].

everything works fine.. the action gets fired off.. everything that
needs to happen happens.

except..

the div does not PUFF go away..

any help would be appreciated..

thanks!

[1]

,----
| <% dom_id =  "desc_entry_#{@desc.id}" -%>
|
| <div id="<%= dom_id %> "  ><%= @desc.desc_type  %>:
|   <%= text_field_tag "description[#{@desc.field_desc}]" %>
|   <%=link_to_remote "remove", :url => {:action => "remove_item", :desc_id => @desc.id}, 
:complete => visual_effect(:puff, dom_id, :duration => 0.5 ) %>
| </div>
`----

[2]

,----
| <div id="desc_entry_2 "  >Short Description:
|   <input id="description_desc_short" name="description[desc_short]" type="text" />
|   <a href="#" onclick="new Ajax.Request('/admin/remove_item?desc_id=2', 
{asynchronous:true, evalScripts
| :true, onComplete:function(request){new 
Effect.Highlightfasdf(&quot;desc_entry_2&quot;,{duration:0.5
| });}, parameters:'authenticity_token=' + 
encodeURIComponent('e8447179b980016c867fd3d5de911e456b65edae'
| )}); return false;">remove</a>
| </div>
`----
1e7782e67bb34c9c67ed19d5cde5f4eb?d=identicon&s=25 Tom Z Meinlschmidt (Guest)
on 2009-05-07 01:42
(Received via mailing list)
try to:

1. change async mode of ajax to synchronous (to asynchronous:false)

or

2. fire visual_effect from controller (instead of js) via
render :update do |page|
   page.visual_effect :puff,'dom_id'
end

tom

Sergio Ruiz wrote:
> 2. once some backend processing is done, the generated javascript will
>
> | </div>
> | )}); return false;">remove</a>
> | </div>
> `----


--
===============================================================================
Tomas Meinlschmidt, MS {MCT, MCP+I, MCSE, AER}, NetApp Filer/NetCache

www.meinlschmidt.com  www.maxwellrender.cz  www.lightgems.cz
===============================================================================
Fddbb3cd16868f4741c2e86ef015a639?d=identicon&s=25 Sergio T. Ruiz (sergio101)
on 2009-05-07 16:13
hmm.. for some reason, neither of these work...

this is really perplexing me..
Fddbb3cd16868f4741c2e86ef015a639?d=identicon&s=25 Sergio T. Ruiz (sergio101)
on 2009-05-07 16:23
okay, i found it.. i am stupid..

there is a space in the div  name..

<div id="desc_entry_2 "  >

i removed the space, and it works fine..

i suck..
This topic is locked and can not be replied to.