You need to sign in to do that
Don't have an account?
Static Resource > How To Dynamically Bind The Reference Name in VIsualforce Page
Hello,
I have static resource in ise in my visualforce pages. These work well. To include them I do something similar to the following.
<apex:includeScript value="{!URLFOR($Resource.Content_TestSite_HtmlAndScripts, '/scripts/bootstrap-datetimepicker.min.js')}"/>
I wish to change this though to dynamically pass in the resource name that I require.
E.g. <apex:includeScript value="{!URLFOR($Resource.{resourceParameterName}, '/scripts/bootstrap-datetimepicker.min.js')}"/>
Or <apex:includeScript value="{!URLFOR($Resource.Content_{resourceParameterNa}_HtmlAndScripts, '/scripts/bootstrap-datetimepicker.min.js')}"/>
When I try to save this in my IDE I get syntaz errors though.
Do you know if what I'm trying to do is possible & if so can both ways I'm trying to set the name above work?
Thanks in advance.
Try accessing it like array instead of (.) Dot operator.
example: (Note- resourceParameterName is a variable, not string)
Hope it helps.
All Answers
Try accessing it like array instead of (.) Dot operator.
example: (Note- resourceParameterName is a variable, not string)
Hope it helps.
Thank you. Works perfectly.
Glad it worked. Whew!! :)
I am getting error at line 2. while at line number 1 file name displays well on VF page
1. Current JS file used - {!pacJSconfigDetails.name}
2. <apex:includeScript value="{!$Resource[{!pacJSconfigDetails.name}]}"/>
Thanks,