[FIX] JavaScript error cbshowtabs array undefined

12 years 3 months ago #43153 by nicowolf
Hi everyone,

I recently upgraded from cb 1.0.2 to cb 1.1 using the expert upgrade instructions.

I did everything that was instructed in the readme file.

CB works without any problems except for a javascript error in the bottom left corner of IE7 that reads: 'cbshowtabsArray' is undefined.

I looked in the files that got copied over and all looks fine to me. The object does get created in comprofiler.class.php

But when I look at the source code that gets generated in the html format I see this:

[code:1]<script type="text/javascript"><!--//--><![CDATA[//><!--
var tabPanecb_head;
cbshowtabsArray.push( [,'tabPanecb_head.setSelectedIndex( 0 );'] );
//--><!]]></script>[/code:1]

and after a few lines, the object is created:

[code:1]<script type="text/javascript"><!--//--><![CDATA[//><!--
var tabPanecb_tabmain;
var cbshowtabsArray = new Array();
function showCBTab( sName ) {
if ( typeof(sName) == 'string' ) {
sName = sName.toLowerCase();
}
for (var i=0;i<cbshowtabsArray.length;i++) {
for (var j=0;j<cbshowtabsArray[0].length;j++) {
if (cbshowtabsArray[0][j] == sName) {
eval(cbshowtabsArray[1]);
return;
}
}
}
}
cbshowtabsArray.push( [,'tabPanecb_tabmain.setSelectedIndex( 0 );'] );
cbshowtabsArray.push( [,'tabPanecb_tabmain.setSelectedIndex( 1 );'] );
cbshowtabsArray.push( [,'tabPanecb_tabmain.setSelectedIndex( 2 );'] );
cbshowtabsArray.push( [,'tabPanecb_tabmain.setSelectedIndex( 3 );'] );
cbshowtabsArray.push( [,'tabPanecb_tabmain.setSelectedIndex( 4 );'] );
cbshowtabsArray.push( [,'tabPanecb_tabmain.setSelectedIndex( 5 );'] );
//--><!]]></script>[/code:1]

So basically, the error occurs because the call to the object occurs before the object gets created (for the getportrait tab). Does anyone know where in the code we could fix this so that the javascript object gets created before any tabs are loaded?

Thanks in advance...

Post edited by: nicowolf, at: 2007/08/17 01:48

Post edited by: beat, at: 2007/08/17 02:11

Post edited by: beat, at: 2007/11/15 01:37
12 years 3 months ago #43159 by beat
Confirming as bug:

Could reproduce by changing portrait display tab from raw to tab.

Moving to bugs and changing title.

No quick fix yet. Fix proposals welcome ;)

Beat - Community Builder Team Member

Before posting on forums: Read FAQ thoroughly -- Help us spend more time coding by helping others in this forum, many thanks :)
CB links: Our membership - CBSubs - Templates - Hosting - Forge - Send me a Private Message (PM) only for private/confidential info
12 years 3 months ago #43196 by nicowolf
Hey Beat,

Thanks for the update, I will work on it to come up with a solution. I think it should be pretty straight forward, just need to find how we create the object before any other tab is written out. I am still trying to familiarize myself with the CB code... :)

Nico
12 years 3 months ago #43339 by beat
Thanks B)

Problem is probably in comprofiler.class.php .

Beat - Community Builder Team Member

Before posting on forums: Read FAQ thoroughly -- Help us spend more time coding by helping others in this forum, many thanks :)
CB links: Our membership - CBSubs - Templates - Hosting - Forge - Send me a Private Message (PM) only for private/confidential info
12 years 3 months ago #43437 by joomlas
Try to change parameter under cb.menu under plug-in management! I have solved similar issue! ;) www.mrkonjicgrad.com/korisnici/userslist/

Post edited by: joomlas, at: 2007/08/19 20:26
12 years 3 months ago #43439 by nicowolf
Thank you for your suggestion. :)
I will try and apply this solution while I try to fix the code, that would be a more perminent solution for the rest of the community, incase they still wanted to have the flexibility of choice in the plugin parameters...:dry: Thanks again...
Moderators: beatnantkrileon
Time to create page: 0.458 seconds
Facebook Twitter Google LinkedIn