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
ryyhryyh 

Apex component unknown property error

I have the most basic of components and want to use an attribute in a formula. But if i do i get a "Error: Unknown property 'IF(state=='Y', true, false)'"

 

<apex:component>
<apex:attribute name="state" description="The object" type="string" required="true" />
<apex:inputCheckbox value="{!IF(state=='Y', true, false)}" />
</apex:component>

 I can use the variable "state" in the visualforce page in a formula (same exact vf cut and pasted into a component) and it works fine

joshbirkjoshbirk

You haven't defined a component controller as of yet, so there's no properties for the component to pull from.  The VF page is a different controller context.

ryyhryyh
The variable "state" is an apex attribute and is available in the component context. For example this works fine

<apex:component>
<apex:attribute name="state" description="The object" type="string" required="true" />
{$state}
</apex:component>

It's only when I put it into a formula that I get the error.