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]
%>

<div class="box" id="permissions">
        <div class="box_container" style="width:500px;">
        <div id="permissions_labels">
                <ul>
                <% tabs.each do |tab| -%>
                    <li><%= 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;" %></li>
                <% end -%>
                </ul>
        </div>

        <div id="permissions_tabs">
                <% 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 -%>
        </div>
        </div>
</div>

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;
}

--~--~---------~--~----~------------~-------~--~----~
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