function readOnly(count){ }
Starting November 20, the site will be set to read-only. On December 4, 2023,
forum discussions will move to the Trailblazer Community.
+ Start a Discussion
JavierPJavierP 

Get id of an apex:tab

Is there any way to get the Id of an apex:tab component or any component inside an apex:tab using $Component ?

I'm getting an empty string for some reason. This is the way I'm using it at the moment:

<apex:form id="theForm">
	<apex:tabPanel switchType="client" id="theTabPanel">
		<apex:tab label="A Tab" name="atab" id="theTab">
			<apex:outputPanel id="testField">test</apex:outputPanel>
		</apex:tab>
	</apex:tabPanel>
</apex:form>

{!$Component.theForm.theTabPanel.theTab.testField}

 The string is empty if I try to reference either a tab or anything inside a tab, has anyone run into this?

 

Thanks in advance.

Best Answer chosen by Admin (Salesforce Developers) 
jwetzlerjwetzler

I'm not really sure why this is but it should work if you leave out the tabPanel and tab. I'd expect it to work the same way you expected it to... tabPanel doesn't always seem to behave consistently as other "container" components

 

 

{!$Component.theForm.testField}

All Answers

jwetzlerjwetzler

I'm not really sure why this is but it should work if you leave out the tabPanel and tab. I'd expect it to work the same way you expected it to... tabPanel doesn't always seem to behave consistently as other "container" components

 

 

{!$Component.theForm.testField}
This was selected as the best answer
JavierPJavierP

Gosh, Why didn't I think of that? It worked, thanks!