Is it possible to create a custom Visualforce component that accepts an SObject field as an attribute? Basically, I want to replicate what's done with something like ...

<apex:inputText value="{!record.Name}"/>

... so that I can have a custom component that can be used as ...

<c:inputSpecialText value="{!record.Name}"/>

In this case, how should I define the attribute in my custom component?

1 Answer 1


I'm using a component that takes three attributes

<c:FranchisorInvoiceFooter DDebit="{!directdebit}" Invoice="{!inv}" BillingCountry="{!client.BillingCountry}"/>

where client.BillingCountry is a sObject Field

The attribute definition for this is

<apex:attribute name="BillingCountry" description="billing Country" assignTo="{!country}" type="String" required="false"/>

You must log in to answer this question.

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