CodeCharge Studio
search Register Login  

Visual Web Reporting

Visually create Web Reports in PHP, ASP, .NET, Java, Perl and ColdFusion.
CodeCharge.com

YesSoftware Forums -> CodeCharge Studio -> PHP

 Tabs and navigation

Print topic Send  topic

Author Message
kimstl

Posts: 6
Posted: 11/27/2008, 9:58 AM

I have two issues with using tabs:

1) In a tabbed view, how to remain in the same tab after submitting a record

2) How to link to a specific tab in a tabbed view from another page

Does anyone have a solution or experience of these issues with tabs? Or is there any support documentation that you could let me know about.

Thanks,

K
View profile  Send private message
andy


Posts: 183
Posted: 11/27/2008, 12:13 PM

Here is some information on how to navigate to tabs from a url for the YahooUI version:

http://blog.davglass.com/files/yui/tab7/index.php#tab3

You can control the active tab state using session variables

Here's some code to get you on your way

// Retrieves session variables for the active tabs and sets the active tabs accordingly  
global $tabcontrol;  
global $demotab;  
  
$demotab = CCGetSession("session_demotab", "tab1");  
$demo2tab = CCGetSession("session_demo2tab", NULL);  
  
switch ($demotab) {  
case "tab1":  
    $script = "<script language=javascript>     
	var myTabs = new YAHOO.widget.TabView('demo', { activeIndex: 0 } );   
	</script>";  
	$tabcontrol->SetValue($script);  
    break;  
case "tab2":  
    $script = "<script language=javascript>     
	var myTabs = new YAHOO.widget.TabView('demo', { activeIndex: 1 } );   
	</script>";  
	$tabcontrol->SetValue($script);  
    break;  
case "tab3":  
    $script = "<script language=javascript>     
	var myTabs = new YAHOO.widget.TabView('demo', { activeIndex: 2 } );   
	</script>";  
	$tabcontrol->SetValue($script);  
    break;  
case "tab4":  
    $script = "<script language=javascript>     
	var myTabs = new YAHOO.widget.TabView('demo', { activeIndex: 3 } );   
	</script>";  
	$tabcontrol->SetValue($script);  
    break;  
case "tab5":  
    $script = "<script language=javascript>     
	var myTabs = new YAHOO.widget.TabView('demo', { activeIndex: 4 } );   
	</script>";  
	$tabcontrol->SetValue($script);  
    break;  
case "tab6":  
    $script = "<script language=javascript>     
	var myTabs = new YAHOO.widget.TabView('demo', { activeIndex: 5 } );   
	</script>";  
	$tabcontrol->SetValue($script);  
    break;  
default:  
    $script = "<script language=javascript>     
	var myTabs = new YAHOO.widget.TabView('demo', { activeIndex: 0 } );   
	</script>";  
	$tabcontrol->SetValue($script);  
	break;  
}  
  
This is used in conjunction with an html label (here $tabcontrol). Make sure content is set to Html not Text (to run the javascript in the above code)

You need to set the session value using events (may be by clicking on a submit button on a tab you can have the OnClickEvent with:

CCSetSession("session_demotab", "tab2");  

Hope that helps
_________________
Andy

RAD tools for rich UI controls:
http://www.koolphptools.com
View profile  Send private message
kimstl

Posts: 6
Posted: 11/28/2008, 4:26 AM

Many, many thanks for this Andy - I need to spend some time figuring it out....

K
View profile  Send private message
kimstl

Posts: 6
Posted: 12/02/2008, 4:06 PM

I would like to set the active tab using the session variable method - I have spent some time on this and am still unclear on exactly where I need to add the code.

There seems to be very little CodeCharge oriented guidance on this out there but I have noticed this thread on these pages:

http://forums.codecharge.com/posts.php?post_id=92908

The last post on this states:

Edit: This doesn't work in page load because the tabs are not yet loaded, use the following instead

YAHOO.util.Event.onContentReady("Tab_Container_Panel", function(){YahooTabbedView_setActive();});

How does this fit with the generated code which is as follows:

//Panel1YahooTabbedView Start @3-9B4E777F
function Panel1YahooTabbedView_start() {
Panel1YahooTabbedView = new YAHOO.widget.TabView();
var Panel2_tab = new YAHOO.widget.Tab({
label: "Panel2",
active: true,
contentEl: document.getElementById("Panel1Panel2")
});
Panel1YahooTabbedView.addTab(Panel2_tab);
var Panel3_tab = new YAHOO.widget.Tab({
label: "Panel3",
contentEl: document.getElementById("Panel1Panel3")
});
Panel1YahooTabbedView.addTab(Panel3_tab);
YAHOO.util.Event.onContentReady("Panel1", function() {
Panel1YahooTabbedView.appendTo(this);
addEventHandler("Panel1Panel3testsession1Button_Delete", "click", Panel1Panel3testsession1Button_Delete_OnClick);
addEventHandler("Panel1Panel3testsession1Button_Cancel", "click", Panel1Panel3testsession1Button_Cancel_OnClick);
});
}
//End Panel1YahooTabbedView Start

//bind_events @1-F08E665D
function bind_events() {
Panel1YahooTabbedView_start();
}
//End bind_events

window.onload = bind_events; //Assign bind_events @1-19F7B649

//End CCS script


It would be good if we could get some definitive guidance here on this forum.

K
View profile  Send private message

Add new topic Subscribe to topic   


These are Community Forums for users to exchange information.
If you would like to obtain technical product help please visit http://support.yessoftware.com.

Web Database

Join thousands of Web developers who build Web applications with minimal coding.
CodeCharge.com

Home   |    Search   |    Members   |    Register   |    Login


Powered by UltraApps Forum created with CodeCharge Studio
Copyright © 2003-2004 by UltraApps.com  and YesSoftware, Inc.