function readOnly(count){ }
Starting November 20, the site will be set to read-only. On December 4, 2023,
forum discussions will move to the Trailblazer Community.
+ Start a Discussion
Jonathan Wolff 7Jonathan Wolff 7 

Error in Visualforce when rendering

Hello, I added a Visualforce to campaign page. In campaign I have the field "PDF_Vorlage__c". If the value of this field is Vorlage 1 I want to display a text in the visualforce but I get the error:

Error: Attribute value in <apex:inputField> must contain only a formula expression that resolves to a single controller variable or method in Campaign_PDF at line 24 column 93

How can I solve it. My code:

<apex:page standardController="Campaign" renderAs="pdf">
    <apex:repeat value="{!Campaign.CampaignMembers}" var="cMem">
        <div style="page-break-after:always;"> 
            <h1>Welcome to APP!</h1>
            <p>Thank you, <b><apex:outputText value=" {!cMem.Name}"/></b>, for working with APP.</p>
            <p>Your campaign details are:</p>
            <table>
                <tr><th>Account Name</th>
                    <td><apex:outputText value="{!Campaign.Name}"/></td>
                </tr>
                <tr><th>Account Rep</th>
                    <td><apex:outputText value="{!Campaign.Owner.Name}"/></td>
                </tr>
                <tr><th>Customer Since</th>
                    <td><apex:outputText value="{0,date,long}">
                        <apex:param value="{!Campaign.CreatedDate}"/>
                        </apex:outputText></td>
                </tr>
                
            </table>
            <apex:pageBlock>
            <apex:pageBlockSection rendered="true">

  <apex:inputField  value="This is the text i want to display" rendered="{!IF(!Campaign.PDF_Vorlage__c ='Vorlage 1' )}"/>  
                                                                     
</apex:pageBlockSection>
            
            
            </apex:pageBlock>
            
        </div>
    </apex:repeat>
</apex:page>
Best Answer chosen by Jonathan Wolff 7
SwethaSwetha (Salesforce Developers) 
HI Jon,
Looks like an issue with the value you are passing. Try something like  
<apex:inputField  value="{!Campaign.PDF_Vorlage__c}" rendered="{!IF(Campaign.PDF_Vorlage__c ='Vorlage 1' ,true,false)}"/>
See related:https://help.salesforce.com/s/articleView?id=000324662&type=1

Hope this helps you. Please mark this answer as best so that others facing the same issue will find this information useful. Thank you