You need to sign in to do that
Don't have an account?

I want a box in a data table on a VF used as print out to show specific words based on results to checkbox field
This VF page provides printout of Opportunity (Application). In the data table, under the header Site Services, I want specific words to show based on the result of the related checkbox. For example, if RESID__c = TRUE, I want the word Residential to show. When I try to insert If, then statements the entire statement shows in the box. As written now, a checkbox shows with or without checkmark depending on the selection on the application. How do I do this? Below is the code for the column.
<apex:column >
<apex:facet name="header"><p Class="SF_Headers">Site Services</p></apex:facet>
<apex:outputField value="{!s.RESID__c}" styleClass="SF_Fields"/>
<apex:outputField value="{!s.ADMIN_del__c}" styleClass="SF_Fields"/>
<apex:outputField value="{!s.CLIN__c}" styleClass="SF_Fields"/>
<apex:outputField value="{!s.PREK_del__c}" styleClass="SF_Fields"/>
<apex:outputField value="{!s.DAY_VOC__c}" styleClass="SF_Fields"/>
<apex:outputField value="{!s.EDUC__c}" styleClass="SF_Fields"/>
<apex:outputField value="{!s.EI__c}" styleClass="SF_Fields"/>
<apex:outputField value="{!s.COMMSUPP__c}" styleClass="SF_Fields"/>
<apex:column >
<apex:facet name="header"><p Class="SF_Headers">Site Services</p></apex:facet>
<apex:outputField value="{!s.RESID__c}" styleClass="SF_Fields"/>
<apex:outputField value="{!s.ADMIN_del__c}" styleClass="SF_Fields"/>
<apex:outputField value="{!s.CLIN__c}" styleClass="SF_Fields"/>
<apex:outputField value="{!s.PREK_del__c}" styleClass="SF_Fields"/>
<apex:outputField value="{!s.DAY_VOC__c}" styleClass="SF_Fields"/>
<apex:outputField value="{!s.EDUC__c}" styleClass="SF_Fields"/>
<apex:outputField value="{!s.EI__c}" styleClass="SF_Fields"/>
<apex:outputField value="{!s.COMMSUPP__c}" styleClass="SF_Fields"/>
public string showMsg { get; set; }
public boolean Msgid { get: set; }
if (checkboxfield__c == true)
{
Showmsg = 'Here is your message;' ;
Msgid = true
}
But when I try to enter this code in the Controller, it accepts the first two lines but fails at the if statement. I get this error message:
Error: Compile Error: Expecting '}' but was: 'if' at line 29 column 3
If I throw a { in front of the if and continue I get this error message
Error: Compile Error: Variable does not exist: RESID__c at line 29 column 8
Even though the field RESID__c is listed in both the Controller and VF page.
FYI - The code suggested for the VF Page is
<outputText value="{!showMsg}" rendered="{!Msgid}" / >
What am I doing wrong? This suggestion worked for Vin back in September 2017 - answer was provided by David Hales.