0

I'm trying to display some Visualforce if a checkbox = True. Here is my code snippet:

<apex:outputPanel id="warning" rendered="{!(Innovation__c.Show_Warning__c)}"> 
    <h1 color="red"> WARNING </h1>
</apex:outputPanel>

Here is the error I'm getting:

Unknown property 'Innovation__c.Show_Warning__c' referenced in DisplayRejectionWarning

The API names are correct, I've checked a billion times. Why is it not recognising the field?

3
  • Are you using a standard controller in your page?
    – Raul
    Commented May 25, 2018 at 9:39
  • I believe your code is wrong.consider Innovation__c is child and show_warning_c is parent.if you write that code it wont work . if you refering parentid field here rendered="{!Innovation__c.Show_Warning__r.checkbox==true}" something like this.can you plz post the code. here checkbox is showwarning object field
    – Annappa PH
    Commented May 25, 2018 at 9:39
  • If you are using a custom controller, make sure it is public. By default it is private
    – Samir
    Commented May 25, 2018 at 10:06

3 Answers 3

1

You should create a property for the Custom Object in your controller before referencing it in the Visualforce page.

public Innovation__c inv {get; set;}

After creating the property, you can use it in VF page as below:

<apex:outputPanel id="warning" rendered="{!(inv.Show_Warning__c)}"> 
    <h1 color="red"> WARNING </h1>
</apex:outputPanel>

Make sure you add the controller in the VF Page.

1

You can use Innovation__c.Show_Warning__c in a rendered condition only if you are using StandardController on that Visualforce page as "Innovation__c". Most likely you are using a custom controller/extension.

In that case, your object needs to be created as a property in your controller.

public Innovation__c Innovation {get; set;}

Then you can use Innovation.Show_Warning__c in your rendering conditions.

0

Thanks for the suggested solutions.

I actually managed to come right by adding the controlling object (Innovation__c) in the tag. Now its recognising the merge field, "Innovation__c.Show_Warning__c".

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .