Ajax window and Element.show when onclick


#1

in a page I have a list of modules in a div (left), and the
permissions radio boxes for this module displyed on the irght
when clicking on a module name, the related permissions are displayed

when using html, it works well… a click on a module label (on the
left) show the element on the right (dib w permissions)
BUT when using an Ajax form, the first display is correct, clicking on
another module name reach directly to html page
to show the permissions… so I was told that a JS error occursed…

looking into the Firebug console, I can see an error

Error : missing ) after argument list
Source File : http://localhost:3000/intranet-dev/admin
Line : 1, Column : 65
Source Code :
showTab(‘boards’); this.blur(); Element.show(‘tab-content-boards’}):
return false;
---------------------------------------------------------------------------------------|
arrow between } and )
did I miss any specific parameter w Ajax ? this line execute
correctly when html only

my form view :

<% tabs = role_permissions_tabs %>
<% selected_tab = params[:tab] ? params[:tab].to_s : tabs.first[:name]
%>

    <% tabs.each do |tab| -%>
  • <%= link_to tab[:label], { :tab => tab[:name] }, :id => "tab-#{tab[:name]}", :class => (tab[:name] != selected_tab ? nil : 'selected'), :onclick => "showTab('#{tab[:name]}'); this.blur(); Element.show('tab-content-#{tab[:name]}'}): return false;" %>
  • <% end -%>
<% tabs.each do |tab| -%> <%= content_tag('div', render(:partial => 'roles/ permissions', :locals => {:perms => tab[:perms]}), :id => "tab- content-#{tab[:name]}", :style => (tab[:name] != selected_tab ? 'display:none' : nil), :class => 'tab-content') %> <% end -%>

and the Showtab function in the js file

function showTab(name) {
var f = $$(‘div#content .tab-content’);
for(var i=0; i<f.length; i++){
Element.hide(f[i]);
}
var f = $$(‘div.tabs a’);
for(var i=0; i<f.length; i++){
Element.removeClassName(f[i], “selected”);
}
Element.show(‘tab-content-’ + name);
Element.addClassName(‘tab-’ + name, “selected”);
return false;
}