+ Start a Discussion
lil_rangerlil_ranger 

Display table only when checkbox is checked

I have a div statement that I can't seem to get to work properly.  If the checkbox isn't checked it is still displaying the table, but not "Estimated Labor Hours" line.   I'm sure it's something simple, but I can't seem to figure it out

 

<div style = "{!IF(Contract.Display_Labor_Hours_Table__c == true, '', 'display:none;')}">
<b>Estimated Labor Hours:</b><br />

<table border="1" width="100%" cellspacing="0" cellpadding="0">
<tr>
<th align="left"><b>Labor Category</b></th>
<th align="left"><b>Hours</b></th>
<th align="left"><b>Hourly Rate</b></th>
<th align="left"><b>Category</b></th>
</tr>
<tr>
<td>Architect</td>
<td>{!ROUND(Contract.Total_Estimated_Architect_Labor_Hrs__c,0)}</td>
<td><apex:outputField value="{!Contract.Architect_Hourly_Rate__c}"/></td>
<td><apex:outputField value="{!Contract.Total_Architect_Labor_Cost__c}"/></td>
</tr>
<tr>
<td>Consultant</td>
<td>{!ROUND(Contract.Total_Estimated_Consultant_Labor_Hrs__c,0)}</td>
<td><apex:outputField value="{!Contract.Consultant_Hourly_Rate__c}"/></td>
<td><apex:outputField value="{!Contract.Total_Consultant_Labor_Cost__c}"/></td>
</tr>
</table></div><br />

 

Best Answer chosen by Admin (Salesforce Developers) 
sfdcfoxsfdcfox

I would make it easy on yourself and just replace the div with an apex:outputPanel:

 

<apex:outputText rendered="{!Contract.Display_Labor_Hours_Table__c}">
   <!-- your code goes here -->
</apex:outputText>

 

All Answers

sfdcfoxsfdcfox

I would make it easy on yourself and just replace the div with an apex:outputPanel:

 

<apex:outputText rendered="{!Contract.Display_Labor_Hours_Table__c}">
   <!-- your code goes here -->
</apex:outputText>

 

This was selected as the best answer
jwetzlerjwetzler

sfdcfox, your example says outputText :)

 

But I second the outputPanel suggestion

lil_rangerlil_ranger

Yes, that worked!  And it was less of a headache than the div.  I will look at the rest of my VF page and implement the OutputPanel.  Thank you!