You need to sign in to do that
Don't have an account?
FastSnail
CSS Display property control within a related List
Hello everyone,
I am struggling with the following. Thanks in advance for your help.
Goal: My contact object allows to load a picture of the contact. In a related list of contacts, I need:
- the picture of the contact to be displayed if it exists. The contact.URLPicture1__c URLType field is auto-populated by a trigger with https://www.ccnfr.org/personsb/contactId.jpg . A PHP mechanism allows to load a real picture on the server at this address.
- OR a default picture such as https://www.ccnfr.org/personsb/CCNPersonDefaultPicture.jpg if the picture had not been loaded yet.
How can I acheive this?
My VF page so far, which does not work (except when there is only ONE contact in the list).
Is a wrapper a solution? Thanks in advance for your suggestions / help.
<apex:pageBlock >
<apex:pageBlockTable value="{!contactList}" var="con" id="contable" >
<apex:column >
<img src="{!con.URLPicture1__c}" style="display:none;" id="URLPic1" onload="pic1F()" />
<img src="https://www.ccnfr.org/personsb/ccnvehicledefaultpicture.jpg" style="display:inline;" id="URLDefPic1" />
<script>
var URLPic1JS = document.getElementById("URLPic1");
var URLDefPic1JS = document.getElementById("URLDefPic1");
function pic1F(){ ///if this runs, it is because URLPicture1__c exist = the real picture that I need to display
URLPic1JS.style.display = 'inline';
URLDefPic1JS.style.display = 'none';
}
</script>
</apex:column>
</apex:pageBlockTable>
All suggestions are welcome. Thanks. Jerome
I am struggling with the following. Thanks in advance for your help.
Goal: My contact object allows to load a picture of the contact. In a related list of contacts, I need:
- the picture of the contact to be displayed if it exists. The contact.URLPicture1__c URLType field is auto-populated by a trigger with https://www.ccnfr.org/personsb/contactId.jpg . A PHP mechanism allows to load a real picture on the server at this address.
- OR a default picture such as https://www.ccnfr.org/personsb/CCNPersonDefaultPicture.jpg if the picture had not been loaded yet.
How can I acheive this?
My VF page so far, which does not work (except when there is only ONE contact in the list).
Is a wrapper a solution? Thanks in advance for your suggestions / help.
<apex:pageBlock >
<apex:pageBlockTable value="{!contactList}" var="con" id="contable" >
<apex:column >
<img src="{!con.URLPicture1__c}" style="display:none;" id="URLPic1" onload="pic1F()" />
<img src="https://www.ccnfr.org/personsb/ccnvehicledefaultpicture.jpg" style="display:inline;" id="URLDefPic1" />
<script>
var URLPic1JS = document.getElementById("URLPic1");
var URLDefPic1JS = document.getElementById("URLDefPic1");
function pic1F(){ ///if this runs, it is because URLPicture1__c exist = the real picture that I need to display
URLPic1JS.style.display = 'inline';
URLDefPic1JS.style.display = 'none';
}
</script>
</apex:column>
</apex:pageBlockTable>
All suggestions are welcome. Thanks. Jerome
I dont think this can be achived only thorough Visualforce, you have to use a controller and put the logic in apex code.
See the code in the blog below,
http://salesforcegirl.blogspot.in/2013/06/showing-images-in-your-custom.html
Regards,
Ashish