I thought the :success only refer to the div id to update in case on 
success ?
Mickael.


Kad Kerforn wrote:
> How should I define the :onsuccess option in my  - link_to_remote - tag, 
> to execute a Js function
> I wrote  :
> :success => "toggleButton(this, /db_bfilter/i);"
> 
> 'this' is the current element defined in my view :
> <span id="db_bfilter0" class="depressed"><%= filter_link_helper "This 
> week" %></span>
> <span id="db_bfilter1" class="raised"><%= filter_link_helper "This 
> month" %></span>
> 
> when hit, the link execute a new filtered search (by week or by month 
> according to the filter_link_helper )
> on success it will toggle to class 'depressed' and other links to  class 
> 'raised'
> 
> the search is correct, but links classes don't toggle, as my :success 
> option seems to be incorrect....
> 
> my js function  toggle a button to simulate radio type buttons
> 
> function toggleButton(elementObj, idRegex) {
>   var arraySpans = document.body.getElementsByTagName("SPAN");
>   for(var i = 0; i < arraySpans.length; i++) {
>     if(arraySpans[i].id.match(idRegex)) {
>       arraySpans[i].className = 'raised';
>     }
>   }
>   elementObj.className = 'depressed';
> }

-- 
Posted via http://www.ruby-forum.com/.

--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups "Ruby 
on Rails: Talk" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to 
[email protected]
For more options, visit this group at 
http://groups.google.com/group/rubyonrails-talk?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to