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
❤Code❤Code 

image formula field in td html tag

Hi All,

I am trying to display image formula field in html td tag in custom visualforce page salesforce1. But it is not displaying. Can anybody help - 

<apex:repeat value="{!contactList}" var="contact">
                    <tr>
                        <td align="left"><a href="/{!contact.Id}">{!contact.Name}</a></td>
                        <td>{!contact.RAG_Status__c}</td> /// formula field for image
                    </tr>
</apex:repeat>

But it is displaying as below in the column. 

<img src="https://cs18.salesforce.com/resource/1427100618000/Amber_Flag" alt=" " border="0"/>

Regards
Best Answer chosen by ❤Code
Leslie  KismartoniLeslie Kismartoni
Sorry the formatting got a bit goofy:
 
<apex:repeat value="{!contactList}" var="contact">
   <tr>
      <td align="left"><a href="/{!contact.Id}">{!contact.Name}</a></td>
      <td><apex:outputText value="{!contact.RAG_Status__c}" escape="false"/></td> 
   </tr>
</apex:repeat>



 

All Answers

ManojjenaManojjena
Hi ,

IMAGE("/resource/1427100618000/Amber_Flag", "")
check this and create aformula with return type as Text .
 
sandeep sankhlasandeep sankhla
Hi sdfc,

Instead of returning the Image tag you try by returning only url or path of the image and keep the image tag inside Td...which means insetad of getting everything from fromula feild you get only url which yoiu can use in Image tag..

Check with this and let me know if it works for you

Thanks
Sandeep
Leslie  KismartoniLeslie Kismartoni
If you see the actual HTML, you just need to use the escape flag in...

Try this:
 
<apex:repeat value="{!contactList}" var="contact">
                    <tr>
                        <td align="left"><a href="/{!contact.Id}">{!contact.Name}</a></td>
                        <td><apex:outputText value="{!contact.RAG_Status__c}" escape="false"/></td> 
                    </tr>
</apex:repeat>

See this link: https://www.salesforce.com/docs/developer/pages/Content/pages_security_tips_scontrols.htm

Hope that helps! 
Leslie  KismartoniLeslie Kismartoni
Sorry the formatting got a bit goofy:
 
<apex:repeat value="{!contactList}" var="contact">
   <tr>
      <td align="left"><a href="/{!contact.Id}">{!contact.Name}</a></td>
      <td><apex:outputText value="{!contact.RAG_Status__c}" escape="false"/></td> 
   </tr>
</apex:repeat>



 
This was selected as the best answer
Leslie  KismartoniLeslie Kismartoni
Thanks for selecting mine as a best answer... Cheers!