3

I'm getting this error on what should be a fairly basic set of tags on a VisualForce page that is rendered as PDF. I can't see the issue. Any ideas? If I slim this down to just rendered="true" I get no error.

*Error: PROD_UW_AccountSummary_PRT line 645, column 3: The element type "apex:outputPanel" must be terminated by the matching end-tag ""

Error: The element type "apex:outputPanel" must be terminated by the matching end-tag "".*

<apex:page standardStylesheets="false" standardController="Account_Summary__c" readOnly="false" extensions="AccountSummaryController" renderAs="pdf" showHeader="false"  >
 ...
<!--<apex:outputPanel rendered="{!IF(CONTAINS(Account_Summary__c.Lines_of_Business__c,'WC'),"true","false")}" > -->

<!-- <apex:outputPanel rendered="{!CONTAINS(Account_Summary__c.Lines_of_Business__c,'WC')}" > -->

<!-- This works with a multi select picklist value. The others render all is there is no values selected in the picklist for some reason. -->
<apex:outputPanel rendered="{!IF(CONTAINS(Account_Summary__c.Lines_of_Business__c,'WC'),'true','false')}" >

      <apex:panelGrid columns="2" id="sectionWC" width="100%" styleClass="allPDFpanelGrid" headerClass="allPDFpanelGridrows" columnClasses="panelCol1, panelCol2" rowClasses="allPDFpanelGridrows" border="1" >
         <apex:outputText value="Does portfolio contains more than 10% exposure in Hazard Groups F&G? - If yes, comment below:" />     
         <apex:outputField value="{!Account_Summary__c.WC_portfolio_Hazard_Group_F_G_exposure__c}" />

         <apex:outputText value="Comment on analysis of exposure"  rendered="{!Account_Summary__c.WC_portfolio_Hazard_Group_F_G_exposure__c="Yes"}"/> 
         <apex:outputField value="{!Account_Summary__c.WC_Comment_on_analysis_of_exposure__c}" style="color:blue;" rendered="{!Account_Summary__c.WC_portfolio_Hazard_Group_F_G_exposure__c="Yes"}" />                     
      </apex:panelGrid>
</apex:outputPanel>
4

The problem is the quotes. You should use single quotes within double-quotes. Still, you don't need them at all; the result of a Boolean function is already a Boolean:

<apex:outputPanel rendered="{!CONTAINS(Account_Summary__c.Lines_of_Business__c,'WC')}" >

I'm not sure why the quotes would work normally but not in PDF mode, but I'd recommend you avoid doing this entirely, since it's not proper XML. Here's another line that illustrates the change you'd want to make:

        <apex:outputField value="{!Account_Summary__c.WC_Comment_on_analysis_of_exposure__c}" 
            style="color:blue;" 
            rendered="{!Account_Summary__c.WC_portfolio_Hazard_Group_F_G_exposure__c='Yes'}" />
  • Thanks. This works. <apex:outputPanel rendered="{!CONTAINS(Account_Summary__c.Lines_of_Business__c,'WC')}" > – rickmac Mar 21 '17 at 19:18
  • I updated the outputPanel in the source above for any future use. – rickmac Mar 21 '17 at 19:21
  • Actually, it appears that this format will not work with multi-select picklist values so you have to use an If-true/false conditional statement. I updated the source with a comment . – rickmac Mar 21 '17 at 21:06

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.