You need to sign in to do that
Don't have an account?

Cannot access tab through $Component and Path
I am trying to access a tab through getElementById the path is $Component.page.TabPanel.tabTwo
This returns a null - here is the test page - any ideas...
thanks Joe
<apex:page standardController="Account" showHeader="true" id="page">
<!-- Define Tab panel .css styles -->
<style>
.activeTab {background-color: #236FBD; color:white; background-image:none}
.inactiveTab { background-color: lightgrey; color:black; background-image:none}
</style>
<!-- Create Tab panel -->
<apex:tabPanel switchType="client" selectedTab="name2" id="TabPanel"
tabClass="activeTab" inactiveTabClass="inactiveTab">
<apex:tab label="One" name="name1" id="tabOne">
content for tab one</apex:tab>
<apex:tab label="Two" name="name2" id="tabTwo">
content for tab two</apex:tab>
</apex:tabPanel>
<input type="button" onclick="testPath()" value="Show Path"></input>
<script>
function testPath(){
try{
var s = document.getElementById('{!$Component.page.TabPanel.tabTwo}');
alert('Component:' + s.id);
}catch(error){
alert('Error:' + error.message);
}
}
</script>
</apex:page>
Hi,
Replace your java script code as below:
<script>
function testPath(){
try{
var s = document.getElementById('{!$Component.tabTwo}');
alert('Component:' + s.id);
}catch(error){
alert('Error:' + error.message);
}
}
</script>
Please let me know if u have any problem regarding same,and if this post helps u give KUDOS by click on star at left.