+ Start a Discussion
OcoBriOcoBri 

Make rows invisible if field is null

I'm new to VF.

 

This page will display information for a student in case of emergency.  They may or may not have two parents and 3 other emergency contacts.

How can I change this page to remove sections where the person is null?  Thank you.

 

<apex:page renderAs="pdf" standardController="Contact" sidebar="false" showheader="false">
  <div align="center"><h1><p style="font-family: times, serif; font-size:16pt">
  {!Contact.FirstName} {!Contact.Middle_Name__c} {!Contact.LastName}<br></br>
  <apex:outputText value="{0, number, 00}"><apex:param value="{!Contact.Age__c}" /></apex:outputText>-year old {!Contact.QSAC_Race__c} {!Contact.QSAC_Gender__c}
  <br></br>{!Contact.Alerts__c}</p></h1>
  <img src="{!Contact.Image_URL__c}" alt="{!Contact.FirstName}\'s picture"/>
  <table border="1" align="center">
  <tr><td align="left"><b>{!Contact.Primary_Parent_Guardian_Type__c}:</b> {!Contact.Primary_Parent_Guardian__r.FirstName} {!Contact.Primary_Parent_Guardian__r.LastName}</td>
  <td align="left"><b>{!Contact.Secondary_Parent_Guardian_Type__c}:</b> {!Contact.Secondary_Parent_Guardian__r.FirstName} {!Contact.Secondary_Parent_Guardian__r.LastName}</td></tr>
  <tr><td align="left">{!Contact.Primary_Parent_Guardian__r.MailingStreet}</td>
  <td align="left">{!Contact.Secondary_Parent_Guardian__r.MailingStreet}</td></tr>
  <tr><td align="left">{!Contact.Primary_Parent_Guardian__r.MailingCity} {!Contact.Primary_Parent_Guardian__r.MailingState} {!Contact.Primary_Parent_Guardian__r.MailingPostalCode}</td>
  <td align="left">{!Contact.Secondary_Parent_Guardian__r.MailingCity} {!Contact.Secondary_Parent_Guardian__r.MailingState} {!Contact.Secondary_Parent_Guardian__r.MailingPostalCode}</td></tr>
  <tr><td align="left"><b>Home:</b> {!Contact.Primary_Parent_Guardian__r.HomePhone}</td><td align="left"><b>Home:</b> {!Contact.Secondary_Parent_Guardian__r.HomePhone}</td></tr>
  <tr><td align="left"><b>Mobile:</b> {!Contact.Primary_Parent_Guardian__r.MobilePhone}</td><td align="left"><b>Mobile:</b> {!Contact.Secondary_Parent_Guardian__r.MobilePhone}</td></tr>
  <tr><td align="left"><b>Work:</b> {!Contact.Primary_Parent_Guardian__r.npe01__WorkPhone__c}</td><td align="left"><b>Work:</b> {!Contact.Secondary_Parent_Guardian__r.npe01__WorkPhone__c}</td></tr>
  </table>
  <table border="1" align="center">
  <caption>Other Emergency Contacts</caption>
  <thead>
  <tr>
  <th>Name</th>
  <th>Phone</th>
  </tr>
  </thead>
  <tbody>
  <tr>
  <td>{!Contact.Emergency_Contact_1__r.FirstName} {!Contact.Emergency_Contact_1__r.LastName}</td>
  <td>{!Contact.Emergency_Contact_1_Phone__c}</td>
  </tr>
  <tr>
  <td>{!Contact.Emergency_Contact_2__r.FirstName} {!Contact.Emergency_Contact_2__r.LastName}</td>
  <td>{!Contact.Emergency_Contact_2_Phone__c}</td>
  </tr>
  <tr>
  <td>{!Contact.Emergency_Contact_3__r.FirstName} {!Contact.Emergency_Contact_3__r.LastName}</td>
  <td>{!Contact.Emergency_Contact_3_Phone__c}</td>
  </tr>
  </tbody>
  </table>
  </div>
</apex:page>

 

sandy_salesfdc1sandy_salesfdc1
document.getElementById("div").style.display ='none';