Problems with link_to_function----Help

Hi,

I am using link_to_remote to update part of the page. The new content
that is going to replace the original one has javascript tabs. The
problem is the javascript tabs doesn’t work in this situation. The tabs
works fine when I use link_to to navigate through pages. The javascript
validation in the new content is working. Where did it went wrong?
Someone please help.

Thanks.

…my_view.rhtml(original content)…
<%= javascript_include_tag :defaults %>

<%= link_to_remote “Show Items”, :update => “operation_panel”, :url =>
{:controller => “item”, :action => “index”, :id => item.id} %>

…item.rhtml(new content)…
<%= javascript_include_tag “tabpane.js” %>

Pass List

<% for item in @item %>
<tr>

<%= link_to_remote item.name, :update => "operation_panel", :url =>

{:controller => “item”, :action => “items”, :id => item.id} %>

<% end %>

</div>
<script type="text/javascript">
    setupAllTabs();
    document.getElementById("item_tab").show();
</script>

user splash wrote:

Hi,

I am using link_to_remote to update part of the page. The new content
that is going to replace the original one has javascript tabs. The
problem is the javascript tabs doesn’t work in this situation. The tabs
works fine when I use link_to to navigate through pages. The javascript
validation in the new content is working. Where did it went wrong?
Someone please help.

Hi,

Sorry my mistake. This problem doesnt happen to my link_to_remote. The
above problem is happening to my javascript tree menu. When the link is
clicked, the tabs are not showing. Where did it went wrong? How can I
write a javascript that resembles link_to_remote? Please help

Thanks

…tree menu…

function ajax_init() {

var myajax = new Ajax.Request;
return myajax;

}

function drawTree ( tree_items ,div_id ) {

new tree (tree_items , TREE_TPL, 

document.getElementById(‘profile_tree_panel’) );
callbackfunction = get_detail;
}

function get_detail( args ) {

var target_url = args.split('_')[0];
target_url = target_url.replace(/-/g,"_");
unknown_url = target_url.split('*');

var myajax = ajax_init();
switch(unknown_url[1])
{
    case "0":
        new_url = unknown_url[0] + "?name=0"
        break;
    case undefined:
        new_url = target_url
        break;
    case "Total":
        new_url = unknown_url[0] + "?name=1"
        break;
    case "Site":
        new_url = unknown_url[0] + "?name=2"
        break;
    default:
        new_url = unknown_url[0] + "?name=3"
}


 detail_response=document.getElementById('operation_panel').innerHTML

myajax.request(new_url);
myajax.transport.onreadystatechange = function() {

    if(myajax.transport.readyState == 4) {
    document.getElementById('operation_panel').innerHTML = 

myajax.transport.responseText
}

    }
}

On Jul 7, 8:22 am, user splash [email protected]
wrote:

Hi,

Sorry my mistake. This problem doesnt happen to my link_to_remote. The
above problem is happening to my javascript tree menu. When the link is
clicked, the tabs are not showing. Where did it went wrong? How can I
write a javascript that resembles link_to_remote? Please help

Easiest way is probably to look at what link_to_remote generates and
copy that.

Fred

Frederick C. wrote:

On Jul 7, 8:22�am, user splash [email protected]
wrote:

Hi,

Sorry my mistake. This problem doesnt happen to my link_to_remote. The
above problem is happening to my javascript tree menu. When the link is
clicked, the tabs are not showing. Where did it went wrong? How can I
write a javascript that resembles link_to_remote? Please help

Easiest way is probably to look at what link_to_remote generates and
copy that.

Fred

Thanks. I have copied what link_to_remote generates and it now works.