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')}" />

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

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.