This works well when it is there in Javascript tag inside visualforce page, but fails when the Javascript is moved to a static resource and the static resource is referenced in the page like below:

<apex:includeScript loadOnReady="true" value="{!URLFOR($Resource.TestRes, 'JS/Test.js')}" />

1 Answer 1


Ok, found out that to use global merged fields we have to use it like this:

// Define this in your page.

window.$Component = window.$Component || {};
$Component.idFocusedTab = '{!$Component.idPageTestCase.idForm.idFocusedTab}';

Then use this in your static resource : $Component.idFocusedTab

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .