Вопрос

I want to assign a static resource image based on a pick list selection to . Any idea how do I do that using apex class. I was able to achieve this using a javascript function but then I have a requirement to render this page as PDF which doesn't support javascript.

Any ideas/pointers ????

Это было полезно?

Решение

Use Apex:variable to assign image path dynamically.

Here is a sample code.

public class TestStaticResource{

public string ImagePath{
    get;set;
}
public TestStaticResource(){
    ImagePath='images/yourImage.png';
}

}

 <apex:form>
      <apex:variable var="var" value="{!ImagePath}"/> 
      <apex:image url="{!URLFOR($Resource.StaticResuorceName, var)}"/> 
 </apex:form>

Лицензировано под: CC-BY-SA с атрибуция
Не связан с StackOverflow
scroll top