1

I have this code on a VF page

<apex:dataTable value="{!List_of_images}" var="The_list">
    <apex:column headerValue="Pic" styleClass="P_image" value=""/>
    <apex:column styleClass="P_image">
        <apex:facet name="header">Pic</apex:facet>
        <a href="{!The_list.LINK_IN_DB}" target="_blank"><apex:outputField value="{!The_list.Pic_in_db}"/></a>
    </apex:column>
</apex:dataTable>

It works perfectly, but when I publish the Visualforce Page on a Force.com Site, it doesn't work. What could be issue?

Controller

public with sharing class GetRecords {
    public List<Contact> ContactList {get;set;}

    public GetRunningRecords() {
        ContactList = [ SELECT Name, Pic_in_db__c, LINK_IN_DB__c FROM Contact];
    }
}

Strangely enough when I inspect element, I don't see the value from {!The_list.LINK_IN_DB}, I just see

  <a href target="_blank">

Sample URLs that I'm using include https://www.facebook.com/ & https://twitter.com/

I slightly altered code to this

 <apex:column styleClass="P_image">
      <apex:facet name="header">Pic</apex:facet>
           <apex:outputLink value="https://login.salesforce.com/?locale=eu" id="theLink"><apex:outputField value="{!The_list.Pic_in_db}"/></apex:outputLink>
 </apex:column>

It works, but when I put in the URL from the controller as the value like this....

 <apex:outputLink value="{!The_list.LINK_IN_DB}" id="theLink"><apex:outputField value="{!The_list.Pic_in_db}"/></apex:outputLink>

It doesn't work. Pretty much scratching my hair out at this point.

0
0

Check if your site's Guest User has access to the object your controller is querying on the database. If it isn't visible (the user doesn't have the read permission), the visitors can't access it.

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.